eslint-plugin-react-naming-convention 5.26.3 → 5.26.4

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -6
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __exportAll = (all, no_symbols) => {
18
18
  //#endregion
19
19
  //#region package.json
20
20
  var name$1 = "eslint-plugin-react-naming-convention";
21
- var version = "5.26.3";
21
+ var version = "5.26.4";
22
22
  //#endregion
23
23
  //#region src/utils/create-rule.ts
24
24
  function getDocsUrl(ruleName) {
@@ -33,7 +33,13 @@ function resolveNamingTarget(node) {
33
33
  function resolveUpward(node, propertyTarget) {
34
34
  const parent = node.parent;
35
35
  if (parent == null) return null;
36
- if (parent.type === AST_NODE_TYPES.Property && parent.value === node && propertyTarget == null) propertyTarget = getKeyTarget(parent.key, parent.computed);
36
+ if (parent.type === AST_NODE_TYPES.Property) {
37
+ if (parent.value !== node) return null;
38
+ const keyTarget = getKeyTarget(parent.key, parent.computed);
39
+ if (keyTarget == null) return null;
40
+ propertyTarget ??= keyTarget;
41
+ return resolveUpward(parent, propertyTarget);
42
+ }
37
43
  switch (parent.type) {
38
44
  case AST_NODE_TYPES.VariableDeclarator: {
39
45
  const idTarget = getIdentifierTarget(parent.id);
@@ -47,10 +53,20 @@ function resolveUpward(node, propertyTarget) {
47
53
  const keyTarget = getKeyTarget(parent.key, parent.computed);
48
54
  return keyTarget == null ? null : propertyTarget ?? keyTarget;
49
55
  }
50
- case AST_NODE_TYPES.ExportDefaultDeclaration:
51
- case AST_NODE_TYPES.BlockStatement:
52
- case AST_NODE_TYPES.Program: return null;
53
- default: return resolveUpward(parent, propertyTarget);
56
+ case AST_NODE_TYPES.ConditionalExpression:
57
+ case AST_NODE_TYPES.LogicalExpression:
58
+ case AST_NODE_TYPES.AwaitExpression:
59
+ case AST_NODE_TYPES.ChainExpression:
60
+ case AST_NODE_TYPES.TSAsExpression:
61
+ case AST_NODE_TYPES.TSTypeAssertion:
62
+ case AST_NODE_TYPES.TSNonNullExpression:
63
+ case AST_NODE_TYPES.TSSatisfiesExpression:
64
+ case AST_NODE_TYPES.TSInstantiationExpression:
65
+ case AST_NODE_TYPES.ObjectExpression: return resolveUpward(parent, propertyTarget);
66
+ case AST_NODE_TYPES.SequenceExpression: return parent.expressions[parent.expressions.length - 1] === node ? resolveUpward(parent, propertyTarget) : null;
67
+ case AST_NODE_TYPES.CallExpression:
68
+ case AST_NODE_TYPES.NewExpression: return parent.arguments.some((argument) => argument === node) ? resolveUpward(parent, propertyTarget) : null;
69
+ default: return null;
54
70
  }
55
71
  }
56
72
  function getStaticName(key, computed) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "5.26.3",
3
+ "version": "5.26.4",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -37,13 +37,13 @@
37
37
  "dist"
38
38
  ],
39
39
  "dependencies": {
40
- "@eslint-react/ast": "5.26.3",
41
- "@eslint-react/core": "5.26.3",
42
- "@eslint-react/eslint": "5.26.3",
43
- "@eslint-react/shared": "5.26.3",
44
- "@eslint-react/var": "5.26.3",
45
- "@typescript-eslint/types": "^8.71.1",
46
- "@typescript-eslint/utils": "^8.71.1",
40
+ "@eslint-react/ast": "5.26.4",
41
+ "@eslint-react/core": "5.26.4",
42
+ "@eslint-react/eslint": "5.26.4",
43
+ "@eslint-react/shared": "5.26.4",
44
+ "@eslint-react/var": "5.26.4",
45
+ "@typescript-eslint/types": "^8.71.2",
46
+ "@typescript-eslint/utils": "^8.71.2",
47
47
  "ts-pattern": "^5.9.0"
48
48
  },
49
49
  "devDependencies": {