eslint-plugin-react-naming-convention 1.30.2 → 1.30.3-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.js CHANGED
@@ -52,9 +52,17 @@ var rules = {
52
52
 
53
53
  // package.json
54
54
  var name2 = "eslint-plugin-react-naming-convention";
55
- var version = "1.30.2";
55
+ var version = "1.30.3-beta.1";
56
56
  var createRule = shared.createRuleForPlugin("naming-convention");
57
57
 
58
+ // src/utils/regexp.ts
59
+ var RE_REGEXP_STR = /^\/(.+)\/([A-Za-z]*)$/u;
60
+ function toRegExp(string) {
61
+ const [, pattern, flags = "u"] = RE_REGEXP_STR.exec(string) ?? [];
62
+ if (pattern) return new RegExp(pattern, flags);
63
+ return { test: (s) => s === string };
64
+ }
65
+
58
66
  // src/rules/component-name.ts
59
67
  var defaultOptions = [
60
68
  {
@@ -158,7 +166,7 @@ function normalizeOptions(options) {
158
166
  ...defaultOpts,
159
167
  ...typeof opts === "string" ? { rule: opts } : {
160
168
  ...opts,
161
- excepts: opts.excepts?.map((pattern) => new RegExp(pattern, "u")) ?? []
169
+ excepts: opts.excepts?.map(toRegExp) ?? []
162
170
  }
163
171
  };
164
172
  }
@@ -263,7 +271,7 @@ var filename_default = createRule({
263
271
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
264
272
  const excepts = typeof options === "string" ? [] : options.excepts ?? [];
265
273
  function validate(name3, casing = rule, ignores = excepts) {
266
- const shouldIgnore = ignores.map((pattern) => new RegExp(pattern, "u")).some((pattern) => pattern.test(name3));
274
+ const shouldIgnore = ignores.map(toRegExp).some((pattern) => pattern.test(name3));
267
275
  if (shouldIgnore) return true;
268
276
  return tsPattern.match(casing).with("PascalCase", () => shared.RE_PASCAL_CASE.test(name3)).with("camelCase", () => shared.RE_CAMEL_CASE.test(name3)).with("kebab-case", () => shared.RE_KEBAB_CASE.test(name3)).with("snake_case", () => shared.RE_SNAKE_CASE.test(name3)).exhaustive();
269
277
  }
package/dist/index.mjs CHANGED
@@ -27,9 +27,17 @@ var rules = {
27
27
 
28
28
  // package.json
29
29
  var name2 = "eslint-plugin-react-naming-convention";
30
- var version = "1.30.2";
30
+ var version = "1.30.3-beta.1";
31
31
  var createRule = createRuleForPlugin("naming-convention");
32
32
 
33
+ // src/utils/regexp.ts
34
+ var RE_REGEXP_STR = /^\/(.+)\/([A-Za-z]*)$/u;
35
+ function toRegExp(string) {
36
+ const [, pattern, flags = "u"] = RE_REGEXP_STR.exec(string) ?? [];
37
+ if (pattern) return new RegExp(pattern, flags);
38
+ return { test: (s) => s === string };
39
+ }
40
+
33
41
  // src/rules/component-name.ts
34
42
  var defaultOptions = [
35
43
  {
@@ -133,7 +141,7 @@ function normalizeOptions(options) {
133
141
  ...defaultOpts,
134
142
  ...typeof opts === "string" ? { rule: opts } : {
135
143
  ...opts,
136
- excepts: opts.excepts?.map((pattern) => new RegExp(pattern, "u")) ?? []
144
+ excepts: opts.excepts?.map(toRegExp) ?? []
137
145
  }
138
146
  };
139
147
  }
@@ -238,7 +246,7 @@ var filename_default = createRule({
238
246
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
239
247
  const excepts = typeof options === "string" ? [] : options.excepts ?? [];
240
248
  function validate(name3, casing = rule, ignores = excepts) {
241
- const shouldIgnore = ignores.map((pattern) => new RegExp(pattern, "u")).some((pattern) => pattern.test(name3));
249
+ const shouldIgnore = ignores.map(toRegExp).some((pattern) => pattern.test(name3));
242
250
  if (shouldIgnore) return true;
243
251
  return match(casing).with("PascalCase", () => RE_PASCAL_CASE.test(name3)).with("camelCase", () => RE_CAMEL_CASE.test(name3)).with("kebab-case", () => RE_KEBAB_CASE.test(name3)).with("snake_case", () => RE_SNAKE_CASE.test(name3)).exhaustive();
244
252
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "1.30.2",
3
+ "version": "1.30.3-beta.1",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -49,12 +49,12 @@
49
49
  "@typescript-eslint/utils": "^8.26.0",
50
50
  "string-ts": "^2.2.1",
51
51
  "ts-pattern": "^5.6.2",
52
- "@eslint-react/ast": "1.30.2",
53
- "@eslint-react/core": "1.30.2",
54
- "@eslint-react/eff": "1.30.2",
55
- "@eslint-react/jsx": "1.30.2",
56
- "@eslint-react/shared": "1.30.2",
57
- "@eslint-react/var": "1.30.2"
52
+ "@eslint-react/ast": "1.30.3-beta.1",
53
+ "@eslint-react/eff": "1.30.3-beta.1",
54
+ "@eslint-react/core": "1.30.3-beta.1",
55
+ "@eslint-react/jsx": "1.30.3-beta.1",
56
+ "@eslint-react/shared": "1.30.3-beta.1",
57
+ "@eslint-react/var": "1.30.3-beta.1"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/react": "^19.0.10",