eslint-plugin-react-naming-convention 2.0.0-beta.38 → 2.0.0-beta.39
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 +12 -5
- package/package.json +7 -7
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.
|
|
32
|
+
var version = "2.0.0-beta.39";
|
|
33
33
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("naming-convention"));
|
|
34
34
|
|
|
35
35
|
// src/rules/component-name.ts
|
|
@@ -179,7 +179,13 @@ function create2(context) {
|
|
|
179
179
|
var RULE_NAME3 = "filename";
|
|
180
180
|
var defaultOptions2 = [
|
|
181
181
|
{
|
|
182
|
-
excepts: [
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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.
|
|
3
|
+
"version": "2.0.0-beta.39",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for naming convention related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@typescript-eslint/utils": "^8.40.0",
|
|
42
42
|
"string-ts": "^2.2.1",
|
|
43
43
|
"ts-pattern": "^5.8.0",
|
|
44
|
-
"@eslint-react/ast": "2.0.0-beta.
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/ast": "2.0.0-beta.39",
|
|
45
|
+
"@eslint-react/eff": "2.0.0-beta.39",
|
|
46
|
+
"@eslint-react/core": "2.0.0-beta.39",
|
|
47
|
+
"@eslint-react/shared": "2.0.0-beta.39",
|
|
48
|
+
"@eslint-react/var": "2.0.0-beta.39",
|
|
49
|
+
"@eslint-react/kit": "2.0.0-beta.39"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/react": "^19.1.10",
|