eslint-plugin-svelte 2.34.0 → 2.34.1

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/lib/meta.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const name: "eslint-plugin-svelte";
2
- export declare const version: "2.34.0";
2
+ export declare const version: "2.34.1";
package/lib/meta.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = 'eslint-plugin-svelte';
5
- exports.version = '2.34.0';
5
+ exports.version = '2.34.1';
@@ -89,7 +89,7 @@ function getSvelteCompileWarningsWithoutCache(context) {
89
89
  const text = buildStrippedText(context, ignoreComments, stripStyleTokens);
90
90
  transformResults.push(...transformScripts(context, text));
91
91
  if (!transformResults.length) {
92
- const warnings = getWarningsFromCode(text);
92
+ const warnings = getWarningsFromCode(text, context);
93
93
  return {
94
94
  ...processIgnore(warnings.warnings, warnings.kind, stripStyleElements, ignoreComments, context),
95
95
  kind: warnings.kind,
@@ -209,7 +209,7 @@ function getSvelteCompileWarningsWithoutCache(context) {
209
209
  remapContext.appendTranspile(result);
210
210
  }
211
211
  const code = remapContext.postprocess();
212
- const baseWarnings = getWarningsFromCode(code);
212
+ const baseWarnings = getWarningsFromCode(code, context);
213
213
  const warnings = [];
214
214
  for (const warn of baseWarnings.warnings) {
215
215
  let loc = null;
@@ -287,11 +287,26 @@ function* transformScripts(context, text) {
287
287
  }
288
288
  }
289
289
  }
290
- function getWarningsFromCode(code) {
290
+ function hasTagOption(program) {
291
+ return program.body.some((body) => {
292
+ if (body.type !== 'SvelteElement' || body.kind !== 'special') {
293
+ return false;
294
+ }
295
+ if (body.name.name !== 'svelte:options') {
296
+ return false;
297
+ }
298
+ return Boolean((0, ast_utils_1.findAttribute)(body, 'tag'));
299
+ });
300
+ }
301
+ function getWarningsFromCode(code, context) {
291
302
  try {
292
303
  const result = compiler.compile(code, {
293
304
  generate: false,
294
- ...(semver_1.default.satisfies(compiler.VERSION, '>=4.0.0-0') ? { customElement: true } : {})
305
+ ...(semver_1.default.satisfies(compiler.VERSION, '>=4.0.0-0')
306
+ ? { customElement: true }
307
+ : hasTagOption(context.getSourceCode().ast)
308
+ ? { customElement: true }
309
+ : {})
295
310
  });
296
311
  return { warnings: result.warnings, kind: 'warn' };
297
312
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-svelte",
3
- "version": "2.34.0",
3
+ "version": "2.34.1",
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",
@@ -39,7 +39,7 @@
39
39
  "@jridgewell/sourcemap-codec": "^1.4.14",
40
40
  "debug": "^4.3.1",
41
41
  "esutils": "^2.0.3",
42
- "known-css-properties": "^0.28.0",
42
+ "known-css-properties": "^0.29.0",
43
43
  "postcss": "^8.4.5",
44
44
  "postcss-load-config": "^3.1.4",
45
45
  "postcss-safe-parser": "^6.0.0",
@@ -76,13 +76,13 @@
76
76
  "@types/markdown-it-container": "^2.0.5",
77
77
  "@types/markdown-it-emoji": "^2.0.2",
78
78
  "@types/mocha": "^10.0.0",
79
- "@types/node": "^18.11.0",
79
+ "@types/node": "^20.0.0",
80
80
  "@types/postcss-safe-parser": "^5.0.1",
81
81
  "@types/prismjs": "^1.26.0",
82
82
  "@types/semver": "^7.5.0",
83
83
  "@types/stylus": "^0.48.38",
84
- "@typescript-eslint/eslint-plugin": "^6.0.0",
85
- "@typescript-eslint/parser": "^6.0.0",
84
+ "@typescript-eslint/eslint-plugin": "^6.9.0",
85
+ "@typescript-eslint/parser": "^6.9.0",
86
86
  "@typescript/vfs": "^1.4.0",
87
87
  "acorn": "^8.8.2",
88
88
  "assert": "^2.0.0",
@@ -103,7 +103,7 @@
103
103
  "eslint-plugin-n": "^16.0.0",
104
104
  "eslint-plugin-node-dependencies": "^0.11.0",
105
105
  "eslint-plugin-prettier": "^5.0.0",
106
- "eslint-plugin-regexp": "^1.0.0",
106
+ "eslint-plugin-regexp": "^2.0.0",
107
107
  "eslint-plugin-svelte": "^2.28.0",
108
108
  "eslint-plugin-yml": "^1.0.0",
109
109
  "eslint-scope": "^7.1.1",
@@ -134,7 +134,7 @@
134
134
  "stylus": "^0.60.0",
135
135
  "svelte": "^4.0.0",
136
136
  "svelte-adapter-ghpages": "0.1.0",
137
- "svelte-i18n": "^3.6.0",
137
+ "svelte-i18n": "^4.0.0",
138
138
  "tslib": "^2.5.0",
139
139
  "type-coverage": "^2.22.0",
140
140
  "typescript": "~5.1.0",