eslint-plugin-svelte 2.5.0 → 2.6.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.
- package/README.md +10 -2
- package/lib/rules/html-self-closing.js +48 -16
- package/package.json +41 -8
package/README.md
CHANGED
|
@@ -13,6 +13,12 @@ You can check on the [Online DEMO](https://ota-meshi.github.io/eslint-plugin-sve
|
|
|
13
13
|
[](http://www.npmtrends.com/eslint-plugin-svelte)
|
|
14
14
|
[](https://github.com/ota-meshi/eslint-plugin-svelte/actions?query=workflow%3ACI)
|
|
15
15
|
|
|
16
|
+
[](https://lgtm.com/projects/g/ota-meshi/eslint-plugin-svelte/context:javascript)
|
|
17
|
+
[](https://github.com/plantain-00/type-coverage)
|
|
18
|
+
[](https://conventionalcommits.org)
|
|
19
|
+
[](https://github.com/prettier/prettier)
|
|
20
|
+
[](https://github.com/atlassian/changesets)
|
|
21
|
+
|
|
16
22
|
## :name_badge: What is this plugin?
|
|
17
23
|
|
|
18
24
|
[ESLint] plugin for [Svelte].
|
|
@@ -61,7 +67,7 @@ npm install --save-dev eslint eslint-plugin-svelte svelte
|
|
|
61
67
|
|
|
62
68
|
### Configuration
|
|
63
69
|
|
|
64
|
-
Use `.eslintrc.*` file to configure rules. See also:
|
|
70
|
+
Use `.eslintrc.*` file to configure rules. See also: <https://eslint.org/docs/user-guide/configuring>.
|
|
65
71
|
|
|
66
72
|
Example **.eslintrc.js**:
|
|
67
73
|
|
|
@@ -176,7 +182,7 @@ module.exports = {
|
|
|
176
182
|
}
|
|
177
183
|
```
|
|
178
184
|
|
|
179
|
-
See also
|
|
185
|
+
See also <https://github.com/ota-meshi/svelte-eslint-parser#readme>.
|
|
180
186
|
|
|
181
187
|
#### settings.svelte
|
|
182
188
|
|
|
@@ -242,6 +248,7 @@ Example **.vscode/settings.json**:
|
|
|
242
248
|
|
|
243
249
|
## :white_check_mark: Rules
|
|
244
250
|
|
|
251
|
+
<!-- prettier-ignore-start -->
|
|
245
252
|
<!--RULES_SECTION_START-->
|
|
246
253
|
|
|
247
254
|
:wrench: Indicates that the rule is fixable, and using `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the reported problems.
|
|
@@ -330,6 +337,7 @@ These rules relate to this plugin works:
|
|
|
330
337
|
|
|
331
338
|
<!--RULES_TABLE_END-->
|
|
332
339
|
<!--RULES_SECTION_END-->
|
|
340
|
+
<!-- prettier-ignore-end -->
|
|
333
341
|
|
|
334
342
|
<!--DOCS_IGNORE_START-->
|
|
335
343
|
|
|
@@ -24,33 +24,65 @@ exports.default = (0, utils_1.createRule)("html-self-closing", {
|
|
|
24
24
|
},
|
|
25
25
|
schema: [
|
|
26
26
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
anyOf: [
|
|
28
|
+
{
|
|
29
|
+
properties: {
|
|
30
|
+
void: {
|
|
31
|
+
enum: ["never", "always", "ignore"],
|
|
32
|
+
},
|
|
33
|
+
normal: {
|
|
34
|
+
enum: ["never", "always", "ignore"],
|
|
35
|
+
},
|
|
36
|
+
component: {
|
|
37
|
+
enum: ["never", "always", "ignore"],
|
|
38
|
+
},
|
|
39
|
+
svelte: {
|
|
40
|
+
enum: ["never", "always", "ignore"],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
additionalProperties: false,
|
|
31
44
|
},
|
|
32
|
-
|
|
33
|
-
enum: ["
|
|
45
|
+
{
|
|
46
|
+
enum: ["all", "html", "none"],
|
|
34
47
|
},
|
|
35
|
-
|
|
36
|
-
enum: ["never", "always", "ignore"],
|
|
37
|
-
},
|
|
38
|
-
svelte: {
|
|
39
|
-
enum: ["never", "always", "ignore"],
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
additionalProperties: false,
|
|
48
|
+
],
|
|
43
49
|
},
|
|
44
50
|
],
|
|
45
51
|
},
|
|
46
52
|
create(ctx) {
|
|
47
|
-
|
|
53
|
+
let options = {
|
|
48
54
|
void: "always",
|
|
49
55
|
normal: "always",
|
|
50
56
|
component: "always",
|
|
51
57
|
svelte: "always",
|
|
52
|
-
...ctx.options?.[0],
|
|
53
58
|
};
|
|
59
|
+
const option = ctx.options?.[0];
|
|
60
|
+
switch (option) {
|
|
61
|
+
case "none":
|
|
62
|
+
options = {
|
|
63
|
+
void: "never",
|
|
64
|
+
normal: "never",
|
|
65
|
+
component: "never",
|
|
66
|
+
svelte: "never",
|
|
67
|
+
};
|
|
68
|
+
break;
|
|
69
|
+
case "html":
|
|
70
|
+
options = {
|
|
71
|
+
void: "always",
|
|
72
|
+
normal: "never",
|
|
73
|
+
component: "never",
|
|
74
|
+
svelte: "always",
|
|
75
|
+
};
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
if (typeof option !== "object" || option === null)
|
|
79
|
+
break;
|
|
80
|
+
options = {
|
|
81
|
+
...options,
|
|
82
|
+
...option,
|
|
83
|
+
};
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
54
86
|
function getElementType(node) {
|
|
55
87
|
if (node.kind === "component")
|
|
56
88
|
return "component";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-svelte",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "ESLint plugin for Svelte using AST",
|
|
5
5
|
"repository": "git+https://github.com/ota-meshi/eslint-plugin-svelte.git",
|
|
6
6
|
"homepage": "https://ota-meshi.github.io/eslint-plugin-svelte",
|
|
@@ -34,18 +34,23 @@
|
|
|
34
34
|
"docs:build": "yarn svelte-kit build",
|
|
35
35
|
"docs:preview": "yarn svelte-kit preview",
|
|
36
36
|
"docs:watch": "yarn svelte-kit dev",
|
|
37
|
-
"eslint-fix": "eslint . --fix",
|
|
38
37
|
"format-for-gen-file": "eslint src/types-for-node.ts src/utils/rules.ts src/configs --fix",
|
|
39
|
-
"lint": "
|
|
38
|
+
"lint": "run-p lint:*",
|
|
39
|
+
"lint-fix": "yarn lint:es --fix && yarn lint:style --fix",
|
|
40
|
+
"lint:es": "eslint --cache -f friendly .",
|
|
41
|
+
"lint:style": "stylelint --cache .",
|
|
40
42
|
"mocha": "yarn ts ./node_modules/mocha/bin/mocha.js",
|
|
41
43
|
"new": "yarn ts ./tools/new-rule.ts",
|
|
42
44
|
"prebuild": "yarn clean",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
45
|
+
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
|
|
46
|
+
"prerelease": "yarn clean && yarn build",
|
|
47
|
+
"pretest": "yarn build",
|
|
48
|
+
"release": "changeset publish",
|
|
46
49
|
"svelte-kit": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/vite/bin/vite.js",
|
|
47
50
|
"test": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
|
|
51
|
+
"test:debug": "cross-env DEBUG=eslint-plugin-svelte* yarn test",
|
|
48
52
|
"ts": "node -r esbuild-register",
|
|
53
|
+
"typecov": "type-coverage",
|
|
49
54
|
"update": "yarn ts ./tools/update.ts && yarn format-for-gen-file",
|
|
50
55
|
"version": "env-cmd -e version yarn update && git add ."
|
|
51
56
|
},
|
|
@@ -69,10 +74,18 @@
|
|
|
69
74
|
"svelte-eslint-parser": "^0.18.0"
|
|
70
75
|
},
|
|
71
76
|
"devDependencies": {
|
|
77
|
+
"@1stg/browserslist-config": "^1.2.3",
|
|
78
|
+
"@1stg/commitlint-config": "^3.1.4",
|
|
79
|
+
"@1stg/lint-staged": "^3.3.0",
|
|
80
|
+
"@1stg/remark-config": "^4.0.3",
|
|
81
|
+
"@1stg/simple-git-hooks": "^0.2.1",
|
|
82
|
+
"@1stg/stylelint-config": "^4.6.1",
|
|
72
83
|
"@babel/core": "^7.16.0",
|
|
73
84
|
"@babel/eslint-parser": "^7.17.0",
|
|
74
85
|
"@babel/plugin-proposal-function-bind": "^7.16.7",
|
|
75
86
|
"@babel/types": "^7.16.0",
|
|
87
|
+
"@changesets/changelog-github": "^0.4.6",
|
|
88
|
+
"@changesets/cli": "^2.24.2",
|
|
76
89
|
"@fontsource/fira-mono": "^4.5.0",
|
|
77
90
|
"@ota-meshi/eslint-plugin": "^0.11.3",
|
|
78
91
|
"@sindresorhus/slugify": "^2.1.0",
|
|
@@ -99,17 +112,21 @@
|
|
|
99
112
|
"@typescript-eslint/parser": "^5.4.1-0",
|
|
100
113
|
"@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@4",
|
|
101
114
|
"assert": "^2.0.0",
|
|
115
|
+
"commitlint": "^17.0.3",
|
|
116
|
+
"cross-env": "^7.0.3",
|
|
102
117
|
"env-cmd": "^10.1.0",
|
|
103
118
|
"esbuild": "^0.15.0",
|
|
104
119
|
"esbuild-register": "^3.2.0",
|
|
105
120
|
"escape-html": "^1.0.3",
|
|
106
121
|
"eslint": "^8.0.0",
|
|
107
122
|
"eslint-config-prettier": "^8.3.0",
|
|
123
|
+
"eslint-formatter-friendly": "^7.0.0",
|
|
108
124
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
109
125
|
"eslint-plugin-eslint-plugin": "^5.0.0",
|
|
110
126
|
"eslint-plugin-json-schema-validator": "^4.0.0",
|
|
111
127
|
"eslint-plugin-jsonc": "^2.0.0",
|
|
112
128
|
"eslint-plugin-markdown": "^3.0.0",
|
|
129
|
+
"eslint-plugin-mdx": "^2.0.2",
|
|
113
130
|
"eslint-plugin-node": "^11.1.0",
|
|
114
131
|
"eslint-plugin-node-dependencies": "^0.9.0",
|
|
115
132
|
"eslint-plugin-prettier": "^4.0.0",
|
|
@@ -119,12 +136,14 @@
|
|
|
119
136
|
"eslint-scope": "^7.1.1",
|
|
120
137
|
"estree-walker": "^3.0.0",
|
|
121
138
|
"less": "^4.1.2",
|
|
139
|
+
"lint-staged": "^13.0.3",
|
|
122
140
|
"locate-character": "^2.0.5",
|
|
123
141
|
"magic-string": "^0.26.0",
|
|
124
142
|
"markdown-it-anchor": "^8.4.1",
|
|
125
143
|
"markdown-it-container": "^3.0.0",
|
|
126
144
|
"markdown-it-emoji": "^2.0.0",
|
|
127
145
|
"mocha": "^10.0.0",
|
|
146
|
+
"npm-run-all": "^4.1.5",
|
|
128
147
|
"nyc": "^15.1.0",
|
|
129
148
|
"pako": "^2.0.3",
|
|
130
149
|
"postcss-nested": "^5.0.6",
|
|
@@ -135,17 +154,31 @@
|
|
|
135
154
|
"prismjs": "^1.25.0",
|
|
136
155
|
"sass": "^1.51.0",
|
|
137
156
|
"semver": "^7.3.5",
|
|
157
|
+
"simple-git-hooks": "^2.8.0",
|
|
138
158
|
"stylelint": "^14.0.0",
|
|
139
159
|
"stylelint-config-standard": "^27.0.0",
|
|
140
|
-
"stylus": "^0.
|
|
160
|
+
"stylus": "^0.59.0",
|
|
141
161
|
"svelte": "^3.46.1",
|
|
142
162
|
"svelte-adapter-ghpages": "0.0.2",
|
|
163
|
+
"type-coverage": "^2.22.0",
|
|
143
164
|
"typescript": "^4.5.2",
|
|
144
165
|
"vite": "^3.0.0-0",
|
|
145
166
|
"vite-plugin-svelte-md": "^0.1.5",
|
|
146
|
-
"yaml": "^2.1.1"
|
|
167
|
+
"yaml": "^2.1.1",
|
|
168
|
+
"yarn-deduplicate": "^5.0.0"
|
|
147
169
|
},
|
|
148
170
|
"publishConfig": {
|
|
149
171
|
"access": "public"
|
|
172
|
+
},
|
|
173
|
+
"typeCoverage": {
|
|
174
|
+
"atLeast": 98.63,
|
|
175
|
+
"cache": true,
|
|
176
|
+
"detail": true,
|
|
177
|
+
"ignoreAsAssertion": true,
|
|
178
|
+
"ignoreNested": true,
|
|
179
|
+
"ignoreNonNullAssertion": true,
|
|
180
|
+
"showRelativePath": true,
|
|
181
|
+
"strict": true,
|
|
182
|
+
"update": true
|
|
150
183
|
}
|
|
151
184
|
}
|