eslint-plugin-svelte 3.2.0 → 3.2.2

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
@@ -48,7 +48,7 @@ npm install --save-dev svelte eslint eslint-plugin-svelte globals
48
48
  > **Requirements:**
49
49
  >
50
50
  > - ESLint v8.57.1, v9.0.0, and above
51
- > - Node.js v18.20.4, v20.18.0, v22.10.0, and above
51
+ > - Node.js v18.18.0, v20.9.0, v21.1.0 and above
52
52
 
53
53
  ## Usage
54
54
 
package/lib/main.d.ts CHANGED
@@ -14,7 +14,7 @@ export declare const configs: {
14
14
  export declare const rules: Record<string, Rule.RuleModule>;
15
15
  export declare const meta: {
16
16
  name: "eslint-plugin-svelte";
17
- version: "3.2.0";
17
+ version: "3.2.2";
18
18
  };
19
19
  export declare const processors: {
20
20
  '.svelte': typeof processor;
package/lib/meta.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const name = "eslint-plugin-svelte";
2
- export declare const version = "3.2.0";
2
+ export declare const version = "3.2.2";
package/lib/meta.js CHANGED
@@ -2,4 +2,4 @@
2
2
  // This file has been automatically generated,
3
3
  // in order to update its content execute "pnpm run update"
4
4
  export const name = 'eslint-plugin-svelte';
5
- export const version = '3.2.0';
5
+ export const version = '3.2.2';
@@ -69,15 +69,11 @@ export default createRule('no-unused-props', {
69
69
  const symbolName = symbol?.getName();
70
70
  return shouldIgnore(typeStr) || (symbolName ? shouldIgnore(symbolName) : false);
71
71
  }
72
- function isExternalType(type) {
73
- const symbol = type.getSymbol();
74
- if (!symbol)
75
- return false;
72
+ function isInternalProperty(symbol) {
76
73
  const declarations = symbol.getDeclarations();
77
74
  if (!declarations || declarations.length === 0)
78
75
  return false;
79
- const sourceFile = declarations[0].getSourceFile();
80
- return sourceFile.fileName !== fileName;
76
+ return declarations.every((decl) => decl.getSourceFile().fileName === fileName);
81
77
  }
82
78
  /**
83
79
  * Extracts property paths from member expressions.
@@ -179,8 +175,6 @@ export default createRule('no-unused-props', {
179
175
  checkedTypes.add(typeStr);
180
176
  if (shouldIgnoreType(type))
181
177
  return;
182
- if (!checkImportedTypes && isExternalType(type))
183
- return;
184
178
  const properties = typeChecker.getPropertiesOfType(type);
185
179
  const baseTypes = type.getBaseTypes();
186
180
  if (!properties.length && (!baseTypes || baseTypes.length === 0)) {
@@ -194,6 +188,8 @@ export default createRule('no-unused-props', {
194
188
  for (const prop of properties) {
195
189
  if (isBuiltInProperty(prop))
196
190
  continue;
191
+ if (!checkImportedTypes && !isInternalProperty(prop))
192
+ continue;
197
193
  const propName = prop.getName();
198
194
  const currentPath = [...parentPath, propName];
199
195
  const currentPathStr = [...parentPath, propName].join('.');
@@ -267,7 +263,7 @@ export default createRule('no-unused-props', {
267
263
  .filter((v) => v.type === 'Identifier');
268
264
  for (const identifier of identifiers) {
269
265
  const paths = getUsedNestedPropertyNames(identifier);
270
- usedPaths.push(...paths);
266
+ usedPaths.push(...paths.map((path) => [identifier.name, ...path]));
271
267
  }
272
268
  }
273
269
  else if (node.id.type === 'Identifier') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-svelte",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
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",