eslint-plugin-svelte 2.1.1 → 2.2.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.
Files changed (40) hide show
  1. package/README.md +2 -1
  2. package/lib/configs/prettier.d.ts +13 -0
  3. package/lib/configs/prettier.js +19 -0
  4. package/lib/index.d.ts +12 -0
  5. package/lib/index.js +2 -0
  6. package/lib/rules/button-has-type.js +6 -2
  7. package/lib/rules/first-attribute-linebreak.js +3 -3
  8. package/lib/rules/html-quotes.js +4 -4
  9. package/lib/rules/indent-helpers/commons.d.ts +1 -0
  10. package/lib/rules/indent-helpers/es.js +4 -1
  11. package/lib/rules/indent-helpers/index.js +22 -4
  12. package/lib/rules/indent-helpers/offset-context.js +2 -4
  13. package/lib/rules/indent-helpers/svelte.js +1 -1
  14. package/lib/rules/indent-helpers/ts.js +7 -2
  15. package/lib/rules/indent.js +2 -0
  16. package/lib/rules/max-attributes-per-line.js +4 -5
  17. package/lib/rules/mustache-spacing.js +6 -6
  18. package/lib/rules/no-inner-declarations.js +1 -2
  19. package/lib/rules/no-unknown-style-directive-property.js +2 -3
  20. package/lib/rules/prefer-class-directive.js +5 -1
  21. package/lib/rules/prefer-style-directive.js +1 -0
  22. package/lib/rules/require-optimized-style-attribute.js +1 -2
  23. package/lib/rules/shorthand-attribute.js +2 -2
  24. package/lib/rules/shorthand-directive.js +2 -2
  25. package/lib/rules/spaced-html-comment.js +3 -3
  26. package/lib/rules/system.js +1 -2
  27. package/lib/rules/valid-compile.js +1 -2
  28. package/lib/shared/comment-directives.js +2 -3
  29. package/lib/shared/index.js +2 -3
  30. package/lib/shared/svelte-compile-warns/index.js +22 -17
  31. package/lib/shared/svelte-compile-warns/transform/babel.js +1 -2
  32. package/lib/shared/svelte-compile-warns/transform/load-module.js +9 -21
  33. package/lib/shared/svelte-compile-warns/transform/postcss.js +8 -6
  34. package/lib/shared/svelte-compile-warns/transform/typescript.js +1 -1
  35. package/lib/types.d.ts +8 -2
  36. package/lib/utils/css-utils/style-attribute.js +12 -8
  37. package/lib/utils/css-utils/utils.js +1 -2
  38. package/lib/utils/eslint-core.js +1 -2
  39. package/lib/utils/index.js +9 -1
  40. package/package.json +4 -3
package/README.md CHANGED
@@ -83,6 +83,7 @@ This plugin provides configs:
83
83
 
84
84
  - `plugin:svelte/base` ... Configuration to enable correct Svelte parsing.
85
85
  - `plugin:svelte/recommended` ... Above, plus rules to prevent errors or unintended behavior.
