eslint-plugin-react-naming-convention 1.52.10-next.1 → 1.52.10-next.3

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 (3) hide show
  1. package/dist/index.js +12 -13
  2. package/dist/index.mjs +12 -13
  3. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -50,7 +50,7 @@ const rules = { "react-naming-convention/context-name": "warn" };
50
50
  //#endregion
51
51
  //#region package.json
52
52
  var name = "eslint-plugin-react-naming-convention";
53
- var version = "1.52.10-next.1";
53
+ var version = "1.52.10-next.3";
54
54
 
55
55
  //#endregion
56
56
  //#region src/utils/create-rule.ts
@@ -71,8 +71,6 @@ const schema$2 = [{ anyOf: [{
71
71
  additionalProperties: false,
72
72
  properties: {
73
73
  allowAllCaps: { type: "boolean" },
74
- allowLeadingUnderscore: { type: "boolean" },
75
- allowNamespace: { type: "boolean" },
76
74
  excepts: {
77
75
  type: "array",
78
76
  items: {
@@ -204,12 +202,12 @@ function create$3(context) {
204
202
  //#region src/rules/filename.ts
205
203
  const RULE_NAME$2 = "filename";
206
204
  const defaultOptions$1 = [{
207
- excepts: ["^index$"],
208
- extensions: [
209
- ".js",
210
- ".jsx",
211
- ".ts",
212
- ".tsx"
205
+ excepts: [
206
+ "index",
207
+ String.raw`/^_/`,
208
+ String.raw`/^\$/`,
209
+ String.raw`/^[0-9]+$/`,
210
+ String.raw`/^\[[^\]]+\]$/`
213
211
  ],
214
212
  rule: "PascalCase"
215
213
  }];
@@ -266,11 +264,12 @@ var filename_default = createRule({
266
264
  function create$2(context) {
267
265
  const options = context.options[0] ?? defaultOptions$1[0];
268
266
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
269
- const excepts = typeof options === "string" ? [] : options.excepts ?? [];
267
+ const excepts = typeof options === "string" ? [] : (options.excepts ?? []).map((s) => __eslint_react_kit.RegExp.toRegExp(s));
270
268
  function validate(name$2, casing = rule, ignores = excepts) {
271
- const shouldIgnore = ignores.map((s) => __eslint_react_kit.RegExp.toRegExp(s)).some((pattern) => pattern.test(name$2));
272
- if (shouldIgnore) return true;
273
- return (0, ts_pattern.match)(casing).with("PascalCase", () => __eslint_react_kit.RegExp.PASCAL_CASE.test(name$2)).with("camelCase", () => __eslint_react_kit.RegExp.CAMEL_CASE.test(name$2)).with("kebab-case", () => __eslint_react_kit.RegExp.KEBAB_CASE.test(name$2)).with("snake_case", () => __eslint_react_kit.RegExp.SNAKE_CASE.test(name$2)).exhaustive();
269
+ if (ignores.some((pattern) => pattern.test(name$2))) return true;
270
+ const filteredName = name$2.match(/[\w.-]/gu)?.join("") ?? "";
271
+ if (filteredName.length === 0) return true;
272
+ return (0, ts_pattern.match)(casing).with("PascalCase", () => __eslint_react_kit.RegExp.PASCAL_CASE.test(filteredName)).with("camelCase", () => __eslint_react_kit.RegExp.CAMEL_CASE.test(filteredName)).with("kebab-case", () => __eslint_react_kit.RegExp.KEBAB_CASE.test(filteredName)).with("snake_case", () => __eslint_react_kit.RegExp.SNAKE_CASE.test(filteredName)).exhaustive();
274
273
  }
275
274
  function getSuggestion(name$2, casing = rule) {
276
275
  return (0, ts_pattern.match)(casing).with("PascalCase", () => (0, string_ts.pascalCase)(name$2)).with("camelCase", () => (0, string_ts.camelCase)(name$2)).with("kebab-case", () => (0, string_ts.kebabCase)(name$2)).with("snake_case", () => (0, string_ts.snakeCase)(name$2)).exhaustive();
package/dist/index.mjs CHANGED
@@ -31,7 +31,7 @@ const rules = { "react-naming-convention/context-name": "warn" };
31
31
  //#endregion
32
32
  //#region package.json
33
33
  var name = "eslint-plugin-react-naming-convention";
34
- var version = "1.52.10-next.1";
34
+ var version = "1.52.10-next.3";
35
35
 
36
36
  //#endregion
37
37
  //#region src/utils/create-rule.ts
@@ -52,8 +52,6 @@ const schema$2 = [{ anyOf: [{
52
52
  additionalProperties: false,
53
53
  properties: {
54
54
  allowAllCaps: { type: "boolean" },
55
- allowLeadingUnderscore: { type: "boolean" },
56
- allowNamespace: { type: "boolean" },
57
55
  excepts: {
58
56
  type: "array",
59
57
  items: {
@@ -185,12 +183,12 @@ function create$3(context) {
185
183
  //#region src/rules/filename.ts
186
184
  const RULE_NAME$2 = "filename";
187
185
  const defaultOptions$1 = [{
188
- excepts: ["^index$"],
189
- extensions: [
190
- ".js",
191
- ".jsx",
192
- ".ts",
193
- ".tsx"
186
+ excepts: [
187
+ "index",
188
+ String.raw`/^_/`,
189
+ String.raw`/^\$/`,
190
+ String.raw`/^[0-9]+$/`,
191
+ String.raw`/^\[[^\]]+\]$/`
194
192
  ],
195
193
  rule: "PascalCase"
196
194
  }];
@@ -247,11 +245,12 @@ var filename_default = createRule({
247
245
  function create$2(context) {
248
246
  const options = context.options[0] ?? defaultOptions$1[0];
249
247
  const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
250
- const excepts = typeof options === "string" ? [] : options.excepts ?? [];
248
+ const excepts = typeof options === "string" ? [] : (options.excepts ?? []).map((s) => RegExp.toRegExp(s));
251
249
  function validate(name$2, casing = rule, ignores = excepts) {
252
- const shouldIgnore = ignores.map((s) => RegExp.toRegExp(s)).some((pattern) => pattern.test(name$2));
253
- if (shouldIgnore) return true;
254
- return match(casing).with("PascalCase", () => RegExp.PASCAL_CASE.test(name$2)).with("camelCase", () => RegExp.CAMEL_CASE.test(name$2)).with("kebab-case", () => RegExp.KEBAB_CASE.test(name$2)).with("snake_case", () => RegExp.SNAKE_CASE.test(name$2)).exhaustive();
250
+ if (ignores.some((pattern) => pattern.test(name$2))) return true;
251
+ const filteredName = name$2.match(/[\w.-]/gu)?.join("") ?? "";
252
+ if (filteredName.length === 0) return true;
253
+ 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();
255
254
  }
256
255
  function getSuggestion(name$2, casing = rule) {
257
256
  return match(casing).with("PascalCase", () => pascalCase(name$2)).with("camelCase", () => camelCase(name$2)).with("kebab-case", () => kebabCase(name$2)).with("snake_case", () => snakeCase(name$2)).exhaustive();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-react-naming-convention",
3
- "version": "1.52.10-next.1",
3
+ "version": "1.52.10-next.3",
4
4
  "description": "ESLint React's ESLint plugin for naming convention related rules.",
5
5
  "keywords": [
6
6
  "react",
@@ -43,18 +43,18 @@
43
43
  "./package.json"
44
44
  ],
45
45
  "dependencies": {
46
- "@typescript-eslint/scope-manager": "^8.41.0",
47
- "@typescript-eslint/type-utils": "^8.41.0",
48
- "@typescript-eslint/types": "^8.41.0",
49
- "@typescript-eslint/utils": "^8.41.0",
46
+ "@typescript-eslint/scope-manager": "^8.42.0",
47
+ "@typescript-eslint/type-utils": "^8.42.0",
48
+ "@typescript-eslint/types": "^8.42.0",
49
+ "@typescript-eslint/utils": "^8.42.0",
50
50
  "string-ts": "^2.2.1",
51
51
  "ts-pattern": "^5.8.0",
52
- "@eslint-react/ast": "1.52.10-next.1",
53
- "@eslint-react/core": "1.52.10-next.1",
54
- "@eslint-react/eff": "1.52.10-next.1",
55
- "@eslint-react/kit": "1.52.10-next.1",
56
- "@eslint-react/shared": "1.52.10-next.1",
57
- "@eslint-react/var": "1.52.10-next.1"
52
+ "@eslint-react/ast": "1.52.10-next.3",
53
+ "@eslint-react/core": "1.52.10-next.3",
54
+ "@eslint-react/kit": "1.52.10-next.3",
55
+ "@eslint-react/eff": "1.52.10-next.3",
56
+ "@eslint-react/var": "1.52.10-next.3",
57
+ "@eslint-react/shared": "1.52.10-next.3"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/react": "^19.1.12",