eslint-plugin-svelte 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,7 +26,12 @@ exports.default = (0, utils_1.createRule)("comment-directive", {
|
|
|
26
26
|
additionalProperties: false,
|
|
27
27
|
},
|
|
28
28
|
],
|
|
29
|
-
messages: {
|
|
29
|
+
messages: {
|
|
30
|
+
unused: "Unused {{kind}} directive (no problems were reported).",
|
|
31
|
+
unusedRule: "Unused {{kind}} directive (no problems were reported from '{{rule}}').",
|
|
32
|
+
unusedEnable: "Unused {{kind}} directive (reporting is not suppressed).",
|
|
33
|
+
unusedEnableRule: "Unused {{kind}} directive (reporting from '{{rule}}' is not suppressed).",
|
|
34
|
+
},
|
|
30
35
|
type: "problem",
|
|
31
36
|
},
|
|
32
37
|
create(context) {
|
|
@@ -81,7 +86,7 @@ exports.default = (0, utils_1.createRule)("comment-directive", {
|
|
|
81
86
|
data: { rule: rule.ruleId, kind: parsed.type },
|
|
82
87
|
});
|
|
83
88
|
}
|
|
84
|
-
directives.disableBlock(comment.loc.
|
|
89
|
+
directives.disableBlock(comment.loc.end, rule.ruleId, {
|
|
85
90
|
loc: rule.loc.start,
|
|
86
91
|
});
|
|
87
92
|
}
|
|
@@ -94,7 +99,7 @@ exports.default = (0, utils_1.createRule)("comment-directive", {
|
|
|
94
99
|
data: { kind: parsed.type },
|
|
95
100
|
});
|
|
96
101
|
}
|
|
97
|
-
directives.disableBlock(comment.loc.
|
|
102
|
+
directives.disableBlock(comment.loc.end, ALL_RULES, {
|
|
98
103
|
loc: comment.loc.start,
|
|
99
104
|
});
|
|
100
105
|
}
|
|
@@ -105,7 +110,7 @@ exports.default = (0, utils_1.createRule)("comment-directive", {
|
|
|
105
110
|
if (reportUnusedDisableDirectives) {
|
|
106
111
|
context.report({
|
|
107
112
|
loc: rule.loc,
|
|
108
|
-
messageId: "
|
|
113
|
+
messageId: "unusedEnableRule",
|
|
109
114
|
data: { rule: rule.ruleId, kind: parsed.type },
|
|
110
115
|
});
|
|
111
116
|
}
|
|
@@ -118,7 +123,7 @@ exports.default = (0, utils_1.createRule)("comment-directive", {
|
|
|
118
123
|
if (reportUnusedDisableDirectives) {
|
|
119
124
|
context.report({
|
|
120
125
|
loc: comment.loc,
|
|
121
|
-
messageId: "
|
|
126
|
+
messageId: "unusedEnable",
|
|
122
127
|
data: { kind: parsed.type },
|
|
123
128
|
});
|
|
124
129
|
}
|
|
@@ -140,7 +140,7 @@ exports.default = (0, utils_1.createRule)("prefer-style-directive", {
|
|
|
140
140
|
}
|
|
141
141
|
return {
|
|
142
142
|
"SvelteStartTag > SvelteAttribute"(node) {
|
|
143
|
-
if (node.key.name !== "style") {
|
|
143
|
+
if (!isHTMLElement(node.parent.parent) || node.key.name !== "style") {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
const root = (0, css_utils_1.parseStyleAttributeValue)(node, context);
|
|
@@ -149,5 +149,16 @@ exports.default = (0, utils_1.createRule)("prefer-style-directive", {
|
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
151
|
};
|
|
152
|
+
function isHTMLElement(node) {
|
|
153
|
+
if (node.type === "SvelteElement") {
|
|
154
|
+
if (node.kind === "html") {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
if (node.kind === "special") {
|
|
158
|
+
return node.name.name === "svelte:element";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
152
163
|
},
|
|
153
164
|
});
|
package/package.json
CHANGED
|
@@ -1,60 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-svelte",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"publishConfig": {
|
|
5
|
-
"access": "public"
|
|
6
|
-
},
|
|
3
|
+
"version": "2.1.0",
|
|
7
4
|
"description": "ESLint plugin for Svelte using AST",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
5
|
+
"repository": "git+https://github.com/ota-meshi/eslint-plugin-svelte.git",
|
|
6
|
+
"homepage": "https://ota-meshi.github.io/eslint-plugin-svelte",
|
|
7
|
+
"author": "Yosuke Ota (https://github.com/ota-meshi)",
|
|
8
|
+
"contributors": [
|
|
9
|
+
"JounQin (https://github.com/JounQin)"
|
|
11
10
|
],
|
|
11
|
+
"funding": "https://github.com/sponsors/ota-meshi",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"packageManager": "yarn@1.22.19",
|
|
12
14
|
"engines": {
|
|
13
15
|
"node": "^14.17.0 || >=16.0.0"
|
|
14
16
|
},
|
|
15
|
-
"
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"files": [
|
|
19
|
+
"lib"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"eslint",
|
|
23
|
+
"eslint-plugin",
|
|
24
|
+
"eslintplugin",
|
|
25
|
+
"svelte",
|
|
26
|
+
"sveltejs"
|
|
27
|
+
],
|
|
16
28
|
"scripts": {
|
|
17
|
-
"prebuild": "yarn clean",
|
|
18
29
|
"build": "yarn build:ts",
|
|
19
30
|
"build:ts": "tsc --project ./tsconfig.build.json",
|
|
20
31
|
"clean": "rimraf .nyc_output lib coverage build .svelte-kit svelte.config-dist.js",
|
|
21
|
-
"pretest:base": "cross-env DEBUG=eslint-plugin-svelte*",
|
|
22
|
-
"test": "mocha --require ts-node/register \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
|
|
23
32
|
"cover": "nyc --reporter=lcov yarn test",
|
|
24
|
-
"debug": "mocha
|
|
25
|
-
"
|
|
33
|
+
"debug": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
|
|
34
|
+
"docs:build": "yarn svelte-kit build",
|
|
35
|
+
"docs:preview": "yarn svelte-kit preview",
|
|
36
|
+
"docs:watch": "yarn svelte-kit dev",
|
|
26
37
|
"eslint-fix": "eslint . --fix",
|
|
27
|
-
"update": "ts-node --transpile-only ./tools/update.ts && yarn format-for-gen-file",
|
|
28
38
|
"format-for-gen-file": "eslint src/types-for-node.ts src/utils/rules.ts src/configs --fix",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"mocha": "yarn ts ./node_modules/mocha/bin/mocha.js",
|
|
41
|
+
"new": "yarn ts ./tools/new-rule.ts",
|
|
42
|
+
"prebuild": "yarn clean",
|
|
43
|
+
"prepublishOnly": "yarn clean && yarn build",
|
|
44
|
+
"pretest:base": "cross-env DEBUG=eslint-plugin-svelte*",
|
|
33
45
|
"preversion": "yarn test && git add .",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
46
|
+
"svelte-kit": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js",
|
|
47
|
+
"test": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
|
|
48
|
+
"ts": "node -r esbuild-register",
|
|
49
|
+
"update": "yarn ts ./tools/update.ts && yarn format-for-gen-file",
|
|
50
|
+
"version": "env-cmd -e version yarn update && git add ."
|
|
36
51
|
},
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"eslint": "^7.0.0 || ^8.0.0-0",
|
|
54
|
+
"svelte": "^3.37.0"
|
|
40
55
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"svelte",
|
|
46
|
-
"sveltejs"
|
|
47
|
-
],
|
|
48
|
-
"author": "Yosuke Ota (https://github.com/ota-meshi)",
|
|
49
|
-
"contributors": [
|
|
50
|
-
"JounQin (https://github.com/JounQin)"
|
|
51
|
-
],
|
|
52
|
-
"funding": "https://github.com/sponsors/ota-meshi",
|
|
53
|
-
"license": "MIT",
|
|
54
|
-
"bugs": {
|
|
55
|
-
"url": "https://github.com/ota-meshi/eslint-plugin-svelte/issues"
|
|
56
|
+
"peerDependenciesMeta": {
|
|
57
|
+
"svelte": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
56
60
|
},
|
|
57
|
-
"homepage": "https://ota-meshi.github.io/eslint-plugin-svelte/",
|
|
58
61
|
"dependencies": {
|
|
59
62
|
"debug": "^4.3.1",
|
|
60
63
|
"eslint-utils": "^3.0.0",
|
|
@@ -65,22 +68,13 @@
|
|
|
65
68
|
"sourcemap-codec": "^1.4.8",
|
|
66
69
|
"svelte-eslint-parser": "^0.16.0"
|
|
67
70
|
},
|
|
68
|
-
"peerDependencies": {
|
|
69
|
-
"eslint": "^7.0.0 || ^8.0.0-0",
|
|
70
|
-
"svelte": "^3.37.0"
|
|
71
|
-
},
|
|
72
|
-
"peerDependenciesMeta": {
|
|
73
|
-
"svelte": {
|
|
74
|
-
"optional": true
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
71
|
"devDependencies": {
|
|
78
72
|
"@babel/core": "^7.16.0",
|
|
79
73
|
"@babel/eslint-parser": "^7.17.0",
|
|
80
74
|
"@babel/plugin-proposal-function-bind": "^7.16.7",
|
|
81
75
|
"@babel/types": "^7.16.0",
|
|
82
76
|
"@fontsource/fira-mono": "^4.5.0",
|
|
83
|
-
"@ota-meshi/eslint-plugin": "^0.
|
|
77
|
+
"@ota-meshi/eslint-plugin": "^0.11.0",
|
|
84
78
|
"@sindresorhus/slugify": "^2.1.0",
|
|
85
79
|
"@sveltejs/adapter-static": "^1.0.0-next.26",
|
|
86
80
|
"@sveltejs/kit": "^1.0.0-next.240",
|
|
@@ -110,10 +104,10 @@
|
|
|
110
104
|
"eslint-plugin-jsonc": "^2.0.0",
|
|
111
105
|
"eslint-plugin-markdown": "^2.1.0",
|
|
112
106
|
"eslint-plugin-node": "^11.1.0",
|
|
113
|
-
"eslint-plugin-node-dependencies": "^0.
|
|
107
|
+
"eslint-plugin-node-dependencies": "^0.9.0",
|
|
114
108
|
"eslint-plugin-prettier": "^4.0.0",
|
|
115
109
|
"eslint-plugin-regexp": "^1.0.0",
|
|
116
|
-
"eslint-plugin-svelte": "
|
|
110
|
+
"eslint-plugin-svelte": "^2.0.0",
|
|
117
111
|
"eslint-plugin-yml": "^1.0.0",
|
|
118
112
|
"estree-walker": "^3.0.0",
|
|
119
113
|
"less": "^4.1.2",
|
|
@@ -128,6 +122,7 @@
|
|
|
128
122
|
"pirates": "^4.0.1",
|
|
129
123
|
"postcss-nested": "^5.0.6",
|
|
130
124
|
"prettier": "^2.2.1",
|
|
125
|
+
"prettier-plugin-pkg": "^0.15.0",
|
|
131
126
|
"prettier-plugin-svelte": "^2.6.0",
|
|
132
127
|
"prism-svelte": "^0.5.0",
|
|
133
128
|
"prismjs": "^1.25.0",
|
|
@@ -138,8 +133,10 @@
|
|
|
138
133
|
"stylus": "^0.58.0",
|
|
139
134
|
"svelte": "^3.46.1",
|
|
140
135
|
"svelte-adapter-ghpages": "0.0.2",
|
|
141
|
-
"ts-node": "^10.0.0",
|
|
142
136
|
"typescript": "^4.5.2",
|
|
143
137
|
"vite-plugin-svelte-md": "^0.1.3"
|
|
138
|
+
},
|
|
139
|
+
"publishConfig": {
|
|
140
|
+
"access": "public"
|
|
144
141
|
}
|
|
145
142
|
}
|