86
+ - `plugin:svelte/prettier` ... Turn off rules that may conflict with [Prettier](https://prettier.io/) ([prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte)).
86
87
 
87
88
  See [the rule list](https://ota-meshi.github.io/eslint-plugin-svelte/rules/) to get the `rules` that this plugin provides.
88
89
 
@@ -360,7 +361,7 @@ If you want to test only one rule, run the following command (for `indent` rule)
360
361
  yarn test -g indent
361
362
  ```
362
363
 
363
- Take https://stackoverflow.com/questions/10832031/how-to-run-a-single-test-with-mocha as reference for details.
364
+ Take <https://stackoverflow.com/questions/10832031/how-to-run-a-single-test-with-mocha> as reference for details.
364
365
 
365
366
  If you want to test only `my-test-input.svelte`, add `my-test-config.json` and save `{"only": true}`.
366
367
  (Note that `{"only": true}` must be removed before making a pull request.)
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ extends: string[];
3
+ rules: {
4
+ "svelte/first-attribute-linebreak": string;
5
+ "svelte/html-quotes": string;
6
+ "svelte/indent": string;
7
+ "svelte/max-attributes-per-line": string;
8
+ "svelte/mustache-spacing": string;
9
+ "svelte/shorthand-attribute": string;
10
+ "svelte/shorthand-directive": string;
11
+ };
12
+ };
13
+ export = _default;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ const path_1 = __importDefault(require("path"));
6
+ const base = require.resolve("./base");
7
+ const baseExtend = path_1.default.extname(`${base}`) === ".ts" ? "plugin:svelte/base" : base;
8
+ module.exports = {
9
+ extends: [baseExtend],
10
+ rules: {
11
+ "svelte/first-attribute-linebreak": "off",
12
+ "svelte/html-quotes": "off",
13
+ "svelte/indent": "off",
14
+ "svelte/max-attributes-per-line": "off",
15
+ "svelte/mustache-spacing": "off",
16
+ "svelte/shorthand-attribute": "off",
17
+ "svelte/shorthand-directive": "off",
18
+ },
19
+ };
package/lib/index.d.ts CHANGED
@@ -33,6 +33,18 @@ declare const _default: {
33
33
  "svelte/valid-compile": string;
34
34
  };
35
35
  };
36
+ prettier: {
37
+ extends: string[];
38
+ rules: {
39
+ "svelte/first-attribute-linebreak": string;
40
+ "svelte/html-quotes": string;
41
+ "svelte/indent": string;
42
+ "svelte/max-attributes-per-line": string;
43
+ "svelte/mustache-spacing": string;
44
+ "svelte/shorthand-attribute": string;
45
+ "svelte/shorthand-directive": string;
46
+ };
47
+ };
36
48
  };
37
49
  rules: {
38
50
  [key: string]: RuleModule;
package/lib/index.js CHANGED
@@ -28,10 +28,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  const rules_1 = require("./utils/rules");
29
29
  const base_1 = __importDefault(require("./configs/base"));
30
30
  const recommended_1 = __importDefault(require("./configs/recommended"));
31
+ const prettier_1 = __importDefault(require("./configs/prettier"));
31
32
  const processor = __importStar(require("./processor"));
32
33
  const configs = {
33
34
  base: base_1.default,
34
35
  recommended: recommended_1.default,
36
+ prettier: prettier_1.default,
35
37
  };
36
38
  const rules = rules_1.rules.reduce((obj, r) => {
37
39
  obj[r.meta.docs.ruleName] = r;
@@ -35,8 +35,12 @@ exports.default = (0, utils_1.createRule)("button-has-type", {
35
35
  type: "suggestion",
36
36
  },
37
37
  create(context) {
38
- var _a;
39
- const configuration = Object.assign({ button: true, submit: true, reset: true }, ((_a = context.options[0]) !== null && _a !== void 0 ? _a : {}));
38
+ const configuration = {
39
+ button: true,
40
+ submit: true,
41
+ reset: true,
42
+ ...(context.options[0] ?? {}),
43
+ };
40
44
  function isButtonType(type) {
41
45
  return type === "button" || type === "submit" || type === "reset";
42
46
  }
@@ -7,6 +7,7 @@ exports.default = (0, utils_1.createRule)("first-attribute-linebreak", {
7
7
  description: "enforce the location of first attribute",
8
8
  category: "Stylistic Issues",
9
9
  recommended: false,
10
+ conflictWithPrettier: true,
10
11
  },
11
12
  fixable: "whitespace",
12
13
  schema: [
@@ -26,9 +27,8 @@ exports.default = (0, utils_1.createRule)("first-attribute-linebreak", {
26
27
  type: "layout",
27
28
  },
28
29
  create(context) {
29
- var _a, _b;
30
- const multiline = ((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.multiline) || "below";
31
- const singleline = ((_b = context.options[0]) === null || _b === void 0 ? void 0 : _b.singleline) || "beside";
30
+ const multiline = context.options[0]?.multiline || "below";
31
+ const singleline = context.options[0]?.singleline || "beside";
32
32
  const sourceCode = context.getSourceCode();
33
33
  function report(firstAttribute, location) {
34
34
  context.report({
@@ -18,6 +18,7 @@ exports.default = (0, utils_1.createRule)("html-quotes", {
18
18
  description: "enforce quotes style of HTML attributes",
19
19
  category: "Stylistic Issues",
20
20
  recommended: false,
21
+ conflictWithPrettier: true,
21
22
  },
22
23
  fixable: "code",
23
24
  schema: [
@@ -45,13 +46,12 @@ exports.default = (0, utils_1.createRule)("html-quotes", {
45
46
  type: "layout",
46
47
  },
47
48
  create(context) {
48
- var _a, _b, _c, _d, _e, _f;
49
49
  const sourceCode = context.getSourceCode();
50
- const preferQuote = (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.prefer) !== null && _b !== void 0 ? _b : "double";
51
- const dynamicQuote = ((_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.dynamic) === null || _d === void 0 ? void 0 : _d.quoted)
50
+ const preferQuote = context.options[0]?.prefer ?? "double";
51
+ const dynamicQuote = context.options[0]?.dynamic?.quoted
52
52
  ? preferQuote
53
53
  : "unquoted";
54
- const avoidInvalidUnquotedInHTML = Boolean((_f = (_e = context.options[0]) === null || _e === void 0 ? void 0 : _e.dynamic) === null || _f === void 0 ? void 0 : _f.avoidInvalidUnquotedInHTML);
54
+ const avoidInvalidUnquotedInHTML = Boolean(context.options[0]?.dynamic?.avoidInvalidUnquotedInHTML);
55
55
  function canBeUnquotedInHTML(text) {
56
56
  return !/[\s"'<=>`]/u.test(text);
57
57
  }
@@ -9,6 +9,7 @@ export declare type MaybeNode = {
9
9
  };
10
10
  export declare type IndentOptions = {
11
11
  indentChar: " " | "\t";
12
+ indentScript: boolean;
12
13
  indentSize: number;
13
14
  switchCase: number;
14
15
  alignAttributesVertically: boolean;
@@ -729,7 +729,10 @@ function defineVisitor(context) {
729
729
  },
730
730
  };
731
731
  const v = visitor;
732
- return Object.assign(Object.assign({}, v), commonVisitor);
732
+ return {
733
+ ...v,
734
+ ...commonVisitor,
735
+ };
733
736
  }
734
737
  exports.defineVisitor = defineVisitor;
735
738
  function getParent(node) {
@@ -31,7 +31,15 @@ const ast_1 = require("./ast");
31
31
  const eslint_utils_1 = require("eslint-utils");
32
32
  const offset_context_1 = require("./offset-context");
33
33
  function parseOptions(options, defaultOptions) {
34
- const ret = Object.assign({ indentChar: " ", indentSize: 2, switchCase: 1, alignAttributesVertically: false, ignoredNodes: [] }, defaultOptions);
34
+ const ret = {
35
+ indentChar: " ",
36
+ indentScript: true,
37
+ indentSize: 2,
38
+ switchCase: 1,
39
+ alignAttributesVertically: false,
40
+ ignoredNodes: [],
41
+ ...defaultOptions,
42
+ };
35
43
  if (Number.isSafeInteger(options.indent)) {
36
44
  ret.indentSize = Number(options.indent);
37
45
  }
@@ -39,6 +47,9 @@ function parseOptions(options, defaultOptions) {
39
47
  ret.indentChar = "\t";
40
48
  ret.indentSize = 1;
41
49
  }
50
+ if (typeof options.indentScript === "boolean") {
51
+ ret.indentScript = options.indentScript;
52
+ }
42
53
  if (options.switchCase != null && Number.isSafeInteger(options.switchCase)) {
43
54
  ret.switchCase = options.switchCase;
44
55
  }
@@ -152,7 +163,11 @@ function defineVisitor(context, defaultOptions) {
152
163
  options,
153
164
  offsets,
154
165
  };
155
- const nodesVisitor = Object.assign(Object.assign(Object.assign({}, ES.defineVisitor(indentContext)), SV.defineVisitor(indentContext)), TS.defineVisitor(indentContext));
166
+ const nodesVisitor = {
167
+ ...ES.defineVisitor(indentContext),
168
+ ...SV.defineVisitor(indentContext),
169
+ ...TS.defineVisitor(indentContext),
170
+ };
156
171
  const knownNodes = new Set(Object.keys(nodesVisitor));
157
172
  function compositingIgnoresVisitor(visitor) {
158
173
  for (const ignoreSelector of options.ignoredNodes) {
@@ -171,7 +186,9 @@ function defineVisitor(context, defaultOptions) {
171
186
  }
172
187
  return visitor;
173
188
  }
174
- return compositingIgnoresVisitor(Object.assign(Object.assign({}, nodesVisitor), { "*:exit"(node) {
189
+ return compositingIgnoresVisitor({
190
+ ...nodesVisitor,
191
+ "*:exit"(node) {
175
192
  if (!knownNodes.has(node.type)) {
176
193
  offsets.ignore(node);
177
194
  }
@@ -218,6 +235,7 @@ function defineVisitor(context, defaultOptions) {
218
235
  };
219
236
  }
220
237
  }
221
- } }));
238
+ },
239
+ });
222
240
  }
