eslint-plugin-svelte 2.4.1 → 2.5.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 +4 -1
- package/lib/configs/prettier.d.ts +1 -0
- package/lib/configs/prettier.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/rules/html-self-closing.d.ts +2 -0
- package/lib/rules/html-self-closing.js +120 -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/require-stores-init.d.ts +2 -0
- package/lib/rules/require-stores-init.js +61 -0
- package/lib/utils/ast-utils.d.ts +2 -0
- package/lib/utils/ast-utils.js +25 -1
- package/lib/utils/rules.js +6 -0
- package/lib/utils/void-elements.d.ts +2 -0
- package/lib/utils/void-elements.js +21 -0
- package/package.json +7 -5
package/README.md
CHANGED
|
@@ -282,10 +282,12 @@ These rules relate to better ways of doing things to help you avoid problems:
|
|
|
282
282
|
|:--------|:------------|:---|
|
|
283
283
|
| [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
284
|
| [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-
|
|
285
|
+
| [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: |
|
|
286
|
+
| [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
287
|
| [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
288
|
| [svelte/no-useless-mustaches](https://ota-meshi.github.io/eslint-plugin-svelte/rules/no-useless-mustaches/) | disallow unnecessary mustache interpolations | :wrench: |
|
|
288
289
|
| [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 | |
|
|
290
|
+
| [svelte/require-stores-init](https://ota-meshi.github.io/eslint-plugin-svelte/rules/require-stores-init/) | require initial value in store | |
|
|
289
291
|
|
|
290
292
|
## Stylistic Issues
|
|
291
293
|
|
|
@@ -296,6 +298,7 @@ These rules relate to style guidelines, and are therefore quite subjective:
|
|
|
296
298
|
| [svelte/first-attribute-linebreak](https://ota-meshi.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak/) | enforce the location of first attribute | :wrench: |
|
|
297
299
|
| [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
300
|
| [svelte/html-quotes](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-quotes/) | enforce quotes style of HTML attributes | :wrench: |
|
|
301
|
+
| [svelte/html-self-closing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/html-self-closing/) | enforce self-closing style | :wrench: |
|
|
299
302
|
| [svelte/indent](https://ota-meshi.github.io/eslint-plugin-svelte/rules/indent/) | enforce consistent indentation | :wrench: |
|
|
300
303
|
| [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
304
|
| [svelte/mustache-spacing](https://ota-meshi.github.io/eslint-plugin-svelte/rules/mustache-spacing/) | enforce unified spacing in mustache | :wrench: |
|
|
@@ -4,6 +4,7 @@ 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;
|
package/lib/configs/prettier.js
CHANGED
|
@@ -11,6 +11,7 @@ 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",
|
package/lib/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ 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;
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
void: {
|
|
30
|
+
enum: ["never", "always", "ignore"],
|
|
31
|
+
},
|
|
32
|
+
normal: {
|
|
33
|
+
enum: ["never", "always", "ignore"],
|
|
34
|
+
},
|
|
35
|
+
component: {
|
|
36
|
+
enum: ["never", "always", "ignore"],
|
|
37
|
+
},
|
|
38
|
+
svelte: {
|
|
39
|
+
enum: ["never", "always", "ignore"],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
create(ctx) {
|
|
47
|
+
const options = {
|
|
48
|
+
void: "always",
|
|
49
|
+
normal: "always",
|
|
50
|
+
component: "always",
|
|
51
|
+
svelte: "always",
|
|
52
|
+
...ctx.options?.[0],
|
|
53
|
+
};
|
|
54
|
+
function getElementType(node) {
|
|
55
|
+
if (node.kind === "component")
|
|
56
|
+
return "component";
|
|
57
|
+
if (node.kind === "special")
|
|
58
|
+
return "svelte";
|
|
59
|
+
if ((0, ast_utils_1.isVoidHtmlElement)(node))
|
|
60
|
+
return "void";
|
|
61
|
+
return "normal";
|
|
62
|
+
}
|
|
63
|
+
function isElementEmpty(node) {
|
|
64
|
+
if (node.children.length <= 0)
|
|
65
|
+
return true;
|
|
66
|
+
for (const child of node.children) {
|
|
67
|
+
if (child.type !== "SvelteText")
|
|
68
|
+
return false;
|
|
69
|
+
if (!/^\s*$/.test(child.value))
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
function report(node, close) {
|
|
75
|
+
const elementType = getElementType(node);
|
|
76
|
+
ctx.report({
|
|
77
|
+
node,
|
|
78
|
+
messageId: close ? "requireClosing" : "disallowClosing",
|
|
79
|
+
data: {
|
|
80
|
+
type: TYPE_MESSAGES[elementType],
|
|
81
|
+
},
|
|
82
|
+
*fix(fixer) {
|
|
83
|
+
if (close) {
|
|
84
|
+
for (const child of node.children) {
|
|
85
|
+
yield fixer.removeRange(child.range);
|
|
86
|
+
}
|
|
87
|
+
yield fixer.insertTextBeforeRange([node.startTag.range[1] - 1, node.startTag.range[1]], "/");
|
|
88
|
+
if (node.endTag)
|
|
89
|
+
yield fixer.removeRange(node.endTag.range);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
yield fixer.removeRange([
|
|
93
|
+
node.startTag.range[1] - 2,
|
|
94
|
+
node.startTag.range[1] - 1,
|
|
95
|
+
]);
|
|
96
|
+
if (!(0, ast_utils_1.isVoidHtmlElement)(node))
|
|
97
|
+
yield fixer.insertTextAfter(node, `</${(0, ast_utils_1.getNodeName)(node)}>`);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
SvelteElement(node) {
|
|
104
|
+
if (!isElementEmpty(node))
|
|
105
|
+
return;
|
|
106
|
+
const elementType = getElementType(node);
|
|
107
|
+
const elementTypeOptions = options[elementType];
|
|
108
|
+
if (elementTypeOptions === "ignore")
|
|
109
|
+
return;
|
|
110
|
+
const shouldBeClosed = elementTypeOptions === "always";
|
|
111
|
+
if (shouldBeClosed && !node.startTag.selfClosing) {
|
|
112
|
+
report(node, true);
|
|
113
|
+
}
|
|
114
|
+
else if (!shouldBeClosed && node.startTag.selfClosing) {
|
|
115
|
+
report(node, false);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
});
|
|
@@ -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,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const eslint_utils_1 = require("eslint-utils");
|
|
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
|
+
function* extractStoreReferences() {
|
|
20
|
+
const referenceTracker = new eslint_utils_1.ReferenceTracker(context.getScope());
|
|
21
|
+
for (const { node, path } of referenceTracker.iterateEsmReferences({
|
|
22
|
+
"svelte/store": {
|
|
23
|
+
[eslint_utils_1.ReferenceTracker.ESM]: true,
|
|
24
|
+
writable: {
|
|
25
|
+
[eslint_utils_1.ReferenceTracker.CALL]: true,
|
|
26
|
+
},
|
|
27
|
+
readable: {
|
|
28
|
+
[eslint_utils_1.ReferenceTracker.CALL]: true,
|
|
29
|
+
},
|
|
30
|
+
derived: {
|
|
31
|
+
[eslint_utils_1.ReferenceTracker.CALL]: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
})) {
|
|
35
|
+
yield {
|
|
36
|
+
node: node,
|
|
37
|
+
name: path[path.length - 1],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
Program() {
|
|
43
|
+
for (const { node, name } of extractStoreReferences()) {
|
|
44
|
+
const minArgs = name === "writable" || name === "readable"
|
|
45
|
+
? 1
|
|
46
|
+
: name === "derived"
|
|
47
|
+
? 3
|
|
48
|
+
: 0;
|
|
49
|
+
if (node.arguments.length >= minArgs ||
|
|
50
|
+
node.arguments.some((arg) => arg.type === "SpreadElement")) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
context.report({
|
|
54
|
+
node,
|
|
55
|
+
messageId: "storeDefaultValue",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
});
|
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,6 +22,7 @@ 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"));
|
|
@@ -31,6 +33,7 @@ const no_useless_mustaches_1 = __importDefault(require("../rules/no-useless-must
|
|
|
31
33
|
const prefer_class_directive_1 = __importDefault(require("../rules/prefer-class-directive"));
|
|
32
34
|
const prefer_style_directive_1 = __importDefault(require("../rules/prefer-style-directive"));
|
|
33
35
|
const require_optimized_style_attribute_1 = __importDefault(require("../rules/require-optimized-style-attribute"));
|
|
36
|
+
const require_stores_init_1 = __importDefault(require("../rules/require-stores-init"));
|
|
34
37
|
const shorthand_attribute_1 = __importDefault(require("../rules/shorthand-attribute"));
|
|
35
38
|
const shorthand_directive_1 = __importDefault(require("../rules/shorthand-directive"));
|
|
36
39
|
const sort_attributes_1 = __importDefault(require("../rules/sort-attributes"));
|
|
@@ -43,6 +46,7 @@ exports.rules = [
|
|
|
43
46
|
first_attribute_linebreak_1.default,
|
|
44
47
|
html_closing_bracket_spacing_1.default,
|
|
45
48
|
html_quotes_1.default,
|
|
49
|
+
html_self_closing_1.default,
|
|
46
50
|
indent_1.default,
|
|
47
51
|
max_attributes_per_line_1.default,
|
|
48
52
|
mustache_spacing_1.default,
|
|
@@ -55,6 +59,7 @@ exports.rules = [
|
|
|
55
59
|
no_inner_declarations_1.default,
|
|
56
60
|
no_not_function_handler_1.default,
|
|
57
61
|
no_object_in_text_mustaches_1.default,
|
|
62
|
+
no_reactive_functions_1.default,
|
|
58
63
|
no_reactive_literals_1.default,
|
|
59
64
|
no_shorthand_style_property_overrides_1.default,
|
|
60
65
|
no_spaces_around_equal_signs_in_attribute_1.default,
|
|
@@ -65,6 +70,7 @@ exports.rules = [
|
|
|
65
70
|
prefer_class_directive_1.default,
|
|
66
71
|
prefer_style_directive_1.default,
|
|
67
72
|
require_optimized_style_attribute_1.default,
|
|
73
|
+
require_stores_init_1.default,
|
|
68
74
|
shorthand_attribute_1.default,
|
|
69
75
|
shorthand_directive_1.default,
|
|
70
76
|
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.5.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",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"postcss-load-config": "^3.1.4",
|
|
67
67
|
"postcss-safe-parser": "^6.0.0",
|
|
68
68
|
"sourcemap-codec": "^1.4.8",
|
|
69
|
-
"svelte-eslint-parser": "^0.
|
|
69
|
+
"svelte-eslint-parser": "^0.18.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@babel/core": "^7.16.0",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"@types/escape-html": "^1.0.2",
|
|
84
84
|
"@types/eslint": "^8.0.0",
|
|
85
85
|
"@types/eslint-scope": "^3.7.0",
|
|
86
|
+
"@types/eslint-utils": "^3.0.1",
|
|
86
87
|
"@types/eslint-visitor-keys": "^1.0.0",
|
|
87
88
|
"@types/estree": "^1.0.0",
|
|
88
89
|
"@types/less": "^3.0.3",
|
|
@@ -99,7 +100,7 @@
|
|
|
99
100
|
"@typescript-eslint/parser-v4": "npm:@typescript-eslint/parser@4",
|
|
100
101
|
"assert": "^2.0.0",
|
|
101
102
|
"env-cmd": "^10.1.0",
|
|
102
|
-
"esbuild": "^0.
|
|
103
|
+
"esbuild": "^0.15.0",
|
|
103
104
|
"esbuild-register": "^3.2.0",
|
|
104
105
|
"escape-html": "^1.0.3",
|
|
105
106
|
"eslint": "^8.0.0",
|
|
@@ -135,13 +136,14 @@
|
|
|
135
136
|
"sass": "^1.51.0",
|
|
136
137
|
"semver": "^7.3.5",
|
|
137
138
|
"stylelint": "^14.0.0",
|
|
138
|
-
"stylelint-config-standard": "^
|
|
139
|
+
"stylelint-config-standard": "^27.0.0",
|
|
139
140
|
"stylus": "^0.58.0",
|
|
140
141
|
"svelte": "^3.46.1",
|
|
141
142
|
"svelte-adapter-ghpages": "0.0.2",
|
|
142
143
|
"typescript": "^4.5.2",
|
|
143
144
|
"vite": "^3.0.0-0",
|
|
144
|
-
"vite-plugin-svelte-md": "^0.1.5"
|
|
145
|
+
"vite-plugin-svelte-md": "^0.1.5",
|
|
146
|
+
"yaml": "^2.1.1"
|
|
145
147
|
},
|
|
146
148
|
"publishConfig": {
|
|
147
149
|
"access": "public"
|