eslint-plugin-react-naming-convention 2.0.0-beta.4 → 2.0.0-beta.41

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 +13 -6
  2. package/package.json +15 -16
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ var rules = {
29
29
 
30
30
  // package.json
31
31
  var name2 = "eslint-plugin-react-naming-convention";
32
- var version = "2.0.0-beta.4";
32
+ var version = "2.0.0-beta.41";
33
33
  var createRule = ESLintUtils.RuleCreator(getDocsUrl("naming-convention"));
34
34
 
35
35
  // src/rules/component-name.ts
@@ -97,7 +97,7 @@ function create(context) {
97
97
  const id = AST.getFunctionId(component);
98
98
  if (id?.name == null) continue;
99
99
  const name3 = id.name;
100
- if (isValidName(name3, options)) return;
100
+ if (isValidName(name3, options)) continue;
101
101
  context.report({
102
102
  messageId: "invalid",
103
103
  node: id,
@@ -179,7 +179,13 @@ function create2(context) {
179
179
  var RULE_NAME3 = "filename";
180
180
  var defaultOptions2 = [
181
181
  {
182
- excepts: ["^index$"],
182
+ excepts: [
183
+ "index",
184
+ "/^_/",
185
+ "/^\\$/",
186
+ "/^[0-9]+$/",
187
+ "/^\\[[^\\]]+\\]$/"
188
+ ],
183
189
  rule: "PascalCase"
184
190
  }
185
191
  ];
@@ -234,9 +240,10 @@ function create3(context) {
234
240
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
235
241
  const excepts = typeof options === "string" ? [] : (options.excepts ?? []).map((s) => RegExp.toRegExp(s));
236
242
  function validate(name3, casing = rule, ignores = excepts) {
237
- const shouldIgnore = ignores.some((pattern) => pattern.test(name3));
238
- if (shouldIgnore) return true;
239
- return match(casing).with("PascalCase", () => RegExp.PASCAL_CASE.test(name3)).with("camelCase", () => RegExp.CAMEL_CASE.test(name3)).with("kebab-case", () => RegExp.KEBAB_CASE.test(name3)).with("snake_case", () => RegExp.SNAKE_CASE.test(name3)).exhaustive();
243
+ if (ignores.some((pattern) => pattern.test(name3))) return true;
244
+ const filteredName = name3.match(/[\w-]/gu)?.join("") ?? "";
245
+ if (filteredName.length === 0) return true;
246
+ return match(casing).with("PascalCase", () => RegExp.PASCAL_CASE.test(filteredName)).with("camelCase", () => RegExp.CAMEL_CASE.test(filteredName)).with("kebab-case", () => RegExp.KEBAB_CASE.test(filteredName)).with("snake_case", () => RegExp.SNAKE_CASE.test(filteredName)).exhaustive();
240
247
  }
241
248
  function getSuggestion(name3, casing = rule) {
242
249
  return match(casing).with("PascalCase", () => pascalCase(name3)).with("camelCase", () => camelCase(name3)).with("kebab-case", () => kebabCase(name3)).with("snake_case", () => snakeCase(name3)).exhaustive();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.41",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -35,27 +35,27 @@
35
35
  "./package.json"
36
36
  ],
37
37
  "dependencies": {
38
- "@typescript-eslint/scope-manager": "^8.35.0",
39
- "@typescript-eslint/type-utils": "^8.35.0",
40
- "@typescript-eslint/types": "^8.35.0",
41
- "@typescript-eslint/utils": "^8.35.0",
38
+ "@typescript-eslint/scope-manager": "^8.40.0",
39
+ "@typescript-eslint/type-utils": "^8.40.0",
40
+ "@typescript-eslint/types": "^8.40.0",
41
+ "@typescript-eslint/utils": "^8.40.0",
42
42
  "string-ts": "^2.2.1",
43
- "ts-pattern": "^5.7.1",
44
- "@eslint-react/ast": "2.0.0-beta.4",
45
- "@eslint-react/kit": "2.0.0-beta.4",
46
- "@eslint-react/eff": "2.0.0-beta.4",
47
- "@eslint-react/shared": "2.0.0-beta.4",
48
- "@eslint-react/var": "2.0.0-beta.4",
49
- "@eslint-react/core": "2.0.0-beta.4"
43
+ "ts-pattern": "^5.8.0",
44
+ "@eslint-react/ast": "2.0.0-beta.41",
45
+ "@eslint-react/eff": "2.0.0-beta.41",
46
+ "@eslint-react/core": "2.0.0-beta.41",
47
+ "@eslint-react/shared": "2.0.0-beta.41",
48
+ "@eslint-react/kit": "2.0.0-beta.41",
49
+ "@eslint-react/var": "2.0.0-beta.41"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/react": "^19.1.8",
53
- "@types/react-dom": "^19.1.6",
52
+ "@types/react": "^19.1.11",
53
+ "@types/react-dom": "^19.1.7",
54
54
  "tsup": "^8.5.0",
55
55
  "@local/configs": "0.0.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "eslint": "^9.29.0",
58
+ "eslint": "^9.33.0",
59
59
  "typescript": "^4.9.5 || ^5.4.5"
60
60
  },
61
61
  "peerDependenciesMeta": {
@@ -67,7 +67,6 @@
67
67
  }
68
68
  },
69
69
  "engines": {
70
- "bun": ">=1.0.15",
71
70
  "node": ">=20.19.0"
72
71
  },
73
72
  "publishConfig": {