223
241
  exports.defineVisitor = defineVisitor;
@@ -126,9 +126,8 @@ class OffsetContext {
126
126
  }
127
127
  }
128
128
  ignore(node) {
129
- var _a;
130
129
  const range = node.range;
131
- const n = (_a = this.ignoreRanges.get(range[0])) !== null && _a !== void 0 ? _a : 0;
130
+ const n = this.ignoreRanges.get(range[0]) ?? 0;
132
131
  this.ignoreRanges.set(range[0], Math.max(n, range[1]));
133
132
  }
134
133
  getOffsetCalculator() {
@@ -183,13 +182,12 @@ class OffsetCalculator {
183
182
  return null;
184
183
  }
185
184
  saveExpectedIndent(tokens, expectedIndent) {
186
- var _a;
187
185
  for (const token of tokens) {
188
186
  const offsetInfo = this.offsets.get(token.range[0]);
189
187
  if (offsetInfo == null) {
190
188
  continue;
191
189
  }
192
- offsetInfo.expectedIndent = (_a = offsetInfo.expectedIndent) !== null && _a !== void 0 ? _a : expectedIndent;
190
+ offsetInfo.expectedIndent = offsetInfo.expectedIndent ?? expectedIndent;
193
191
  }
194
192
  }
195
193
  }
