eslint-plugin-svelte 2.37.0 → 2.38.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 CHANGED
@@ -74,7 +74,7 @@ Use `eslint.config.js` file to configure rules. See also: <https://eslint.org/do
74
74
 
75
75
  Example **eslint.config.js**:
76
76
 
77
- ```mjs
77
+ ```js
78
78
  import eslintPluginSvelte from 'eslint-plugin-svelte';
79
79
  export default [
80
80
  // add more generic rule sets here, such as:
package/lib/meta.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const name = "eslint-plugin-svelte";
2
- export declare const version = "2.37.0";
2
+ export declare const version = "2.38.0";
package/lib/meta.js CHANGED
@@ -5,4 +5,4 @@ exports.version = exports.name = void 0;
5
5
  // This file has been automatically generated,
6
6
  // in order to update its content execute "pnpm run update"
7
7
  exports.name = 'eslint-plugin-svelte';
8
- exports.version = '2.37.0';
8
+ exports.version = '2.38.0';
@@ -409,7 +409,12 @@ type SvelteNoInlineStyles = [] | [
409
409
  allowTransitions?: boolean;
410
410
  }
411
411
  ];
412
- type SvelteNoInnerDeclarations = [] | [("functions" | "both")];
412
+ type SvelteNoInnerDeclarations = [] | [("functions" | "both")] | [
413
+ ("functions" | "both"),
414
+ {
415
+ blockScopedFunctions?: ("allow" | "disallow");
416
+ }
417
+ ];
413
418
  type SvelteNoReactiveReassign = [] | [
414
419
  {
415
420
  props?: boolean;
@@ -121,34 +121,32 @@ exports.default = (0, utils_1.createRule)('comment-directive', {
121
121
  });
122
122
  }
123
123
  }
