@eslint-react/var 5.16.0 → 5.17.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/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { TSESTree } from "@typescript-eslint/types";
3
3
  import { RuleContext } from "@eslint-react/eslint";
4
4
  //#region src/compute-object-type.d.ts
5
5
  /**
6
- * Represents the type classification of an object node
6
+ * Represents the type classification of an object node.
7
7
  */
8
8
  type ObjectType = {
9
9
  kind: "jsx";
@@ -32,18 +32,18 @@ type ObjectType = {
32
32
  reason?: string;
33
33
  };
34
34
  /**
35
- * Detect the ObjectType of a given node
36
- * @param context The context of the rule
37
- * @param node The node to check
38
- * @returns The ObjectType of the node, or undefined if not detected
35
+ * Detect the ObjectType of a given node.
36
+ * @param context The context of the rule.
37
+ * @param node The node to check.
38
+ * @returns The ObjectType of the node, or undefined if not detected.
39
39
  */
40
40
  declare function computeObjectType(context: RuleContext, node: TSESTree.Node | null): ObjectType | null;
41
41
  //#endregion
42
42
  //#region src/get-require-expression-arguments.d.ts
43
43
  /**
44
- * Get the arguments of a require expression
45
- * @param node The node to match
46
- * @returns The require expression arguments or null if the node is not a require expression
44
+ * Get the arguments of a require expression.
45
+ * @param node The node to match.
46
+ * @returns The require expression arguments or null if the node is not a require expression.
47
47
  * @internal
48
48
  */
49
49
  declare function getRequireExpressionArguments(node: TSESTree.Node): TSESTree.CallExpressionArgument[] | null;
@@ -51,44 +51,44 @@ declare function getRequireExpressionArguments(node: TSESTree.Node): TSESTree.Ca
51
51
  //#region src/is-assignment-target-equal.d.ts
52
52
  /**
53
53
  * Check if two assignment targets are equal
54
- * Compares nodes directly or by their values
55
- * @param context The rule context
56
- * @param a The first node to compare
57
- * @param b The second node to compare
58
- * @returns True if the assignment targets are equal
54
+ * Compares nodes directly or by their values.
55
+ * @param context The rule context.
56
+ * @param a The first node to compare.
57
+ * @param b The second node to compare.
58
+ * @returns True if the assignment targets are equal.
59
59
  * @internal
60
60
  */
61
61
  declare function isAssignmentTargetEqual(context: RuleContext, a: TSESTree.Node, b: TSESTree.Node): boolean;
62
62
  //#endregion
63
63
  //#region src/is-initialized-from-react.d.ts
64
64
  /**
65
- * Check if a variable is initialized from React import
65
+ * Check if a variable is initialized from React import.
66
66
  * @internal
67
- * @param name The variable name
68
- * @param initialScope The initial scope
69
- * @param importSource Alternative import source of React (ex: "preact/compat")
70
- * @returns True if the variable is initialized or derived from React import
67
+ * @param name The variable name.
68
+ * @param initialScope The initial scope.
69
+ * @param importSource Alternative import source of React (ex: "preact/compat").
70
+ * @returns True if the variable is initialized or derived from React import.
71
71
  */
72
72
  declare function isInitializedFromReact(name: string, initialScope: Scope, importSource?: string): boolean;
73
73
  //#endregion
74
74
  //#region src/is-initialized-from-react-native.d.ts
75
75
  /**
76
- * if a variable is initialized from React Native import
76
+ * if a variable is initialized from React Native import.
77
77
  * @internal
78
- * @param name The variable name
79
- * @param initialScope The initial scope
80
- * @param importSource Alternative import source of React Native (ex: "react-native-web")
81
- * @returns True if the variable is initialized from React Native import
78
+ * @param name The variable name.
79
+ * @param initialScope The initial scope.
80
+ * @param importSource Alternative import source of React Native (ex: "react-native-web").
81
+ * @returns True if the variable is initialized from React Native import.
82
82
  */
83
83
  declare function isInitializedFromReactNative(name: string, initialScope: Scope, importSource?: string): boolean;
84
84
  //#endregion
85
85
  //#region src/is-value-equal.d.ts
86
86
  /**
87
- * Determine whether node value equals to another node value
88
- * @param context rule context
89
- * @param a node to compare
90
- * @param b node to compare
91
- * @returns `true` if node value equal
87
+ * Determine whether node value equals to another node value.
88
+ * @param context rule context.
89
+ * @param a node to compare.
90
+ * @param b node to compare.
91
+ * @returns `true` if node value equal.
92
92
  */
93
93
  declare function isValueEqual(context: RuleContext, a: TSESTree.Node, b: TSESTree.Node): boolean;
94
94
  //#endregion
@@ -130,14 +130,14 @@ declare function resolve(context: RuleContext, node: TSESTree.Identifier, option
130
130
  //#endregion
131
131
  //#region src/resolve-enclosing-assignment-target.d.ts
132
132
  /**
133
- * Finds the enclosing assignment target (variable, property, etc.) for a given node
133
+ * Finds the enclosing assignment target (variable, property, etc.) for a given node.
134
134
  *
135
- * @param node The starting node
136
- * @returns The enclosing assignment target node, or null if not found
135
+ * @param node The starting node.
136
+ * @returns The enclosing assignment target node, or null if not found.
137
137
  */
138
138
  declare function resolveEnclosingAssignmentTarget(node: TSESTree.Node): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.PrivateIdentifier | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.TemplateLiteral | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSDeclareFunctionNoDeclare | TSESTree.TSDeclareFunctionWithDeclare | TSESTree.TSEnumDeclaration | TSESTree.TSInstantiationExpression | TSESTree.TSInterfaceDeclaration | TSESTree.TSModuleDeclarationGlobal | TSESTree.TSModuleDeclarationModuleWithIdentifierId | TSESTree.TSModuleDeclarationModuleWithStringIdDeclared | TSESTree.TSModuleDeclarationModuleWithStringIdNotDeclared | TSESTree.TSModuleDeclarationNamespace | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAliasDeclaration | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.ConstDeclaration | TSESTree.LetOrVarDeclaredDeclaration | TSESTree.LetOrVarNonDeclaredDeclaration | TSESTree.UsingInForOfDeclaration | TSESTree.UsingInNormalContextDeclaration | TSESTree.YieldNoStarExpression | TSESTree.YieldStarExpression | null;
139
139
  /**
140
- * Type representing the possible assignment targets returned by `resolveEnclosingAssignmentTarget`
140
+ * Type representing the possible assignment targets returned by `resolveEnclosingAssignmentTarget`.
141
141
  */
142
142
  type AssignmentTarget = ReturnType<typeof resolveEnclosingAssignmentTarget>;
143
143
  //#endregion
package/dist/index.js CHANGED
@@ -66,10 +66,10 @@ function resolve(context, node, options) {
66
66
  //#endregion
67
67
  //#region src/compute-object-type.ts
68
68
  /**
69
- * Detect the ObjectType of a given node
70
- * @param context The context of the rule
71
- * @param node The node to check
72
- * @returns The ObjectType of the node, or undefined if not detected
69
+ * Detect the ObjectType of a given node.
70
+ * @param context The context of the rule.
71
+ * @param node The node to check.
72
+ * @returns The ObjectType of the node, or undefined if not detected.
73
73
  */
74
74
  function computeObjectType(context, node) {
75
75
  if (node == null) return null;
@@ -177,9 +177,9 @@ function computeObjectType(context, node) {
177
177
  //#endregion
178
178
  //#region src/get-require-expression-arguments.ts
179
179
  /**
180
- * Get the arguments of a require expression
181
- * @param node The node to match
182
- * @returns The require expression arguments or null if the node is not a require expression
180
+ * Get the arguments of a require expression.
181
+ * @param node The node to match.
182
+ * @returns The require expression arguments or null if the node is not a require expression.
183
183
  * @internal
184
184
  */
185
185
  function getRequireExpressionArguments(node) {
@@ -201,11 +201,11 @@ const thisBlockTypes = [
201
201
  AST_NODE_TYPES.Program
202
202
  ];
203
203
  /**
204
- * Determine whether node value equals to another node value
205
- * @param context rule context
206
- * @param a node to compare
207
- * @param b node to compare
208
- * @returns `true` if node value equal
204
+ * Determine whether node value equals to another node value.
205
+ * @param context rule context.
206
+ * @param a node to compare.
207
+ * @param b node to compare.
208
+ * @returns `true` if node value equal.
209
209
  */
210
210
  function isValueEqual(context, a, b) {
211
211
  a = Check.isTypeExpression(a) ? Extract.unwrap(a) : a;
@@ -264,11 +264,11 @@ function isValueEqual(context, a, b) {
264
264
  //#region src/is-assignment-target-equal.ts
265
265
  /**
266
266
  * Check if two assignment targets are equal
267
- * Compares nodes directly or by their values
268
- * @param context The rule context
269
- * @param a The first node to compare
270
- * @param b The second node to compare
271
- * @returns True if the assignment targets are equal
267
+ * Compares nodes directly or by their values.
268
+ * @param context The rule context.
269
+ * @param a The first node to compare.
270
+ * @param b The second node to compare.
271
+ * @returns True if the assignment targets are equal.
272
272
  * @internal
273
273
  */
274
274
  function isAssignmentTargetEqual(context, a, b) {
@@ -301,12 +301,12 @@ function resolveImportSource(name, initialScope, seen = /* @__PURE__ */ new Set(
301
301
  //#endregion
302
302
  //#region src/is-initialized-from-react.ts
303
303
  /**
304
- * Check if a variable is initialized from React import
304
+ * Check if a variable is initialized from React import.
305
305
  * @internal
306
- * @param name The variable name
307
- * @param initialScope The initial scope
308
- * @param importSource Alternative import source of React (ex: "preact/compat")
309
- * @returns True if the variable is initialized or derived from React import
306
+ * @param name The variable name.
307
+ * @param initialScope The initial scope.
308
+ * @param importSource Alternative import source of React (ex: "preact/compat").
309
+ * @returns True if the variable is initialized or derived from React import.
310
310
  */
311
311
  function isInitializedFromReact(name, initialScope, importSource = "react") {
312
312
  return name.toLowerCase() === "react" || Boolean(resolveImportSource(name, initialScope)?.startsWith(importSource));
@@ -315,12 +315,12 @@ function isInitializedFromReact(name, initialScope, importSource = "react") {
315
315
  //#endregion
316
316
  //#region src/is-initialized-from-react-native.ts
317
317
  /**
318
- * if a variable is initialized from React Native import
318
+ * if a variable is initialized from React Native import.
319
319
  * @internal
320
- * @param name The variable name
321
- * @param initialScope The initial scope
322
- * @param importSource Alternative import source of React Native (ex: "react-native-web")
323
- * @returns True if the variable is initialized from React Native import
320
+ * @param name The variable name.
321
+ * @param initialScope The initial scope.
322
+ * @param importSource Alternative import source of React Native (ex: "react-native-web").
323
+ * @returns True if the variable is initialized from React Native import.
324
324
  */
325
325
  function isInitializedFromReactNative(name, initialScope, importSource = "react-native") {
326
326
  return [
@@ -333,10 +333,10 @@ function isInitializedFromReactNative(name, initialScope, importSource = "react-
333
333
  //#endregion
334
334
  //#region src/resolve-enclosing-assignment-target.ts
335
335
  /**
336
- * Finds the enclosing assignment target (variable, property, etc.) for a given node
336
+ * Finds the enclosing assignment target (variable, property, etc.) for a given node.
337
337
  *
338
- * @param node The starting node
339
- * @returns The enclosing assignment target node, or null if not found
338
+ * @param node The starting node.
339
+ * @returns The enclosing assignment target node, or null if not found.
340
340
  */
341
341
  function resolveEnclosingAssignmentTarget(node) {
342
342
  switch (true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/var",
3
- "version": "5.16.0",
3
+ "version": "5.17.0",
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.64.0",
34
34
  "@typescript-eslint/utils": "^8.64.0",
35
35
  "ts-pattern": "^5.9.0",
36
- "@eslint-react/ast": "5.16.0",
37
- "@eslint-react/eslint": "5.16.0"
36
+ "@eslint-react/eslint": "5.17.0",
37
+ "@eslint-react/ast": "5.17.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@typescript-eslint/parser": "^8.64.0",
@@ -43,8 +43,8 @@
43
43
  "tsdown": "^0.22.7",
44
44
  "typescript": "6.0.3",
45
45
  "vitest": "^4.1.10",
46
- "@local/configs": "0.0.0",
47
- "@local/eff": "0.0.0"
46
+ "@local/eff": "0.0.0",
47
+ "@local/configs": "0.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "eslint": "*",