eslint-plugin-svelte 2.4.1 → 2.7.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 +17 -40
- package/lib/configs/prettier.d.ts +2 -0
- package/lib/configs/prettier.js +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/rules/html-self-closing.d.ts +2 -0
- package/lib/rules/html-self-closing.js +152 -0
- package/lib/rules/no-reactive-functions.d.ts +2 -0
- package/lib/rules/no-reactive-functions.js +48 -0
- package/lib/rules/no-reactive-literals.js +1 -1
- package/lib/rules/no-store-async.d.ts +2 -0
- package/lib/rules/no-store-async.js +46 -0
- package/lib/rules/no-trailing-spaces.d.ts +2 -0
- package/lib/rules/no-trailing-spaces.js +91 -0
- package/lib/rules/reference-helpers/svelte-store.d.ts +6 -0
- package/lib/rules/reference-helpers/svelte-store.js +27 -0
- package/lib/rules/require-stores-init.d.ts +2 -0
- package/lib/rules/require-stores-init.js +39 -0
- package/lib/utils/ast-utils.d.ts +2 -0
- package/lib/utils/ast-utils.js +25 -1
- package/lib/utils/rules.js +10 -0
- package/lib/utils/void-elements.d.ts +2 -0
- package/lib/utils/void-elements.js +21 -0
- package/package.json +48 -14
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.
|
|
@@ -262,6 +269,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
|
|
|
262
269
|
| [svelte/no-not-function-handler](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-not-function-handler/) | disallow use of not function in event handler | :star: |
|
|
263
270
|
| [svelte/no-object-in-text-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-object-in-text-mustaches/) | disallow objects in text mustache interpolation | :star: |
|
|
264
271
|
| [svelte/no-shorthand-style-property-overrides](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-shorthand-style-property-overrides/) | disallow shorthand style properties that override related longhand properties | :star: |
|
|
272
|
+
| [svelte/no-store-async](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-store-async/) | disallow using async/await inside svelte stores because it causes issues with the auto-unsubscribing features | |
|
|
265
273
|
| [svelte/no-unknown-style-directive-property](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unknown-style-directive-property/) | disallow unknown `style:property` | :star: |
|
|
266
274
|
| [svelte/valid-compile](https://ota-meshi.github.io/eslint-plugin-svelte/rules/valid-compile/) | disallow warnings when compiling. | :star: |
|
|
267
275
|
|
|
@@ -282,10 +290,12 @@ These rules relate to better ways of doing things to help you avoid problems:
|
|
|
282
290
|
|:--------|:------------|:---|
|
|
283
291
|
| [svelte/button-has-type](https://ota-meshi.github.io/eslint-plugin-svelte/rules/button-has-type/) | disallow usage of button without an explicit type attribute | |
|
|
284
292
|
| [svelte/no-at-debug-tags](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-at-debug-tags/) | disallow the use of `{@debug}` | :star: |
|
|
285
|
-
| [svelte/no-reactive-
|
|
293
|
+
| [svelte/no-reactive-functions](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-reactive-functions/) | it's not necessary to define functions in reactive statements | :bulb: |
|
|
294
|
+
| [svelte/no-reactive-literals](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-reactive-literals/) | don't assign literal values in reactive statements | :bulb: |
|
|
286
295
|
| [svelte/no-unused-svelte-ignore](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-unused-svelte-ignore/) | disallow unused svelte-ignore comments | :star: |
|
|
287
296
|
| [svelte/no-useless-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :wrench: |
|
|
288
297
|
| [svelte/require-optimized-style-attribute](https://ota-meshi.github.io/eslint-plugin-svelte/rules/require-optimized-style-attribute/) | require style attributes that can be optimized | |
|
|
298
|
+
| [svelte/require-stores-init](https://ota-meshi.github.io/eslint-plugin-svelte/rules/require-stores-init/) | require initial value in store | |
|
|
289
299
|
|
|
290
300
|
## Stylistic Issues
|
|
291
301
|
|
|
@@ -296,6 +306,7 @@ These rules relate to style guidelines, and are therefore quite subjective:
|
|
|
296
306
|
| [svelte/first-attribute-linebreak](https://ota-meshi.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak/) | enforce the location of first attribute | :wrench: |
|
|
297
307
|
| [svelte/html-closing-bracket-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-closing-bracket-spacing/) | require or disallow a space before tag's closing brackets | :wrench: |
|
|
298
308
|
| [svelte/html-quotes](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-quotes/) | enforce quotes style of HTML attributes | :wrench: |
|
|
309
|
+
| [svelte/html-self-closing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-self-closing/) | enforce self-closing style | :wrench: |
|
|
299
310
|
| [svelte/indent](https://ota-meshi.github.io/eslint-plugin-svelte/rules/indent/) | enforce consistent indentation | :wrench: |
|
|
300
311
|
| [svelte/max-attributes-per-line](https://ota-meshi.github.io/eslint-plugin-svelte/rules/max-attributes-per-line/) | enforce the maximum number of attributes per line | :wrench: |
|
|
301
312
|
| [svelte/mustache-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/mustache-spacing/) | enforce unified spacing in mustache | :wrench: |
|
|
@@ -315,6 +326,7 @@ These rules extend the rules provided by ESLint itself to work well in Svelte:
|
|
|
315
326
|
| Rule ID | Description | |
|
|
316
327
|
|:--------|:------------|:---|
|
|
317
328
|
| [svelte/no-inner-declarations](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-inner-declarations/) | disallow variable or `function` declarations in nested blocks | :star: |
|
|
329
|
+
| [svelte/no-trailing-spaces](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-trailing-spaces/) | disallow trailing whitespace at the end of lines | :wrench: |
|
|
318
330
|
|
|
319
331
|
## System
|
|
320
332
|
|
|
@@ -327,6 +339,7 @@ These rules relate to this plugin works:
|
|
|
327
339
|
|
|
328
340
|
<!--RULES_TABLE_END-->
|
|
329
341
|
<!--RULES_SECTION_END-->
|
|
342
|
+
<!-- prettier-ignore-end -->
|
|
330
343
|
|
|
331
344
|
<!--DOCS_IGNORE_START-->
|
|
332
345
|
|
|
@@ -336,43 +349,7 @@ Welcome contributing!
|
|
|
336
349
|
|
|
337
350
|
Please use GitHub's Issues/PRs.
|
|
338
351
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
- `yarn test` runs tests.
|
|
342
|
-
- `yarn cover` runs tests and measures coverage.
|
|
343
|
-
- `yarn new [new-rule-name]` generate the files needed to implement the new rule.
|
|
344
|
-
- `yarn update` runs in order to update readme and recommended configuration.
|
|
345
|
-
- `yarn docs:watch` launch the document site in development mode.
|
|
346
|
-
|
|
347
|
-
### Test the Rule
|
|
348
|
-
|
|
349
|
-
Rule testing almost always uses fixtures.
|
|
350
|
-
For example, for an `indent` rule, the `.ts` file that runs the test is `tests/src/rules/indent.ts` and the fixture is in `tests/fixtures/rules/indent`.
|
|
351
|
-
The fixture directory has an `invalid` directory and a `valid` directory.
|
|
352
|
-
|
|
353
|
-
- The `invalid` directory contains test cases where the rule reports problems.
|
|
354
|
-
- The `valid` directory contains test cases where the rule does not report a problem.
|
|
355
|
-
|
|
356
|
-
The fixture input file should be named `*-input.svelte`. It is automatically collected and tested.
|
|
357
|
-
If your test requires configuration, you need to add a json file with the configuration.
|
|
358
|
-
|
|
359
|
-
- If you want to apply a configuration to `my-test-input.svelte`, add `my-test-config.json`.
|
|
360
|
-
- If you want to apply the same configuration to all the fixtures in that directory, add `_config.json`.
|
|
361
|
-
|
|
362
|
-
To verify the output of invalid test cases requires `*-errors.json`, and `*-output.svelte` (for auto-fix). However, you don't have to add them yourself. If they do not exist, they will be automatically generated when you run the test. In other words, delete them manually when you want to recreate them.
|
|
363
|
-
|
|
364
|
-
**Tips**:
|
|
365
|
-
|
|
366
|
-
If you want to test only one rule, run the following command (for `indent` rule):
|
|
367
|
-
|
|
368
|
-
```sh
|
|
369
|
-
yarn test -g indent
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
Take <https://stackoverflow.com/questions/10832031/how-to-run-a-single-test-with-mocha> as reference for details.
|
|
373
|
-
|
|
374
|
-
If you want to test only `my-test-input.svelte`, add `my-test-config.json` and save `{"only": true}`.
|
|
375
|
-
(Note that `{"only": true}` must be removed before making a pull request.)
|
|
352
|
+
See also [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
376
353
|
|
|
377
354
|
### Working With Rules
|
|
378
355
|
|
|
@@ -4,10 +4,12 @@ declare const _default: {
|
|
|
4
4
|
"svelte/first-attribute-linebreak": string;
|
|
5
5
|
"svelte/html-closing-bracket-spacing": string;
|
|
6
6
|
"svelte/html-quotes": string;
|
|
7
|
+
"svelte/html-self-closing": string;
|
|
7
8
|
"svelte/indent": string;
|
|
8
9
|
"svelte/max-attributes-per-line": string;
|
|
9
10
|
"svelte/mustache-spacing": string;
|
|
10
11
|
"svelte/no-spaces-around-equal-signs-in-attribute": string;
|
|
12
|
+
"svelte/no-trailing-spaces": string;
|
|
11
13
|
"svelte/shorthand-attribute": string;
|
|
12
14
|
"svelte/shorthand-directive": string;
|
|
13
15
|
};
|
package/lib/configs/prettier.js
CHANGED
|
@@ -11,10 +11,12 @@ module.exports = {
|
|
|
11
11
|
"svelte/first-attribute-linebreak": "off",
|
|
12
12
|
"svelte/html-closing-bracket-spacing": "off",
|
|
13
13
|
"svelte/html-quotes": "off",
|
|
14
|
+
"svelte/html-self-closing": "off",
|
|
14
15
|
"svelte/indent": "off",
|
|
15
16
|
"svelte/max-attributes-per-line": "off",
|
|
16
17
|
"svelte/mustache-spacing": "off",
|
|
17
18
|
"svelte/no-spaces-around-equal-signs-in-attribute": "off",
|
|
19
|
+
"svelte/no-trailing-spaces": "off",
|
|
18
20
|
"svelte/shorthand-attribute": "off",
|
|
19
21
|
"svelte/shorthand-directive": "off",
|
|
20
22
|
},
|
package/lib/index.d.ts
CHANGED
|
@@ -39,10 +39,12 @@ declare const _default: {
|
|
|
39
39
|
"svelte/first-attribute-linebreak": string;
|
|
40
40
|
"svelte/html-closing-bracket-spacing": string;
|
|
41
41
|
"svelte/html-quotes": string;
|
|
42
|
+
"svelte/html-self-closing": string;
|
|
42
43
|
"svelte/indent": string;
|
|
43
44
|
"svelte/max-attributes-per-line": string;
|
|
44
45
|
"svelte/mustache-spacing": string;
|
|
45
46
|
"svelte/no-spaces-around-equal-signs-in-attribute": string;
|
|
47
|
+
"svelte/no-trailing-spaces": string;
|
|
46
48
|
"svelte/shorthand-attribute": string;
|
|
47
49
|
"svelte/shorthand-directive": string;
|
|
48
50
|
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const ast_utils_1 = require("../utils/ast-utils");
|
|
5
|
+
const TYPE_MESSAGES = {
|
|
6
|
+
normal: "HTML elements",
|
|
7
|
+
void: "HTML void elements",
|
|
8
|
+
component: "Svelte custom components",
|
|
9
|
+
svelte: "Svelte special elements",
|
|
10
|
+
};
|
|
11
|
+
exports.default = (0, utils_1.createRule)("html-self-closing", {
|
|
12
|
+
meta: {
|
|
13
|
+
docs: {
|
|
14
|
+
description: "enforce self-closing style",
|
|
15
|
+
category: "Stylistic Issues",
|
|
16
|
+
recommended: false,
|
|
17
|
+
conflictWithPrettier: true,
|
|
18
|
+
},
|
|
19
|
+
type: "layout",
|
|
20
|
+
fixable: "code",
|
|
21
|
+
messages: {
|
|
22
|
+
requireClosing: "Require self-closing on {{type}}.",
|
|
23
|
+
disallowClosing: "Disallow self-closing on {{type}}.",
|
|
24
|
+
},
|
|
25
|
+
schema: [
|
|
26
|
+
{
|
|
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,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
enum: ["all", "html", "none"],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
create(ctx) {
|
|
53
|
+
let options = {
|
|
54
|
+
void: "always",
|
|
55
|
+
normal: "always",
|
|
56
|
+
component: "always",
|
|
57
|
+
svelte: "always",
|
|
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
|
+
}
|
|
86
|
+
function getElementType(node) {
|
|
87
|
+
if (node.kind === "component")
|
|
88
|
+
return "component";
|
|
89
|
+
if (node.kind === "special")
|
|
90
|
+
return "svelte";
|
|
91
|
+
if ((0, ast_utils_1.isVoidHtmlElement)(node))
|
|
92
|
+
return "void";
|
|
93
|
+
return "normal";
|
|
94
|
+
}
|
|
95
|
+
function isElementEmpty(node) {
|
|
96
|
+
if (node.children.length <= 0)
|
|
97
|
+
return true;
|
|
98
|
+
for (const child of node.children) {
|
|
99
|
+
if (child.type !== "SvelteText")
|
|
100
|
+
return false;
|
|
101
|
+
if (!/^\s*$/.test(child.value))
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
function report(node, close) {
|
|
107
|
+
const elementType = getElementType(node);
|
|
108
|
+
ctx.report({
|
|
109
|
+
node,
|
|
110
|
+
messageId: close ? "requireClosing" : "disallowClosing",
|
|
111
|
+
data: {
|
|
112
|
+
type: TYPE_MESSAGES[elementType],
|
|
113
|
+
},
|
|
114
|
+
*fix(fixer) {
|
|
115
|
+
if (close) {
|
|
116
|
+
for (const child of node.children) {
|
|
117
|
+
yield fixer.removeRange(child.range);
|
|
118
|
+
}
|
|
119
|
+
yield fixer.insertTextBeforeRange([node.startTag.range[1] - 1, node.startTag.range[1]], "/");
|
|
120
|
+
if (node.endTag)
|
|
121
|
+
yield fixer.removeRange(node.endTag.range);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
yield fixer.removeRange([
|
|
125
|
+
node.startTag.range[1] - 2,
|
|
126
|
+
node.startTag.range[1] - 1,
|
|
127
|
+
]);
|
|
128
|
+
if (!(0, ast_utils_1.isVoidHtmlElement)(node))
|
|
129
|
+
yield fixer.insertTextAfter(node, `</${(0, ast_utils_1.getNodeName)(node)}>`);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
SvelteElement(node) {
|
|
136
|
+
if (!isElementEmpty(node))
|
|
137
|
+
return;
|
|
138
|
+
const elementType = getElementType(node);
|
|
139
|
+
const elementTypeOptions = options[elementType];
|
|
140
|
+
if (elementTypeOptions === "ignore")
|
|
141
|
+
return;
|
|
142
|
+
const shouldBeClosed = elementTypeOptions === "always";
|
|
143
|
+
if (shouldBeClosed && !node.startTag.selfClosing) {
|
|
144
|
+
report(node, true);
|
|
145
|
+
}
|
|
146
|
+
else if (!shouldBeClosed && node.startTag.selfClosing) {
|
|
147
|
+
report(node, false);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
exports.default = (0, utils_1.createRule)("no-reactive-functions", {
|
|
5
|
+
meta: {
|
|
6
|
+
docs: {
|
|
7
|
+
description: "it's not necessary to define functions in reactive statements",
|
|
8
|
+
category: "Best Practices",
|
|
9
|
+
recommended: false,
|
|
10
|
+
},
|
|
11
|
+
hasSuggestions: true,
|
|
12
|
+
schema: [],
|
|
13
|
+
messages: {
|
|
14
|
+
noReactiveFns: `Do not create functions inside reactive statements unless absolutely necessary.`,
|
|
15
|
+
fixReactiveFns: `Move the function out of the reactive statement`,
|
|
16
|
+
},
|
|
17
|
+
type: "suggestion",
|
|
18
|
+
},
|
|
19
|
+
create(context) {
|
|
20
|
+
return {
|
|
21
|
+
[`SvelteReactiveStatement > ExpressionStatement > AssignmentExpression > :function`](node) {
|
|
22
|
+
const parent = node.parent?.parent?.parent;
|
|
23
|
+
if (!parent) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const source = context.getSourceCode();
|
|
27
|
+
return context.report({
|
|
28
|
+
node: parent,
|
|
29
|
+
loc: parent.loc,
|
|
30
|
+
messageId: "noReactiveFns",
|
|
31
|
+
suggest: [
|
|
32
|
+
{
|
|
33
|
+
messageId: "fixReactiveFns",
|
|
34
|
+
fix(fixer) {
|
|
35
|
+
const tokens = source.getFirstTokens(parent, {
|
|
36
|
+
includeComments: false,
|
|
37
|
+
count: 3,
|
|
38
|
+
});
|
|
39
|
+
const noExtraSpace = source.isSpaceBetweenTokens(tokens[1], tokens[2]);
|
|
40
|
+
return fixer.replaceTextRange([tokens[0].range[0], tokens[1].range[1]], noExtraSpace ? "const" : "const ");
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -4,7 +4,7 @@ const utils_1 = require("../utils");
|
|
|
4
4
|
exports.default = (0, utils_1.createRule)("no-reactive-literals", {
|
|
5
5
|
meta: {
|
|
6
6
|
docs: {
|
|
7
|
-
description: "
|
|
7
|
+
description: "don't assign literal values in reactive statements",
|
|
8
8
|
category: "Best Practices",
|
|
9
9
|
recommended: false,
|
|
10
10
|
},
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const svelte_store_1 = require("./reference-helpers/svelte-store");
|
|
5
|
+
exports.default = (0, utils_1.createRule)("no-store-async", {
|
|
6
|
+
meta: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: "disallow using async/await inside svelte stores because it causes issues with the auto-unsubscribing features",
|
|
9
|
+
category: "Possible Errors",
|
|
10
|
+
recommended: false,
|
|
11
|
+
default: "error",
|
|
12
|
+
},
|
|
13
|
+
schema: [],
|
|
14
|
+
messages: {
|
|
15
|
+
unexpected: "Do not pass async functions to svelte stores.",
|
|
16
|
+
},
|
|
17
|
+
type: "problem",
|
|
18
|
+
},
|
|
19
|
+
create(context) {
|
|
20
|
+
return {
|
|
21
|
+
Program() {
|
|
22
|
+
for (const { node } of (0, svelte_store_1.extractStoreReferences)(context)) {
|
|
23
|
+
const [, fn] = node.arguments;
|
|
24
|
+
if (!fn ||
|
|
25
|
+
(fn.type !== "ArrowFunctionExpression" &&
|
|
26
|
+
fn.type !== "FunctionExpression") ||
|
|
27
|
+
!fn.async) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const start = fn.loc?.start ?? { line: 1, column: 0 };
|
|
31
|
+
context.report({
|
|
32
|
+
node: fn,
|
|
33
|
+
loc: {
|
|
34
|
+
start,
|
|
35
|
+
end: {
|
|
36
|
+
line: start.line,
|
|
37
|
+
column: start.column + 5,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
messageId: "unexpected",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
exports.default = (0, utils_1.createRule)("no-trailing-spaces", {
|
|
5
|
+
meta: {
|
|
6
|
+
type: "layout",
|
|
7
|
+
docs: {
|
|
8
|
+
description: "disallow trailing whitespace at the end of lines",
|
|
9
|
+
category: "Extension Rules",
|
|
10
|
+
recommended: false,
|
|
11
|
+
extensionRule: "no-trailing-spaces",
|
|
12
|
+
conflictWithPrettier: true,
|
|
13
|
+
},
|
|
14
|
+
fixable: "whitespace",
|
|
15
|
+
schema: [
|
|
16
|
+
{
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {
|
|
19
|
+
skipBlankLines: { type: "boolean" },
|
|
20
|
+
ignoreComments: { type: "boolean" },
|
|
21
|
+
},
|
|
22
|
+
additionalProperties: false,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
messages: {
|
|
26
|
+
trailingSpace: "Trailing spaces not allowed.",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
create(context) {
|
|
30
|
+
const options = context.options[0];
|
|
31
|
+
const skipBlankLines = options?.skipBlankLines || false;
|
|
32
|
+
const ignoreComments = options?.ignoreComments || false;
|
|
33
|
+
const sourceCode = context.getSourceCode();
|
|
34
|
+
const ignoreLineNumbers = new Set();
|
|
35
|
+
if (ignoreComments) {
|
|
36
|
+
for (const { type, loc } of sourceCode.getAllComments()) {
|
|
37
|
+
const endLine = type === "Block" ? loc.end.line - 1 : loc.end.line;
|
|
38
|
+
for (let i = loc.start.line; i <= endLine; i++) {
|
|
39
|
+
ignoreLineNumbers.add(i);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function report(loc) {
|
|
44
|
+
context.report({
|
|
45
|
+
loc,
|
|
46
|
+
messageId: "trailingSpace",
|
|
47
|
+
fix(fixer) {
|
|
48
|
+
return fixer.removeRange([
|
|
49
|
+
sourceCode.getIndexFromLoc(loc.start),
|
|
50
|
+
sourceCode.getIndexFromLoc(loc.end),
|
|
51
|
+
]);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function collectIgnoreLineNumbers({ loc }) {
|
|
56
|
+
const endLine = loc.end.line - 1;
|
|
57
|
+
for (let i = loc.start.line; i <= endLine; i++) {
|
|
58
|
+
ignoreLineNumbers.add(i);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
TemplateElement: collectIgnoreLineNumbers,
|
|
63
|
+
...(ignoreComments
|
|
64
|
+
? {
|
|
65
|
+
SvelteHTMLComment: collectIgnoreLineNumbers,
|
|
66
|
+
}
|
|
67
|
+
: {}),
|
|
68
|
+
"Program:exit"() {
|
|
69
|
+
const lines = sourceCode.lines;
|
|
70
|
+
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
71
|
+
const line = lines[lineIndex];
|
|
72
|
+
if (skipBlankLines && !line.trim()) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const lineNumber = lineIndex + 1;
|
|
76
|
+
if (ignoreLineNumbers.has(lineNumber)) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const trimmed = line.trimEnd();
|
|
80
|
+
if (trimmed === line) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
report({
|
|
84
|
+
start: { line: lineNumber, column: trimmed.length },
|
|
85
|
+
end: { line: lineNumber, column: line.length },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractStoreReferences = void 0;
|
|
4
|
+
const eslint_utils_1 = require("eslint-utils");
|
|
5
|
+
function* extractStoreReferences(context) {
|
|
6
|
+
const referenceTracker = new eslint_utils_1.ReferenceTracker(context.getScope());
|
|
7
|
+
for (const { node, path } of referenceTracker.iterateEsmReferences({
|
|
8
|
+
"svelte/store": {
|
|
9
|
+
[eslint_utils_1.ReferenceTracker.ESM]: true,
|
|
10
|
+
writable: {
|
|
11
|
+
[eslint_utils_1.ReferenceTracker.CALL]: true,
|
|
12
|
+
},
|
|
13
|
+
readable: {
|
|
14
|
+
[eslint_utils_1.ReferenceTracker.CALL]: true,
|
|
15
|
+
},
|
|
16
|
+
derived: {
|
|
17
|
+
[eslint_utils_1.ReferenceTracker.CALL]: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
})) {
|
|
21
|
+
yield {
|
|
22
|
+
node: node,
|
|
23
|
+
name: path[path.length - 1],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.extractStoreReferences = extractStoreReferences;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const svelte_store_1 = require("./reference-helpers/svelte-store");
|
|
5
|
+
exports.default = (0, utils_1.createRule)("require-stores-init", {
|
|
6
|
+
meta: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: "require initial value in store",
|
|
9
|
+
category: "Best Practices",
|
|
10
|
+
recommended: false,
|
|
11
|
+
},
|
|
12
|
+
schema: [],
|
|
13
|
+
messages: {
|
|
14
|
+
storeDefaultValue: `Always set a default value for svelte stores.`,
|
|
15
|
+
},
|
|
16
|
+
type: "suggestion",
|
|
17
|
+
},
|
|
18
|
+
create(context) {
|
|
19
|
+
return {
|
|
20
|
+
Program() {
|
|
21
|
+
for (const { node, name } of (0, svelte_store_1.extractStoreReferences)(context)) {
|
|
22
|
+
const minArgs = name === "writable" || name === "readable"
|
|
23
|
+
? 1
|
|
24
|
+
: name === "derived"
|
|
25
|
+
? 3
|
|
26
|
+
: 0;
|
|
27
|
+
if (node.arguments.length >= minArgs ||
|
|
28
|
+
node.arguments.some((arg) => arg.type === "SpreadElement")) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
context.report({
|
|
32
|
+
node,
|
|
33
|
+
messageId: "storeDefaultValue",
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
package/lib/utils/ast-utils.d.ts
CHANGED
|
@@ -48,3 +48,5 @@ export declare function getMustacheTokens(node: SvAST.SvelteDirective | SvAST.Sv
|
|
|
48
48
|
} | null;
|
|
49
49
|
export declare function getAttributeKeyText(node: SvAST.SvelteAttribute | SvAST.SvelteShorthandAttribute | SvAST.SvelteStyleDirective | SvAST.SvelteDirective | SvAST.SvelteSpecialDirective): string;
|
|
50
50
|
export declare function getDirectiveName(node: SvAST.SvelteDirective): string;
|
|
51
|
+
export declare function getNodeName(node: SvAST.SvelteElement): string;
|
|
52
|
+
export declare function isVoidHtmlElement(node: SvAST.SvelteElement): boolean;
|
package/lib/utils/ast-utils.js
CHANGED
|
@@ -22,9 +22,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getDirectiveName = exports.getAttributeKeyText = exports.getMustacheTokens = exports.getAttributeValueQuoteAndRange = exports.getScope = exports.findVariable = exports.getLangValue = exports.getStaticAttributeValue = exports.findBindDirective = exports.findShorthandAttribute = exports.findAttribute = exports.isHTMLElementLike = exports.needParentheses = exports.getStringIfConstant = exports.equalTokens = void 0;
|
|
29
|
+
exports.isVoidHtmlElement = exports.getNodeName = exports.getDirectiveName = exports.getAttributeKeyText = exports.getMustacheTokens = exports.getAttributeValueQuoteAndRange = exports.getScope = exports.findVariable = exports.getLangValue = exports.getStaticAttributeValue = exports.findBindDirective = exports.findShorthandAttribute = exports.findAttribute = exports.isHTMLElementLike = exports.needParentheses = exports.getStringIfConstant = exports.equalTokens = void 0;
|
|
27
30
|
const eslintUtils = __importStar(require("eslint-utils"));
|
|
31
|
+
const void_elements_1 = __importDefault(require("./void-elements"));
|
|
28
32
|
function equalTokens(left, right, sourceCode) {
|
|
29
33
|
const tokensL = sourceCode.getTokens(left);
|
|
30
34
|
const tokensR = sourceCode.getTokens(right);
|
|
@@ -322,3 +326,23 @@ function getAttributeValueRangeTokens(attr, sourceCode) {
|
|
|
322
326
|
lastToken: tokens.closeToken,
|
|
323
327
|
};
|
|
324
328
|
}
|
|
329
|
+
function getNodeName(node) {
|
|
330
|
+
if ("name" in node.name) {
|
|
331
|
+
return node.name.name;
|
|
332
|
+
}
|
|
333
|
+
let object = "";
|
|
334
|
+
let currentObject = node.name.object;
|
|
335
|
+
while ("object" in currentObject) {
|
|
336
|
+
object = `${currentObject.property.name}.${object}`;
|
|
337
|
+
currentObject = currentObject.object;
|
|
338
|
+
}
|
|
339
|
+
if ("name" in currentObject) {
|
|
340
|
+
object = `${currentObject.name}.${object}`;
|
|
341
|
+
}
|
|
342
|
+
return object + node.name.property.name;
|
|
343
|
+
}
|
|
344
|
+
exports.getNodeName = getNodeName;
|
|
345
|
+
function isVoidHtmlElement(node) {
|
|
346
|
+
return void_elements_1.default.includes(getNodeName(node));
|
|
347
|
+
}
|
|
348
|
+
exports.isVoidHtmlElement = isVoidHtmlElement;
|
package/lib/utils/rules.js
CHANGED
|
@@ -9,6 +9,7 @@ const comment_directive_1 = __importDefault(require("../rules/comment-directive"
|
|
|
9
9
|
const first_attribute_linebreak_1 = __importDefault(require("../rules/first-attribute-linebreak"));
|
|
10
10
|
const html_closing_bracket_spacing_1 = __importDefault(require("../rules/html-closing-bracket-spacing"));
|
|
11
11
|
const html_quotes_1 = __importDefault(require("../rules/html-quotes"));
|
|
12
|
+
const html_self_closing_1 = __importDefault(require("../rules/html-self-closing"));
|
|
12
13
|
const indent_1 = __importDefault(require("../rules/indent"));
|
|
13
14
|
const max_attributes_per_line_1 = __importDefault(require("../rules/max-attributes-per-line"));
|
|
14
15
|
const mustache_spacing_1 = __importDefault(require("../rules/mustache-spacing"));
|
|
@@ -21,16 +22,20 @@ const no_extra_reactive_curlies_1 = __importDefault(require("../rules/no-extra-r
|
|
|
21
22
|
const no_inner_declarations_1 = __importDefault(require("../rules/no-inner-declarations"));
|
|
22
23
|
const no_not_function_handler_1 = __importDefault(require("../rules/no-not-function-handler"));
|
|
23
24
|
const no_object_in_text_mustaches_1 = __importDefault(require("../rules/no-object-in-text-mustaches"));
|
|
25
|
+
const no_reactive_functions_1 = __importDefault(require("../rules/no-reactive-functions"));
|
|
24
26
|
const no_reactive_literals_1 = __importDefault(require("../rules/no-reactive-literals"));
|
|
25
27
|
const no_shorthand_style_property_overrides_1 = __importDefault(require("../rules/no-shorthand-style-property-overrides"));
|
|
26
28
|
const no_spaces_around_equal_signs_in_attribute_1 = __importDefault(require("../rules/no-spaces-around-equal-signs-in-attribute"));
|
|
29
|
+
const no_store_async_1 = __importDefault(require("../rules/no-store-async"));
|
|
27
30
|
const no_target_blank_1 = __importDefault(require("../rules/no-target-blank"));
|
|
31
|
+
const no_trailing_spaces_1 = __importDefault(require("../rules/no-trailing-spaces"));
|
|
28
32
|
const no_unknown_style_directive_property_1 = __importDefault(require("../rules/no-unknown-style-directive-property"));
|
|
29
33
|
const no_unused_svelte_ignore_1 = __importDefault(require("../rules/no-unused-svelte-ignore"));
|
|
30
34
|
const no_useless_mustaches_1 = __importDefault(require("../rules/no-useless-mustaches"));
|
|
31
35
|
const prefer_class_directive_1 = __importDefault(require("../rules/prefer-class-directive"));
|
|
32
36
|
const prefer_style_directive_1 = __importDefault(require("../rules/prefer-style-directive"));
|
|
33
37
|
const require_optimized_style_attribute_1 = __importDefault(require("../rules/require-optimized-style-attribute"));
|
|
38
|
+
const require_stores_init_1 = __importDefault(require("../rules/require-stores-init"));
|
|
34
39
|
const shorthand_attribute_1 = __importDefault(require("../rules/shorthand-attribute"));
|
|
35
40
|
const shorthand_directive_1 = __importDefault(require("../rules/shorthand-directive"));
|
|
36
41
|
const sort_attributes_1 = __importDefault(require("../rules/sort-attributes"));
|
|
@@ -43,6 +48,7 @@ exports.rules = [
|
|
|
43
48
|
first_attribute_linebreak_1.default,
|
|
44
49
|
html_closing_bracket_spacing_1.default,
|
|
45
50
|
html_quotes_1.default,
|
|
51
|
+
html_self_closing_1.default,
|
|
46
52
|
indent_1.default,
|
|
47
53
|
max_attributes_per_line_1.default,
|
|
48
54
|
mustache_spacing_1.default,
|
|
@@ -55,16 +61,20 @@ exports.rules = [
|
|
|
55
61
|
no_inner_declarations_1.default,
|
|
56
62
|
no_not_function_handler_1.default,
|
|
57
63
|
no_object_in_text_mustaches_1.default,
|
|
64
|
+
no_reactive_functions_1.default,
|
|
58
65
|
no_reactive_literals_1.default,
|
|
59
66
|
no_shorthand_style_property_overrides_1.default,
|
|
60
67
|
no_spaces_around_equal_signs_in_attribute_1.default,
|
|
68
|
+
no_store_async_1.default,
|
|
61
69
|
no_target_blank_1.default,
|
|
70
|
+
no_trailing_spaces_1.default,
|
|
62
71
|
no_unknown_style_directive_property_1.default,
|
|
63
72
|
no_unused_svelte_ignore_1.default,
|
|
64
73
|
no_useless_mustaches_1.default,
|
|
65
74
|
prefer_class_directive_1.default,
|
|
66
75
|
prefer_style_directive_1.default,
|
|
67
76
|
require_optimized_style_attribute_1.default,
|
|
77
|
+
require_stores_init_1.default,
|
|
68
78
|
shorthand_attribute_1.default,
|
|
69
79
|
shorthand_directive_1.default,
|
|
70
80
|
sort_attributes_1.default,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const voidElements = [
|
|
4
|
+
"area",
|
|
5
|
+
"base",
|
|
6
|
+
"br",
|
|
7
|
+
"col",
|
|
8
|
+
"embed",
|
|
9
|
+
"hr",
|
|
10
|
+
"img",
|
|
11
|
+
"input",
|
|
12
|
+
"keygen",
|
|
13
|
+
"link",
|
|
14
|
+
"menuitem",
|
|
15
|
+
"meta",
|
|
16
|
+
"param",
|
|
17
|
+
"source",
|
|
18
|
+
"track",
|
|
19
|
+
"wbr",
|
|
20
|
+
];
|
|
21
|
+
exports.default = voidElements;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-svelte",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.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,20 +34,25 @@
|
|
|
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
|
+
"release": "changeset publish",
|
|
46
48
|
"svelte-kit": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/vite/bin/vite.js",
|
|
47
49
|
"test": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
|
|
50
|
+
"test:debug": "env-cmd -e debug yarn test",
|
|
48
51
|
"ts": "node -r esbuild-register",
|
|
52
|
+
"typecov": "type-coverage",
|
|
49
53
|
"update": "yarn ts ./tools/update.ts && yarn format-for-gen-file",
|
|
50
|
-
"version": "env-cmd -e version yarn update
|
|
54
|
+
"version": "env-cmd -e version yarn update",
|
|
55
|
+
"version:ci": "env-cmd -e version-ci yarn update && changeset version"
|
|
51
56
|
},
|
|
52
57
|
"peerDependencies": {
|
|
53
58
|
"eslint": "^7.0.0 || ^8.0.0-0",
|
|
@@ -66,23 +71,32 @@
|
|
|
66
71
|
"postcss-load-config": "^3.1.4",
|
|
67
72
|
"postcss-safe-parser": "^6.0.0",
|
|
68
73
|
"sourcemap-codec": "^1.4.8",
|
|
69
|
-
"svelte-eslint-parser": "^0.
|
|
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",
|
|
79
92
|
"@sveltejs/adapter-static": "^1.0.0-next.26",
|
|
80
|
-
"@sveltejs/kit": "^1.0.0-next.
|
|
93
|
+
"@sveltejs/kit": "^1.0.0-next.406",
|
|
81
94
|
"@types/babel__core": "^7.1.19",
|
|
82
95
|
"@types/cross-spawn": "^6.0.2",
|
|
83
96
|
"@types/escape-html": "^1.0.2",
|
|
84
97
|
"@types/eslint": "^8.0.0",
|
|
85
98
|
"@types/eslint-scope": "^3.7.0",
|
|
99
|
+
"@types/eslint-utils": "^3.0.1",
|
|
86
100
|
"@types/eslint-visitor-keys": "^1.0.0",
|
|
87
101
|
"@types/estree": "^1.0.0",
|
|
88
102
|
"@types/less": "^3.0.3",
|
|
@@ -98,17 +112,20 @@
|
|
|
98
112
|
"@typescript-eslint/parser": "^5.4.1-0",
|
|
99
113
|
"@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@4",
|
|
100
114
|
"assert": "^2.0.0",
|
|
115
|
+
"commitlint": "^17.0.3",
|
|
101
116
|
"env-cmd": "^10.1.0",
|
|
102
|
-
"esbuild": "^0.
|
|
117
|
+
"esbuild": "^0.15.0",
|
|
103
118
|
"esbuild-register": "^3.2.0",
|
|
104
119
|
"escape-html": "^1.0.3",
|
|
105
120
|
"eslint": "^8.0.0",
|
|
106
121
|
"eslint-config-prettier": "^8.3.0",
|
|
122
|
+
"eslint-formatter-friendly": "^7.0.0",
|
|
107
123
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
108
124
|
"eslint-plugin-eslint-plugin": "^5.0.0",
|
|
109
125
|
"eslint-plugin-json-schema-validator": "^4.0.0",
|
|
110
126
|
"eslint-plugin-jsonc": "^2.0.0",
|
|
111
127
|
"eslint-plugin-markdown": "^3.0.0",
|
|
128
|
+
"eslint-plugin-mdx": "^2.0.2",
|
|
112
129
|
"eslint-plugin-node": "^11.1.0",
|
|
113
130
|
"eslint-plugin-node-dependencies": "^0.9.0",
|
|
114
131
|
"eslint-plugin-prettier": "^4.0.0",
|
|
@@ -118,32 +135,49 @@
|
|
|
118
135
|
"eslint-scope": "^7.1.1",
|
|
119
136
|
"estree-walker": "^3.0.0",
|
|
120
137
|
"less": "^4.1.2",
|
|
138
|
+
"lint-staged": "^13.0.3",
|
|
121
139
|
"locate-character": "^2.0.5",
|
|
122
140
|
"magic-string": "^0.26.0",
|
|
123
141
|
"markdown-it-anchor": "^8.4.1",
|
|
124
142
|
"markdown-it-container": "^3.0.0",
|
|
125
143
|
"markdown-it-emoji": "^2.0.0",
|
|
126
144
|
"mocha": "^10.0.0",
|
|
145
|
+
"npm-run-all": "^4.1.5",
|
|
127
146
|
"nyc": "^15.1.0",
|
|
128
147
|
"pako": "^2.0.3",
|
|
129
148
|
"postcss-nested": "^5.0.6",
|
|
130
149
|
"prettier": "^2.2.1",
|
|
131
|
-
"prettier-plugin-pkg": "^0.
|
|
150
|
+
"prettier-plugin-pkg": "^0.17.0",
|
|
132
151
|
"prettier-plugin-svelte": "^2.6.0",
|
|
133
152
|
"prism-svelte": "^0.5.0",
|
|
134
153
|
"prismjs": "^1.25.0",
|
|
135
154
|
"sass": "^1.51.0",
|
|
136
155
|
"semver": "^7.3.5",
|
|
156
|
+
"simple-git-hooks": "^2.8.0",
|
|
137
157
|
"stylelint": "^14.0.0",
|
|
138
|
-
"stylelint-config-standard": "^
|
|
139
|
-
"stylus": "^0.
|
|
158
|
+
"stylelint-config-standard": "^28.0.0",
|
|
159
|
+
"stylus": "^0.59.0",
|
|
140
160
|
"svelte": "^3.46.1",
|
|
141
161
|
"svelte-adapter-ghpages": "0.0.2",
|
|
162
|
+
"type-coverage": "^2.22.0",
|
|
142
163
|
"typescript": "^4.5.2",
|
|
143
164
|
"vite": "^3.0.0-0",
|
|
144
|
-
"vite-plugin-svelte-md": "^0.1.5"
|
|
165
|
+
"vite-plugin-svelte-md": "^0.1.5",
|
|
166
|
+
"yaml": "^2.1.1",
|
|
167
|
+
"yarn-deduplicate": "^5.0.0"
|
|
145
168
|
},
|
|
146
169
|
"publishConfig": {
|
|
147
170
|
"access": "public"
|
|
171
|
+
},
|
|
172
|
+
"typeCoverage": {
|
|
173
|
+
"atLeast": 98.64,
|
|
174
|
+
"cache": true,
|
|
175
|
+
"detail": true,
|
|
176
|
+
"ignoreAsAssertion": true,
|
|
177
|
+
"ignoreNested": true,
|
|
178
|
+
"ignoreNonNullAssertion": true,
|
|
179
|
+
"showRelativePath": true,
|
|
180
|
+
"strict": true,
|
|
181
|
+
"update": true
|
|
148
182
|
}
|
|
149
183
|
}
|