@eslint-react/var 5.11.3 → 5.12.0-beta.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/dist/index.d.ts CHANGED
@@ -143,6 +143,6 @@ declare function resolveEnclosingAssignmentTarget(node: TSESTree.Node): TSESTree
143
143
  type AssignmentTarget = ReturnType<typeof resolveEnclosingAssignmentTarget>;
144
144
  //#endregion
145
145
  //#region src/resolve-import-source.d.ts
146
- declare function resolveImportSource(name: string, initialScope: Scope, visited?: Set<string>): string | null;
146
+ declare function resolveImportSource(name: string, initialScope: Scope, seen?: Set<string>): string | null;
147
147
  //#endregion
148
148
  export { AssignmentTarget, ObjectType, computeObjectType, getRequireExpressionArguments, isAssignmentTargetEqual, isInitializedFromReact, isInitializedFromReactNative, isValueEqual, resolve, resolveEnclosingAssignmentTarget, resolveImportSource };
package/dist/index.js CHANGED
@@ -277,16 +277,16 @@ function isAssignmentTargetEqual(context, a, b) {
277
277
 
278
278
  //#endregion
279
279
  //#region src/resolve-import-source.ts
280
- function resolveImportSource(name, initialScope, visited = /* @__PURE__ */ new Set()) {
281
- if (visited.has(name)) return null;
282
- visited.add(name);
280
+ function resolveImportSource(name, initialScope, seen = /* @__PURE__ */ new Set()) {
281
+ if (seen.has(name)) return null;
282
+ seen.add(name);
283
283
  const latestDef = findVariable(initialScope, name)?.defs.at(-1);
284
284
  if (latestDef == null) return null;
285
285
  const { node, parent } = latestDef;
286
286
  if (node.type === AST_NODE_TYPES.VariableDeclarator && node.init != null) {
287
287
  const init = Extract.unwrap(node.init);
288
- if (init.type === AST_NODE_TYPES.MemberExpression && init.object.type === AST_NODE_TYPES.Identifier) return resolveImportSource(init.object.name, initialScope, visited);
289
- if (init.type === AST_NODE_TYPES.Identifier) return resolveImportSource(init.name, initialScope, visited);
288
+ if (init.type === AST_NODE_TYPES.MemberExpression && init.object.type === AST_NODE_TYPES.Identifier) return resolveImportSource(init.object.name, initialScope, seen);
289
+ if (init.type === AST_NODE_TYPES.Identifier) return resolveImportSource(init.name, initialScope, seen);
290
290
  const arg0 = getRequireExpressionArguments(init)?.[0];
291
291
  if (arg0 == null || !isMatching({
292
292
  type: AST_NODE_TYPES.Literal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/var",
3
- "version": "5.11.3",
3
+ "version": "5.12.0-beta.1",
4
4
  "description": "ESLint React's TSESTree AST utility module for static analysis of variables.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -33,8 +33,8 @@
33
33
  "@typescript-eslint/types": "^8.62.1",
34
34
  "@typescript-eslint/utils": "^8.62.1",
35
35
  "ts-pattern": "^5.9.0",
36
- "@eslint-react/ast": "5.11.3",
37
- "@eslint-react/eslint": "5.11.3"
36
+ "@eslint-react/ast": "5.12.0-beta.1",
37
+ "@eslint-react/eslint": "5.12.0-beta.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@typescript-eslint/parser": "^8.62.1",
@@ -43,8 +43,8 @@
43
43
  "tsdown": "^0.22.3",
44
44
  "typescript": "6.0.3",
45
45
  "vitest": "^4.1.9",
46
- "@local/eff": "0.0.0",
47
- "@local/configs": "0.0.0"
46
+ "@local/configs": "0.0.0",
47
+ "@local/eff": "0.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "eslint": "*",