124
- else {
125
- if (parsed.rules.length) {
126
- for (const rule of parsed.rules) {
127
- if (reportUnusedDisableDirectives) {
128
- context.report({
129
- loc: rule.loc,
130
- messageId: 'unusedEnableRule',
131
- data: { rule: rule.ruleId, kind: parsed.type }
132
- });
133
- }
134
- directives.enableBlock(comment.loc.start, rule.ruleId, {
135
- loc: rule.loc.start
136
- });
137
- }
138
- }
139
- else {
124
+ else if (parsed.rules.length) {
125
+ for (const rule of parsed.rules) {
140
126
  if (reportUnusedDisableDirectives) {
141
127
  context.report({
142
- loc: comment.loc,
143
- messageId: 'unusedEnable',
144
- data: { kind: parsed.type }
128
+ loc: rule.loc,
129
+ messageId: 'unusedEnableRule',
130
+ data: { rule: rule.ruleId, kind: parsed.type }
145
131
  });
146
132
  }
147
- directives.enableBlock(comment.loc.start, ALL_RULES, {
148
- loc: comment.loc.start
133
+ directives.enableBlock(comment.loc.start, rule.ruleId, {
134
+ loc: rule.loc.start
149
135
  });
150
136
  }
151
137
  }
138
+ else {
139
+ if (reportUnusedDisableDirectives) {
140
+ context.report({
141
+ loc: comment.loc,
142
+ messageId: 'unusedEnable',
143
+ data: { kind: parsed.type }
144
+ });
145
+ }
146
+ directives.enableBlock(comment.loc.start, ALL_RULES, {
147
+ loc: comment.loc.start
148
+ });
149
+ }
152
150
  }
153
151
  }
154
152
  /**
@@ -58,10 +58,8 @@ exports.default = (0, utils_1.createRule)('first-attribute-linebreak', {
58
58
  return;
59
59
  }
60
60
  }
61
- else {
62
- if (node.parent.name.loc.end.line < firstAttribute.loc.start.line) {
63
- return;
64
- }
61
+ else if (node.parent.name.loc.end.line < firstAttribute.loc.start.line) {
62
+ return;
65
63
  }
66
64
  report(firstAttribute, location);
67
65
  }
@@ -66,7 +66,6 @@ function defineVisitor(context) {
66
66
  // ----------------------------------------------------------------------
67
67
  // ATTRIBUTES
68
68
  // ----------------------------------------------------------------------
69
- // eslint-disable-next-line complexity -- X(
70
69
  SvelteAttribute(node) {
71
70
  const keyToken = sourceCode.getFirstToken(node);
72
71
  const eqToken = sourceCode.getTokenAfter(node.key);
@@ -781,7 +781,6 @@ function defineVisitor(context) {
781
781
  }
782
782
  }
783
783
  },
784
- // eslint-disable-next-line complexity -- ignore
785
784
  '*[type=/^TS/]'(node) {
786
785
  if (node.type !== 'TSAnyKeyword' &&
787
786
  node.type !== 'TSArrayType' &&
@@ -74,17 +74,15 @@ exports.default = (0, utils_1.createRule)('mustache-spacing', {
74
74
  });
75
75
  }
76
76
  }
77
- else {
78
- if (openingBrace.range[1] !== firstToken.range[0]) {
79
- context.report({
80
- loc: {
81
- start: openingBrace.loc.start,
82
- end: firstToken.loc.start
83
- },
84
- messageId: 'unexpectedOpening',
85
- fix: (fixer) => fixer.removeRange([openingBrace.range[1], firstToken.range[0]])
86
- });
87
- }
77
+ else if (openingBrace.range[1] !== firstToken.range[0]) {
78
+ context.report({
79
+ loc: {
80
+ start: openingBrace.loc.start,
81
+ end: firstToken.loc.start
82
+ },
83
+ messageId: 'unexpectedOpening',
84
+ fix: (fixer) => fixer.removeRange([openingBrace.range[1], firstToken.range[0]])
85
+ });
88
86
  }
89
87
  if (!closingBrace) {
90
88
  return;
@@ -102,17 +100,15 @@ exports.default = (0, utils_1.createRule)('mustache-spacing', {
102
100
  });
103
101
  }
104
102
  }
105
- else {
106
- if (closingBrace.range[0] !== lastToken.range[1]) {
107
- context.report({
108
- loc: {
109
- start: lastToken.loc.end,
110
- end: closingBrace.loc.end
111
- },
112
- messageId: 'unexpectedClosing',
113
- fix: (fixer) => fixer.removeRange([lastToken.range[1], closingBrace.range[0]])
114
- });
115
- }
103
+ else if (closingBrace.range[0] !== lastToken.range[1]) {
104
+ context.report({
105
+ loc: {
106
+ start: lastToken.loc.end,
107
+ end: closingBrace.loc.end
108
+ },
109
+ messageId: 'unexpectedClosing',
110
+ fix: (fixer) => fixer.removeRange([lastToken.range[1], closingBrace.range[0]])
111
+ });
116
112
  }
117
113
  }
118
114
  /** Verify for {expr} */
@@ -284,12 +284,10 @@ exports.default = (0, utils_1.createRule)('prefer-class-directive', {
284
284
  break;
285
285
  }
286
286
  }
287
- else {
288
- if (prevIsWord && nextIsWord) {
289
- // The previous and next may be connected.
290
- canTransform = false;
291
- break;
292
- }
287
+ else if (prevIsWord && nextIsWord) {
288
+ // The previous and next may be connected.
289
+ canTransform = false;
290
+ break;
293
291
  }
294
292
  }
295
293
  if (!canTransform) {
@@ -28,8 +28,7 @@ class CommentDirectives {
28
28
  }
29
29
  blockEnableDirectives.add(block);
30
30
  }
31
- else {
32
- // block.kind === "disable"
31
+ else if (block.kind === 'disable') {
33
32
  if (block.targetRule === ALL) {
34
33
  for (const b of blockEnableDirectives) {
35
34
  usedDirectives.add(b);
@@ -444,11 +444,8 @@ function isVoidHtmlElement(node) {
444
444
  return void_elements_1.default.includes(getNodeName(node));
445
445
  }
446
446
  exports.isVoidHtmlElement = isVoidHtmlElement;
447
- /* eslint-disable complexity -- better than refactoring because type guards work well. */
448
447
  /** Checks whether the given identifier node is used as an expression. */
449
- function isExpressionIdentifier(
450
- /* eslint-enable complexity -- :) */
451
- node) {
448
+ function isExpressionIdentifier(node) {
452
449
  const parent = node.parent;
453
450
  if (!parent) {
454
451
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-svelte",
3
- "version": "2.37.0",
3
+ "version": "2.38.0",
4
4
  "description": "ESLint plugin for Svelte using AST",
5
5
  "repository": "git+https://github.com/sveltejs/eslint-plugin-svelte.git",
6
6
  "homepage": "https://sveltejs.github.io/eslint-plugin-svelte",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "peerDependencies": {
30
30
  "eslint": "^7.0.0 || ^8.0.0-0 || ^9.0.0-0",
31
- "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.95"
31
+ "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.112"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  "svelte": {
@@ -47,7 +47,7 @@
47
47
  "postcss-safe-parser": "^6.0.0",
48
48
  "postcss-selector-parser": "^6.0.16",
49
49
  "semver": "^7.6.0",
50
- "svelte-eslint-parser": ">=0.34.0 <1.0.0"
50
+ "svelte-eslint-parser": ">=0.35.0 <1.0.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@1stg/browserslist-config": "^2.0.0",
@@ -59,33 +59,34 @@
59
59
  "@changesets/changelog-github": "^0.5.0",
60
60
  "@changesets/cli": "^2.27.1",
61
61
  "@changesets/get-release-plan": "^4.0.0",
62
+ "@eslint-community/eslint-plugin-eslint-comments": "4.3.0",
62
63
  "@fontsource/fira-mono": "^5.0.12",
63
- "@ota-meshi/eslint-plugin": "^0.15.3",
64
+ "@ota-meshi/eslint-plugin": "^0.17.1",
64
65
  "@sindresorhus/slugify": "^2.2.1",
65
66
  "@sveltejs/adapter-static": "^3.0.1",
66
- "@sveltejs/kit": "^2.5.5",
67
- "@sveltejs/vite-plugin-svelte": "^3.0.2",
67
+ "@sveltejs/kit": "^2.5.6",
68
+ "@sveltejs/vite-plugin-svelte": "^3.1.0",
68
69
  "@types/babel__core": "^7.20.5",
69
70
  "@types/cross-spawn": "^6.0.6",
70
71
  "@types/escape-html": "^1.0.4",
71
- "@types/eslint": "^8.56.7",
72
+ "@types/eslint": "^8.56.10",
72
73
  "@types/eslint-scope": "^3.7.7",
73
74
  "@types/eslint-utils": "^3.0.5",
74
75
  "@types/eslint-visitor-keys": "^3.3.0",
75
76
  "@types/esutils": "^2.0.2",
76
77
  "@types/json-schema": "^7.0.15",
77
78
  "@types/less": "^3.0.6",
78
- "@types/markdown-it": "^14.0.0",
79
+ "@types/markdown-it": "^14.0.1",
79
80
  "@types/markdown-it-container": "^2.0.10",
80
81
  "@types/markdown-it-emoji": "^2.0.5",
81
82
  "@types/mocha": "^10.0.6",
82
- "@types/node": "^20.12.5",
83
+ "@types/node": "^20.12.7",
83
84
  "@types/postcss-safe-parser": "^5.0.4",
84
85
  "@types/prismjs": "^1.26.3",
85
86
  "@types/semver": "^7.5.8",
86
87
  "@types/stylus": "^0.48.42",
87
- "@typescript-eslint/eslint-plugin": "^7.5.0",
88
- "@typescript-eslint/parser": "^7.5.0",
88
+ "@typescript-eslint/eslint-plugin": "^7.7.0",
89
+ "@typescript-eslint/parser": "^7.7.0",
89
90
  "@typescript/vfs": "^1.5.0",
90
91
  "acorn": "^8.11.3",
91
92
  "assert": "^2.1.0",
@@ -94,29 +95,30 @@
94
95
  "esbuild": "^0.20.2",
95
96
  "esbuild-register": "^3.5.0",
96
97
  "escape-html": "^1.0.3",
97
- "eslint": "^8.57.0",
98
+ "eslint": "^9.0.0",
98
99
  "eslint-config-prettier": "^9.1.0",
99
100
  "eslint-formatter-friendly": "^7.0.0",
100
- "eslint-plugin-eslint-comments": "^3.2.0",
101
101
  "eslint-plugin-eslint-plugin": "^6.0.0",
102
+ "eslint-plugin-jsdoc": "^48.2.3",
102
103
  "eslint-plugin-json-schema-validator": "^5.1.0",
103
- "eslint-plugin-jsonc": "^2.15.0",
104
+ "eslint-plugin-jsonc": "^2.15.1",
104
105
  "eslint-plugin-markdown": "^4.0.1",
105
106
  "eslint-plugin-mdx": "^3.1.5",
106
- "eslint-plugin-n": "^16.6.2",
107
+ "eslint-plugin-n": "^17.2.1",
107
108
  "eslint-plugin-node-dependencies": "^0.12.0",
108
109
  "eslint-plugin-prettier": "^5.1.3",
109
- "eslint-plugin-regexp": "^2.4.0",
110
- "eslint-plugin-svelte": "^2.35.1",
110
+ "eslint-plugin-regexp": "^2.5.0",
111
+ "eslint-plugin-svelte": "^2.37.0",
111
112
  "eslint-plugin-yml": "^1.14.0",
112
113
  "eslint-scope": "^8.0.1",
113
- "eslint-typegen": "^0.2.1",
114
+ "eslint-typegen": "^0.2.3",
114
115
  "eslint-visitor-keys": "^4.0.0",
115
116
  "espree": "^10.0.1",
116
117
  "estree-walker": "^3.0.3",
118
+ "globals": "^15.0.0",
117
119
  "less": "^4.2.0",
118
120
  "locate-character": "^3.0.0",
119
- "magic-string": "^0.30.9",
121
+ "magic-string": "^0.30.10",
120
122
  "markdown-it-anchor": "^8.6.7",
121
123
  "markdown-it-container": "^4.0.0",
122
124
  "markdown-it-emoji": "^3.0.0",
@@ -127,22 +129,25 @@
127
129
  "postcss-nested": "^6.0.1",
128
130
  "prettier": "^3.2.5",
129
131
  "prettier-plugin-pkg": "^0.18.1",
130
- "prettier-plugin-svelte": "^3.2.2",
132
+ "prettier-plugin-svelte": "^3.2.3",
131
133
  "prism-svelte": "^0.5.0",
132
134
  "prismjs": "^1.29.0",
133
135
  "rimraf": "^5.0.5",
134
- "sass": "^1.74.1",
136
+ "sass": "^1.75.0",
135
137
  "source-map-js": "^1.2.0",
136
138
  "stylelint": "~16.3.1",
137
139
  "stylelint-config-standard": "^36.0.0",
138
140
  "stylus": "^0.63.0",
139
- "svelte": "^5.0.0-next.95",
141
+ "svelte": "^5.0.0-next.112",
140
142
  "svelte-adapter-ghpages": "0.2.2",
141
143
  "svelte-i18n": "^4.0.0",
142
144
  "tslib": "^2.6.2",
143
145
  "type-coverage": "^2.28.1",
144
- "typescript": "~5.4.4",
145
- "vite": "^5.2.8",
146
+ "typescript": "~5.4.5",
147
+ "typescript-eslint": "^7.7.0",
148
+ "util": "^0.12.5",
149
+ "vite": "^5.2.9",
150
+ "vite-plugin-eslint4b": "^0.4.0",
146
151
  "vite-plugin-svelte-md": "^0.1.7",
147
152
  "yaml": "^2.4.1"
148
153
  },