@@ -10,7 +10,7 @@ function defineVisitor(context) {
10
10
  const { sourceCode, offsets, options } = context;
11
11
  const visitor = {
12
12
  SvelteScriptElement(node) {
13
- offsets.setOffsetElementList(node.body, node.startTag, node.endTag, 1);
13
+ offsets.setOffsetElementList(node.body, node.startTag, node.endTag, options.indentScript ? 1 : 0);
14
14
  },
15
15
  SvelteStyleElement(node) {
16
16
  node.children.forEach((n) => offsets.ignore(n));
@@ -542,7 +542,7 @@ function defineVisitor(context) {
542
542
  }
543
543
  if (decorators[0] === node) {
544
544
  if (parent.range[0] === node.range[0]) {
545
- const startParentToken = sourceCode.getTokenAfter(decorators[(decorators === null || decorators === void 0 ? void 0 : decorators.length) - 1]);
545
+ const startParentToken = sourceCode.getTokenAfter(decorators[decorators?.length - 1]);
546
546
  offsets.setOffsetToken(startParentToken, 0, atToken);
547
547
  }
548
548
  else {
@@ -730,6 +730,11 @@ function defineVisitor(context) {
730
730
  },
731
731
  };
732
732
  const v = visitor;
733
- return Object.assign(Object.assign(Object.assign(Object.assign({}, v), commonsVisitor), extendsESVisitor), deprecatedVisitor);
733
+ return {
734
+ ...v,
735
+ ...commonsVisitor,
736
+ ...extendsESVisitor,
737
+ ...deprecatedVisitor,
738
+ };
734
739
  }
735
740
  exports.defineVisitor = defineVisitor;
@@ -8,6 +8,7 @@ exports.default = (0, utils_1.createRule)("indent", {
8
8
  description: "enforce consistent indentation",
9
9
  category: "Stylistic Issues",
10
10
  recommended: false,
11
+ conflictWithPrettier: true,
11
12
  },
12
13
  fixable: "whitespace",
13
14
  schema: [
@@ -17,6 +18,7 @@ exports.default = (0, utils_1.createRule)("indent", {
17
18
  indent: {
18
19
  anyOf: [{ type: "integer", minimum: 1 }, { enum: ["tab"] }],
19
20
  },
21
+ indentScript: { type: "boolean" },
20
22
  switchCase: { type: "integer", minimum: 0 },
21
23
  alignAttributesVertically: { type: "boolean" },
22
24
  ignoredNodes: {
@@ -5,10 +5,9 @@ function isSingleLine(node) {
5
5
  return node.loc.start.line === node.loc.end.line;
6
6
  }
7
7
  function groupAttributesByLine(attributes) {
8
- var _a, _b;
9
8
  const group = [];
10
9
  for (const attr of attributes) {
11
- if (((_b = (_a = group[0]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.loc.end.line) === attr.loc.start.line) {
10
+ if (group[0]?.[0]?.loc.end.line === attr.loc.start.line) {
12
11
  group[0].push(attr);
13
12
  }
14
13
  else {
@@ -23,6 +22,7 @@ exports.default = (0, utils_1.createRule)("max-attributes-per-line", {
23
22
  description: "enforce the maximum number of attributes per line",
24
23
  category: "Stylistic Issues",
25
24
  recommended: false,
25
+ conflictWithPrettier: true,
26
26
  },
27
27
  fixable: "whitespace",
28
28
  schema: [
@@ -47,9 +47,8 @@ exports.default = (0, utils_1.createRule)("max-attributes-per-line", {
47
47
  type: "layout",
48
48
  },
49
49
  create(context) {
50
- var _a, _b, _c, _d;
51
- const multilineMaximum = (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.multiline) !== null && _b !== void 0 ? _b : 1;
52
- const singlelineMaximum = (_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.singleline) !== null && _d !== void 0 ? _d : 1;
50
+ const multilineMaximum = context.options[0]?.multiline ?? 1;
51
+ const singlelineMaximum = context.options[0]?.singleline ?? 1;
53
52
  const sourceCode = context.getSourceCode();
54
53
  function report(attribute) {
55
54
  if (!attribute) {
@@ -5,14 +5,13 @@ const utils_1 = require("../utils");
5
5
  const ast_utils_1 = require("../utils/ast-utils");
6
6
  const VALUE_SCHEMA = { enum: ["never", "always"] };
7
7
  function parseOptions(options) {
8
- var _a, _b;
9
8
  return {
10
- textExpressions: (options === null || options === void 0 ? void 0 : options.textExpressions) || "never",
11
- attributesAndProps: (options === null || options === void 0 ? void 0 : options.attributesAndProps) || "never",
12
- directiveExpressions: (options === null || options === void 0 ? void 0 : options.directiveExpressions) || "never",
9
+ textExpressions: options?.textExpressions || "never",
10
+ attributesAndProps: options?.attributesAndProps || "never",
11
+ directiveExpressions: options?.directiveExpressions || "never",
13
12
  tags: {
14
- openingBrace: ((_a = options === null || options === void 0 ? void 0 : options.tags) === null || _a === void 0 ? void 0 : _a.openingBrace) || "never",
15
- closingBrace: ((_b = options === null || options === void 0 ? void 0 : options.tags) === null || _b === void 0 ? void 0 : _b.closingBrace) || "never",
13
+ openingBrace: options?.tags?.openingBrace || "never",
14
+ closingBrace: options?.tags?.closingBrace || "never",
16
15
  },
17
16
  };
18
17
  }
@@ -22,6 +21,7 @@ exports.default = (0, utils_1.createRule)("mustache-spacing", {
22
21
  description: "enforce unified spacing in mustache",
23
22
  category: "Stylistic Issues",
24
23
  recommended: false,
24
+ conflictWithPrettier: true,
25
25
  },
26
26
  fixable: "code",
27
27
  schema: [
@@ -22,8 +22,7 @@ exports.default = (0, utils_1.createRule)("no-inner-declarations", {
22
22
  return (0, eslint_core_1.buildProxyListener)(coreListener, (node) => {
23
23
  return (0, eslint_core_1.getProxyNode)(node, {
24
24
  get parent() {
25
- var _a;
26
- if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === "SvelteScriptElement") {
25
+ if (node.parent?.type === "SvelteScriptElement") {
27
26
  return node.parent.parent;
28
27
  }
29
28
  return node.parent;
@@ -34,11 +34,10 @@ exports.default = (0, utils_1.createRule)("no-unknown-style-directive-property",
34
34
  type: "problem",
35
35
  },
36
36
  create(context) {
37
- var _a, _b, _c, _d;
38
37
  const ignoreProperties = [
39
- ...((_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.ignoreProperties) !== null && _b !== void 0 ? _b : []),
38
+ ...(context.options[0]?.ignoreProperties ?? []),
40
39
  ].map(regexp_1.toRegExp);
41
- const ignorePrefixed = (_d = (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.ignorePrefixed) !== null && _d !== void 0 ? _d : true;
40
+ const ignorePrefixed = context.options[0]?.ignorePrefixed ?? true;
42
41
  const knownProperties = new Set(known_css_properties_1.all);
43
42
  function validName(name) {
44
43
  return (name.startsWith("--") ||
@@ -8,6 +8,7 @@ exports.default = (0, utils_1.createRule)("prefer-class-directive", {
8
8
  description: "require class directives instead of ternary expressions",
9
9
  category: "Stylistic Issues",
10
10
  recommended: false,
11
+ conflictWithPrettier: false,
11
12
  },
12
13
  fixable: "code",
13
14
  schema: [],
@@ -39,7 +40,10 @@ exports.default = (0, utils_1.createRule)("prefer-class-directive", {
39
40
  return false;
40
41
  }
41
42
  for (const [expr, str] of sub) {
42
- result.set(Object.assign(Object.assign({}, key), { chains: expr }), str);
43
+ result.set({
44
+ ...key,
45
+ chains: expr,
46
+ }, str);
43
47
  }
44
48
  }
45
49
  else {
@@ -12,6 +12,7 @@ exports.default = (0, utils_1.createRule)("prefer-style-directive", {
12
12
  description: "require style directives instead of style attribute",
13
13
  category: "Stylistic Issues",
14
14
  recommended: false,
15
+ conflictWithPrettier: false,
15
16
  },
16
17
  fixable: "code",
17
18
  schema: [],
@@ -30,8 +30,7 @@ exports.default = (0, utils_1.createRule)("require-optimized-style-attribute", {
30
30
  });
31
31
  },
32
32
  SvelteAttribute(node) {
33
- var _a;
34
- if (node.key.name !== "style" || !((_a = node.value) === null || _a === void 0 ? void 0 : _a.length)) {
33
+ if (node.key.name !== "style" || !node.value?.length) {
35
34
  return;
36
35
  }
37
36
  const root = (0, css_utils_1.parseStyleAttributeValue)(node, context);
@@ -8,6 +8,7 @@ exports.default = (0, utils_1.createRule)("shorthand-attribute", {
8
8
  description: "enforce use of shorthand syntax in attribute",
9
9
  category: "Stylistic Issues",
10
10
  recommended: false,
11
+ conflictWithPrettier: true,
11
12
  },
12
13
  fixable: "code",
13
14
  schema: [
@@ -26,9 +27,8 @@ exports.default = (0, utils_1.createRule)("shorthand-attribute", {
26
27
  type: "layout",
27
28
  },
28
29
  create(context) {
29
- var _a;
30
30
  const sourceCode = context.getSourceCode();
31
- const always = ((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.prefer) !== "never";
31
+ const always = context.options[0]?.prefer !== "never";
32
32
  return always
33
33
  ? {
34
34
  SvelteAttribute(node) {
@@ -8,6 +8,7 @@ exports.default = (0, utils_1.createRule)("shorthand-directive", {
8
8
  description: "enforce use of shorthand syntax in directives",
9
9
  category: "Stylistic Issues",
10
10
  recommended: false,
11
+ conflictWithPrettier: true,
11
12
  },
12
13
  fixable: "code",
13
14
  schema: [
@@ -26,9 +27,8 @@ exports.default = (0, utils_1.createRule)("shorthand-directive", {
26
27
  type: "layout",
27
28
  },
28
29
  create(context) {
29
- var _a;
30
30
  const sourceCode = context.getSourceCode();
31
- const always = ((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.prefer) !== "never";
31
+ const always = context.options[0]?.prefer !== "never";
32
32
  function reportForAlways(node) {
33
33
  context.report({
34
34
  node,
@@ -7,6 +7,7 @@ exports.default = (0, utils_1.createRule)("spaced-html-comment", {
7
7
  description: "enforce consistent spacing after the `<!--` and before the `-->` in a HTML comment",
8
8
  category: "Stylistic Issues",
9
9
  recommended: false,
10
+ conflictWithPrettier: false,
10
11
  },
11
12
  fixable: "whitespace",
12
13
  schema: [
@@ -26,7 +27,6 @@ exports.default = (0, utils_1.createRule)("spaced-html-comment", {
26
27
  const requireSpace = context.options[0] !== "never";
27
28
  return {
28
29
  SvelteHTMLComment(node) {
29
- var _a, _b;
30
30
  if (!node.value.trim()) {
31
31
  return;
32
32
  }
@@ -51,7 +51,7 @@ exports.default = (0, utils_1.createRule)("spaced-html-comment", {
51
51
  }
52
52
  }
53
53
  else {
54
- const beginSpaces = (_a = /^[^\S\n\r]/u.exec(node.value)) === null || _a === void 0 ? void 0 : _a[0];
54
+ const beginSpaces = /^[^\S\n\r]/u.exec(node.value)?.[0];
55
55
  if (beginSpaces) {
56
56
  context.report({
57
57
  node,
@@ -64,7 +64,7 @@ exports.default = (0, utils_1.createRule)("spaced-html-comment", {
64
64
  },
65
65
  });
66
66
  }
67
- const endSpaces = (_b = /(?<=\S)[^\S\n\r]$/u.exec(node.value)) === null || _b === void 0 ? void 0 : _b[0];
67
+ const endSpaces = /(?<=\S)[^\S\n\r]$/u.exec(node.value)?.[0];
68
68
  if (endSpaces) {
69
69
  context.report({
70
70
  node,
@@ -15,14 +15,13 @@ exports.default = (0, utils_1.createRule)("system", {
15
15
  type: "problem",
16
16
  },
17
17
  create(context) {
18
- var _a, _b;
19
18
  const shared = (0, shared_1.getShared)(context.getFilename());
20
19
  if (!shared)
21
20
  return {};
22
21
  const directives = shared.newCommentDirectives({
23
22
  ruleId: "svelte/system",
24
23
  });
25
- const ignoreWarnings = (_b = (_a = context.settings) === null || _a === void 0 ? void 0 : _a.svelte) === null || _b === void 0 ? void 0 : _b.ignoreWarnings;
24
+ const ignoreWarnings = context.settings?.svelte?.ignoreWarnings;
26
25
  if (ignoreWarnings && !Array.isArray(ignoreWarnings)) {
27
26
  context.report({
28
27
  loc: { line: 1, column: 0 },
@@ -22,11 +22,10 @@ exports.default = (0, utils_1.createRule)("valid-compile", {
22
22
  type: "problem",
23
23
  },
24
24
  create(context) {
25
- var _a;
26
25
  if (!context.parserServices.isSvelte) {
27
26
  return {};
28
27
  }
29
- const ignoreWarnings = Boolean((_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.ignoreWarnings);
28
+ const ignoreWarnings = Boolean(context.options[0]?.ignoreWarnings);
30
29
  const ignores = ["missing-declaration", "dynamic-slot-name"];
31
30
  function report(warnings) {
32
31
  for (const warn of warnings) {
@@ -8,7 +8,7 @@ class CommentDirectives {
8
8
  this.lineDisableDirectives = new Map();
9
9
  this.blockDirectives = new Map();
10
10
  this.ruleId = options.ruleId;
11
- this.reportUnusedDisableDirectives = Boolean(options === null || options === void 0 ? void 0 : options.reportUnusedDisableDirectives);
11
+ this.reportUnusedDisableDirectives = Boolean(options?.reportUnusedDisableDirectives);
12
12
  }
13
13
  filterMessages(messages) {
14
14
  const { lineDisableDirectives, blockDirectives, reportUnusedDisableDirectives, } = this;
@@ -61,12 +61,11 @@ class CommentDirectives {
61
61
  }
62
62
  return filteredMessages;
63
63
  function isEnable(message) {
64
- var _a;
65
64
  if (!message.ruleId) {
66
65
  return true;
67
66
  }
68
67
  for (const disableLines of getFromRule(lineDisableDirectives, message.ruleId)) {
69
- for (const disableLine of (_a = disableLines.get(message.line)) !== null && _a !== void 0 ? _a : []) {
68
+ for (const disableLine of disableLines.get(message.line) ?? []) {
70
69
  if (!disableLine.rule(message.ruleId)) {
71
70
  continue;
72
71
  }
@@ -21,11 +21,10 @@ exports.beginShared = beginShared;
21
21
  function terminateShared(filename) {
22
22
  const result = sharedMap.get(filename);
23
23
  sharedMap.delete(filename);
24
- return result !== null && result !== void 0 ? result : null;
24
+ return result ?? null;
25
25
  }
26
26
  exports.terminateShared = terminateShared;
27
27
  function getShared(filename) {
28
- var _a;
29
- return (_a = sharedMap.get(filename)) !== null && _a !== void 0 ? _a : null;
28
+ return sharedMap.get(filename) ?? null;
30
29
  }
31
30
  exports.getShared = getShared;
@@ -91,7 +91,11 @@ function getSvelteCompileWarningsWithoutCache(context) {
91
91
  transformResults.push(...transformScripts(context));
92
92
  if (!transformResults.length) {
93
93
  const warnings = getWarningsFromCode(text);
94
- return Object.assign(Object.assign({}, processIgnore(warnings.warnings, warnings.kind, stripStyleElements, ignoreComments, context)), { kind: warnings.kind, stripStyleElements });
94
+ return {
95
+ ...processIgnore(warnings.warnings, warnings.kind, stripStyleElements, ignoreComments, context),
96
+ kind: warnings.kind,
97
+ stripStyleElements,
98
+ };
95
99
  }
96
100
  class RemapContext {
97
101
  constructor() {
@@ -131,20 +135,20 @@ function getSvelteCompileWarningsWithoutCache(context) {
131
135
  this.mapIndexes.push({
132
136
  range: [codeStart, this.code.length],
133
137
  remap: (index) => {
134
- outputLocs = outputLocs !== null && outputLocs !== void 0 ? outputLocs : new lines_and_columns_1.LinesAndColumns(outputText);
135
- inputLocs = inputLocs !== null && inputLocs !== void 0 ? inputLocs : new lines_and_columns_1.LinesAndColumns(inputText);
138
+ outputLocs = outputLocs ?? new lines_and_columns_1.LinesAndColumns(outputText);
139
+ inputLocs = inputLocs ?? new lines_and_columns_1.LinesAndColumns(inputText);
136
140
  const outputCodePos = outputLocs.getLocFromIndex(index - codeStart);
137
141
  const inputCodePos = remapPosition(outputCodePos);
138
142
  return inputLocs.getIndexFromLoc(inputCodePos) + start;
139
143
  },
140
144
  });
141
145
  function remapPosition(pos) {
142
- decoded = decoded !== null && decoded !== void 0 ? decoded : (0, sourcemap_codec_1.decode)(output.mappings);
146
+ decoded = decoded ?? (0, sourcemap_codec_1.decode)(output.mappings);
143
147
  const lineMaps = decoded[pos.line - 1];
144
- if (!(lineMaps === null || lineMaps === void 0 ? void 0 : lineMaps.length)) {
148
+ if (!lineMaps?.length) {
145
149
  for (let line = pos.line - 1; line >= 0; line--) {
146
150
  const prevLineMaps = decoded[line];
147
- if (prevLineMaps === null || prevLineMaps === void 0 ? void 0 : prevLineMaps.length) {
151
+ if (prevLineMaps?.length) {
148
152
  const [, , sourceCodeLine, sourceCodeColumn] = prevLineMaps[prevLineMaps.length - 1];
149
153
  return {
150
154
  line: sourceCodeLine + 1,
@@ -172,9 +176,8 @@ function getSvelteCompileWarningsWithoutCache(context) {
172
176
  }
173
177
  }
174
178
  remapLocs(points) {
175
- var _a;
176
179
  const mapIndexes = this.mapIndexes;
177
- const locs = (this.locs = (_a = this.locs) !== null && _a !== void 0 ? _a : new lines_and_columns_1.LinesAndColumns(this.code));
180
+ const locs = (this.locs = this.locs ?? new lines_and_columns_1.LinesAndColumns(this.code));
178
181
  let start = undefined;
179
182
  let end = undefined;
180
183
  if (points.start) {
@@ -229,7 +232,11 @@ function getSvelteCompileWarningsWithoutCache(context) {
229
232
  },
230
233
  });
231
234
  }
232
- return Object.assign(Object.assign({}, processIgnore(warnings, baseWarnings.kind, stripStyleElements, ignoreComments, context)), { kind: baseWarnings.kind, stripStyleElements });
235
+ return {
236
+ ...processIgnore(warnings, baseWarnings.kind, stripStyleElements, ignoreComments, context),
237
+ kind: baseWarnings.kind,
238
+ stripStyleElements,
239
+ };
233
240
  }
234
241
  function* extractStyleElementsWithLangOtherThanCSS(context) {
235
242
  const sourceCode = context.getSourceCode();
@@ -376,18 +383,17 @@ function processIgnore(warnings, kind, stripStyleElements, ignoreComments, conte
376
383
  if (start != null && end != null) {
377
384
  return Math.floor(start + (end - start) / 2);
378
385
  }
379
- return start !== null && start !== void 0 ? start : end;
386
+ return start ?? end;
380
387
  }
381
388
  }
382
389
  function isUseTypeScript(context) {
383
- var _a;
384
390
  if (context.parserServices.esTreeNodeToTSNodeMap)
385
391
  return true;
386
392
  const sourceCode = context.getSourceCode();
387
393
  const root = sourceCode.ast;
388
394
  for (const node of root.body) {
389
395
  if (node.type === "SvelteScriptElement") {
390
- const lang = (_a = (0, ast_utils_1.getLangValue)(node)) === null || _a === void 0 ? void 0 : _a.toLowerCase();
396
+ const lang = (0, ast_utils_1.getLangValue)(node)?.toLowerCase();
391
397
  if (lang === "ts" || lang === "typescript") {
392
398
  return true;
393
399
  }
@@ -396,8 +402,7 @@ function isUseTypeScript(context) {
396
402
  return false;
397
403
  }
398
404
  function isUseBabel(context) {
399
- var _a, _b, _c;
400
- const parser = (_a = context.parserOptions) === null || _a === void 0 ? void 0 : _a.parser;
405
+ const parser = context.parserOptions?.parser;
401
406
  if (!parser) {
402
407
  return false;
403
408
  }
@@ -406,7 +411,7 @@ function isUseBabel(context) {
406
411
  let scriptLang = "js";
407
412
  for (const node of root.body) {
408
413
  if (node.type === "SvelteScriptElement") {
409
- const lang = (_b = (0, ast_utils_1.getLangValue)(node)) === null || _b === void 0 ? void 0 : _b.toLowerCase();
414
+ const lang = (0, ast_utils_1.getLangValue)(node)?.toLowerCase();
410
415
  if (lang === "ts" || lang === "typescript") {
411
416
  scriptLang = lang;
412
417
  break;
@@ -426,10 +431,10 @@ function isUseBabel(context) {
426
431
  const pkgPath = path_1.default.join(targetPath, "package.json");
427
432
  if (fs_1.default.existsSync(pkgPath)) {
428
433
  try {
429
- return (((_c = JSON.parse(fs_1.default.readFileSync(pkgPath, "utf-8"))) === null || _c === void 0 ? void 0 : _c.name) ===
434
+ return (JSON.parse(fs_1.default.readFileSync(pkgPath, "utf-8"))?.name ===
430
435
  "@babel/eslint-parser");
431
436
  }
432
- catch (_d) {
437
+ catch {
433
438
  return false;
434
439
  }
435
440
  }
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hasBabel = exports.transform = void 0;
4
4
  const load_module_1 = require("./load-module");
5
5
  function transform(node, context) {
6
- var _a, _b;
7
6
  const babel = loadBabel(context);
8
7
  if (!babel) {
9
8
  return null;
@@ -23,7 +22,7 @@ function transform(node, context) {
23
22
  minified: false,
24
23
  ast: false,
25
24
  code: true,
26
- cwd: (_b = (_a = context.getCwd) === null || _a === void 0 ? void 0 : _a.call(context)) !== null && _b !== void 0 ? _b : process.cwd(),
25
+ cwd: context.getCwd?.() ?? process.cwd(),
27
26
  });
28
27
  if (!output) {
29
28
  return null;
@@ -22,15 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
35
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
27
  };
@@ -41,7 +32,6 @@ const path_1 = __importDefault(require("path"));
41
32
  const cache = new WeakMap();
42
33
  const cache4b = new Map();
43
34
  function loadModule(context, name) {
44
- var _a, _b;
45
35
  const key = context.getSourceCode().ast;
46
36
  let modules = cache.get(key);
47
37
  if (!modules) {
@@ -52,23 +42,21 @@ function loadModule(context, name) {
52
42
  if (mod)
53
43
  return mod;
54
44
  try {
55
- const cwd = (_b = (_a = context.getCwd) === null || _a === void 0 ? void 0 : _a.call(context)) !== null && _b !== void 0 ? _b : process.cwd();
45
+ const cwd = context.getCwd?.() ?? process.cwd();
56
46
  const relativeTo = path_1.default.join(cwd, "__placeholder__.js");
57
47
  return (modules[name] = module_1.default.createRequire(relativeTo)(name));
58
48
  }
59
- catch (_c) {
49
+ catch {
60
50
  return null;
61
51
  }
62
52
  }
63
53
  exports.loadModule = loadModule;
64
- function loadModulesForBrowser() {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- const [sass, typescript] = yield Promise.all([
67
- Promise.resolve().then(() => __importStar(require("sass"))),
68
- Promise.resolve().then(() => __importStar(require("typescript"))),
69
- ]);
70
- cache4b.set("sass", sass);
71
- cache4b.set("typescript", typescript);
72
- });
54
+ async function loadModulesForBrowser() {
55
+ const [sass, typescript] = await Promise.all([
56
+ Promise.resolve().then(() => __importStar(require("sass"))),
57
+ Promise.resolve().then(() => __importStar(require("typescript"))),
58
+ ]);
59
+ cache4b.set("sass", sass);
60
+ cache4b.set("typescript", typescript);
73
61
  }
74
62
  exports.loadModulesForBrowser = loadModulesForBrowser;
@@ -7,8 +7,7 @@ exports.transform = void 0;
7
7
  const postcss_1 = __importDefault(require("postcss"));
8
8
  const postcss_load_config_1 = __importDefault(require("postcss-load-config"));
9
9
  function transform(node, context) {
10
- var _a, _b, _c, _d, _e;
11
- const postcssConfig = (_c = (_b = (_a = context.settings) === null || _a === void 0 ? void 0 : _a.svelte) === null || _b === void 0 ? void 0 : _b.compileOptions) === null || _c === void 0 ? void 0 : _c.postcss;
10
+ const postcssConfig = context.settings?.svelte?.compileOptions?.postcss;
12
11
  if (postcssConfig === false) {
13
12
  return null;
14
13
  }
@@ -22,14 +21,17 @@ function transform(node, context) {
22
21
  const code = context.getSourceCode().text.slice(...inputRange);
23
22
  const filename = `${context.getFilename()}.css`;
24
23
  try {
25
- const configFilePath = postcssConfig === null || postcssConfig === void 0 ? void 0 : postcssConfig.configFilePath;
24
+ const configFilePath = postcssConfig?.configFilePath;
26
25
  const config = postcss_load_config_1.default.sync({
27
- cwd: (_e = (_d = context.getCwd) === null || _d === void 0 ? void 0 : _d.call(context)) !== null && _e !== void 0 ? _e : process.cwd(),
26
+ cwd: context.getCwd?.() ?? process.cwd(),
28
27
  from: filename,
29
28
  }, typeof configFilePath === "string" ? configFilePath : undefined);
30
- const result = (0, postcss_1.default)(config.plugins).process(code, Object.assign(Object.assign({}, config.options), { map: {
29
+ const result = (0, postcss_1.default)(config.plugins).process(code, {
30
+ ...config.options,
31
+ map: {
31
32
  inline: false,
32
- } }));
33
+ },
34
+ });
33
35
  return {
34
36
  inputRange,
35
37
  output: result.content,
@@ -30,7 +30,7 @@ function transform(node, context) {
30
30
  mappings: JSON.parse(output.sourceMapText).mappings,
31
31
  };
32
32
  }
33
- catch (_a) {
33
+ catch {
34
34
  return null;
35
35
  }
36
36
  }
package/lib/types.d.ts CHANGED
@@ -27,6 +27,7 @@ export interface RuleMetaData {
27
27
  ruleId: string;
28
28
  ruleName: string;
29
29
  default?: "error" | "warn";
30
+ conflictWithPrettier?: boolean;
30
31
  };
31
32
  messages: {
32
33
  [messageId: string]: string;
@@ -44,11 +45,16 @@ export interface PartialRuleModule {
44
45
  export interface PartialRuleMetaData {
45
46
  docs: {
46
47
  description: string;
47
- category: RuleCategory;
48
48
  recommended: boolean | "base";
49
49
  extensionRule?: string;
50
50
  default?: "error" | "warn";
51
- };
51
+ } & ({
52
+ category: Exclude<RuleCategory, "Stylistic Issues">;
53
+ conflictWithPrettier?: boolean;
54
+ } | {
55
+ category: "Stylistic Issues";
56
+ conflictWithPrettier: boolean;
57
+ });
52
58
  messages: {
53
59
  [messageId: string]: string;
54
60
  };
@@ -13,18 +13,17 @@ function safeParseCss(css) {
13
13
  parser.parse();
14
14
  return parser.root;
15
15
  }
16
- catch (_a) {
16
+ catch {
17
17
  return null;
18
18
  }
19
19
  }
20
20
  const cache = new WeakMap();
21
21
  function parseStyleAttributeValue(node, context) {
22
- var _a;
23
22
  if (cache.has(node)) {
24
23
  return cache.get(node) || null;
25
24
  }
26
25
  cache.set(node, null);
27
- if (!((_a = node.value) === null || _a === void 0 ? void 0 : _a.length)) {
26
+ if (!node.value?.length) {
28
27
  return null;
29
28
  }
30
29
  const startOffset = node.value[0].range[0];
@@ -92,7 +91,7 @@ function convertRoot(root, interpolations, getRange, ctx) {
92
91
  if (range) {
93
92
  return range;
94
93
  }
95
- return range !== null && range !== void 0 ? range : (range = getRange(tagOrExpr));
94
+ return range ?? (range = getRange(tagOrExpr));
96
95
  }
97
96
  return {
98
97
  type: "inline",
@@ -132,7 +131,10 @@ function convertRoot(root, interpolations, getRange, ctx) {
132
131
  if (!root) {
133
132
  return null;
134
133
  }
135
- converted = convertRoot(root, [], () => [0, 0], Object.assign(Object.assign({}, ctx), { startOffset: node.range[0] + 1 }));
134
+ converted = convertRoot(root, [], () => [0, 0], {
135
+ ...ctx,
136
+ startOffset: node.range[0] + 1,
137
+ });
136
138
  }
137
139
  else if (node.type === "TemplateLiteral") {
138
140
  const root = safeParseCss(sourceCode.getText(node).slice(1, -1));
@@ -145,7 +147,10 @@ function convertRoot(root, interpolations, getRange, ctx) {
145
147
  node.quasis[index].range[1] - 2,
146
148
  node.quasis[index + 1].range[0] + 1,
147
149
  ];
148
- }, Object.assign(Object.assign({}, ctx), { startOffset: node.range[0] + 1 }));
150
+ }, {
151
+ ...ctx,
152
+ startOffset: node.range[0] + 1,
153
+ });
149
154
  }
150
155
  else {
151
156
  return null;
@@ -175,14 +180,13 @@ function convertRoot(root, interpolations, getRange, ctx) {
175
180
  }
176
181
  }
177
182
  function convertChild(node, ctx) {
178
- var _a;
179
183
  const range = convertRange(node, ctx);
180
184
  if (node.type === "decl") {
181
185
  const propRange = [range[0], range[0] + node.prop.length];
182
186
  const declValueStartIndex = propRange[1] + (node.raws.between || "").length;
183
187
  const valueRange = [
184
188
  declValueStartIndex,
185
- declValueStartIndex + (((_a = node.raws.value) === null || _a === void 0 ? void 0 : _a.value) || node.value).length,
189
+ declValueStartIndex + (node.raws.value?.value || node.value).length,
186
190
  ];
187
191
  const prop = {
188
192
  name: node.prop,
@@ -6,8 +6,7 @@ function hasVendorPrefix(prop) {
6
6
  }
7
7
  exports.hasVendorPrefix = hasVendorPrefix;
8
8
  function getVendorPrefix(prop) {
9
- var _a;
10
- return ((_a = /^-\w+-/u.exec(prop)) === null || _a === void 0 ? void 0 : _a[0]) || "";
9
+ return /^-\w+-/u.exec(prop)?.[0] || "";
11
10
  }
12
11
  exports.getVendorPrefix = getVendorPrefix;
13
12
  function stripVendorPrefix(prop) {
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCoreRule = exports.buildProxyListener = exports.getProxyNode = exports.defineWrapperListener = void 0;
4
4
  const eslint_1 = require("eslint");
5
5
  function defineWrapperListener(coreRule, context, proxyOptions) {
6
- var _a, _b;
7
6
  const listener = coreRule.create(context);
8
- const svelteListener = (_b = (_a = proxyOptions.createListenerProxy) === null || _a === void 0 ? void 0 : _a.call(proxyOptions, listener)) !== null && _b !== void 0 ? _b : listener;
7
+ const svelteListener = proxyOptions.createListenerProxy?.(listener) ?? listener;
9
8
  return svelteListener;
10
9
  }
11
10
  exports.defineWrapperListener = defineWrapperListener;
@@ -3,7 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createRule = void 0;
4
4
  function createRule(ruleName, rule) {
5
5
  return {
6
- meta: Object.assign(Object.assign({}, rule.meta), { docs: Object.assign(Object.assign({}, rule.meta.docs), { url: `https://ota-meshi.github.io/eslint-plugin-svelte/rules/${ruleName}/`, ruleId: `svelte/${ruleName}`, ruleName }) }),
6
+ meta: {
7
+ ...rule.meta,
8
+ docs: {
9
+ ...rule.meta.docs,
10
+ url: `https://ota-meshi.github.io/eslint-plugin-svelte/rules/${ruleName}/`,
11
+ ruleId: `svelte/${ruleName}`,
12
+ ruleName,
13
+ },
14
+ },
7
15
  create: rule.create,
8
16
  };
9
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-svelte",
3
- "version": "2.1.1",
3
+ "version": "2.2.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",
@@ -43,7 +43,7 @@
43
43
  "prepublishOnly": "yarn clean && yarn build",
44
44
  "pretest:base": "cross-env DEBUG=eslint-plugin-svelte*",
45
45
  "preversion": "yarn test && git add .",
46
- "svelte-kit": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/@sveltejs/kit/svelte-kit.js",
46
+ "svelte-kit": "node --experimental-loader ./svelte-kit-import-hook.mjs node_modules/vite/bin/vite.js --config vite.config.mjs",
47
47
  "test": "yarn mocha \"tests/src/**/*.ts\" --reporter dot --timeout 60000",
48
48
  "ts": "node -r esbuild-register",
49
49
  "update": "yarn ts ./tools/update.ts && yarn format-for-gen-file",
@@ -77,7 +77,7 @@
77
77
  "@ota-meshi/eslint-plugin": "^0.11.0",
78
78
  "@sindresorhus/slugify": "^2.1.0",
79
79
  "@sveltejs/adapter-static": "^1.0.0-next.26",
80
- "@sveltejs/kit": "1.0.0-next.358",
80
+ "@sveltejs/kit": "^1.0.0-next.360",
81
81
  "@types/babel__core": "^7.1.19",
82
82
  "@types/eslint": "^8.0.0",
83
83
  "@types/eslint-scope": "^3.7.0",
@@ -134,6 +134,7 @@
134
134
  "svelte": "^3.46.1",
135
135
  "svelte-adapter-ghpages": "0.0.2",
136
136
  "typescript": "^4.5.2",
137
+ "vite": "^2.9.13",
137
138
  "vite-plugin-svelte-md": "^0.1.3"
138
139
  },
139
140
  "publishConfig": {