eslint-plugin-react-naming-convention 1.47.3 → 1.47.4-next.0
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 +6 -6
- package/dist/index.mjs +7 -7
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -55,7 +55,7 @@ var rules = {
|
|
|
55
55
|
|
|
56
56
|
// package.json
|
|
57
57
|
var name2 = "eslint-plugin-react-naming-convention";
|
|
58
|
-
var version = "1.47.
|
|
58
|
+
var version = "1.47.4-next.0";
|
|
59
59
|
var createRule = utils.ESLintUtils.RuleCreator(shared.getDocsUrl("naming-convention"));
|
|
60
60
|
|
|
61
61
|
// src/rules/component-name.ts
|
|
@@ -162,7 +162,7 @@ function normalizeOptions(options) {
|
|
|
162
162
|
...defaultOpts,
|
|
163
163
|
...typeof opts === "string" ? { rule: opts } : {
|
|
164
164
|
...opts,
|
|
165
|
-
excepts: opts.excepts?.map((s) => kit.
|
|
165
|
+
excepts: opts.excepts?.map((s) => kit.RegExp.toRegExp(s)) ?? []
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
}
|
|
@@ -172,12 +172,12 @@ function isValidName(name3, options) {
|
|
|
172
172
|
const normalized = name3.split(".").at(-1) ?? name3;
|
|
173
173
|
switch (options.rule) {
|
|
174
174
|
case "CONSTANT_CASE":
|
|
175
|
-
return kit.
|
|
175
|
+
return kit.RegExp.CONSTANT_CASE.test(normalized);
|
|
176
176
|
case "PascalCase":
|
|
177
177
|
if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) {
|
|
178
178
|
return options.allowAllCaps;
|
|
179
179
|
}
|
|
180
|
-
return kit.
|
|
180
|
+
return kit.RegExp.PASCAL_CASE.test(normalized);
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
var RULE_NAME2 = "context-name";
|
|
@@ -271,9 +271,9 @@ function create3(context) {
|
|
|
271
271
|
const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
|
|
272
272
|
const excepts = typeof options === "string" ? [] : options.excepts ?? [];
|
|
273
273
|
function validate(name3, casing = rule, ignores = excepts) {
|
|
274
|
-
const shouldIgnore = ignores.map((s) => kit.
|
|
274
|
+
const shouldIgnore = ignores.map((s) => kit.RegExp.toRegExp(s)).some((pattern) => pattern.test(name3));
|
|
275
275
|
if (shouldIgnore) return true;
|
|
276
|
-
return tsPattern.match(casing).with("PascalCase", () => kit.
|
|
276
|
+
return tsPattern.match(casing).with("PascalCase", () => kit.RegExp.PASCAL_CASE.test(name3)).with("camelCase", () => kit.RegExp.CAMEL_CASE.test(name3)).with("kebab-case", () => kit.RegExp.KEBAB_CASE.test(name3)).with("snake_case", () => kit.RegExp.SNAKE_CASE.test(name3)).exhaustive();
|
|
277
277
|
}
|
|
278
278
|
function getSuggestion(name3, casing = rule) {
|
|
279
279
|
return tsPattern.match(casing).with("PascalCase", () => stringTs.pascalCase(name3)).with("camelCase", () => stringTs.camelCase(name3)).with("kebab-case", () => stringTs.kebabCase(name3)).with("snake_case", () => stringTs.snakeCase(name3)).exhaustive();
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as AST from '@eslint-react/ast';
|
|
2
2
|
import * as ER2 from '@eslint-react/core';
|
|
3
|
-
import {
|
|
3
|
+
import { RegExp } from '@eslint-react/kit';
|
|
4
4
|
import { getDocsUrl, getSettingsFromContext } from '@eslint-react/shared';
|
|
5
5
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
6
6
|
import { identity, isObject } from '@eslint-react/eff';
|
|
@@ -29,7 +29,7 @@ var rules = {
|
|
|
29
29
|
|
|
30
30
|
// package.json
|
|
31
31
|
var name2 = "eslint-plugin-react-naming-convention";
|
|
32
|
-
var version = "1.47.
|
|
32
|
+
var version = "1.47.4-next.0";
|
|
33
33
|
var createRule = ESLintUtils.RuleCreator(getDocsUrl("naming-convention"));
|
|
34
34
|
|
|
35
35
|
// src/rules/component-name.ts
|
|
@@ -136,7 +136,7 @@ function normalizeOptions(options) {
|
|
|
136
136
|
...defaultOpts,
|
|
137
137
|
...typeof opts === "string" ? { rule: opts } : {
|
|
138
138
|
...opts,
|
|
139
|
-
excepts: opts.excepts?.map((s) =>
|
|
139
|
+
excepts: opts.excepts?.map((s) => RegExp.toRegExp(s)) ?? []
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
142
|
}
|
|
@@ -146,12 +146,12 @@ function isValidName(name3, options) {
|
|
|
146
146
|
const normalized = name3.split(".").at(-1) ?? name3;
|
|
147
147
|
switch (options.rule) {
|
|
148
148
|
case "CONSTANT_CASE":
|
|
149
|
-
return
|
|
149
|
+
return RegExp.CONSTANT_CASE.test(normalized);
|
|
150
150
|
case "PascalCase":
|
|
151
151
|
if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) {
|
|
152
152
|
return options.allowAllCaps;
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return RegExp.PASCAL_CASE.test(normalized);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
var RULE_NAME2 = "context-name";
|
|
@@ -245,9 +245,9 @@ function create3(context) {
|
|
|
245
245
|
const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
|
|
246
246
|
const excepts = typeof options === "string" ? [] : options.excepts ?? [];
|
|
247
247
|
function validate(name3, casing = rule, ignores = excepts) {
|
|
248
|
-
const shouldIgnore = ignores.map((s) =>
|
|
248
|
+
const shouldIgnore = ignores.map((s) => RegExp.toRegExp(s)).some((pattern) => pattern.test(name3));
|
|
249
249
|
if (shouldIgnore) return true;
|
|
250
|
-
return match(casing).with("PascalCase", () =>
|
|
250
|
+
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();
|
|
251
251
|
}
|
|
252
252
|
function getSuggestion(name3, casing = rule) {
|
|
253
253
|
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": "1.47.
|
|
3
|
+
"version": "1.47.4-next.0",
|
|
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.30.1",
|
|
50
50
|
"string-ts": "^2.2.1",
|
|
51
51
|
"ts-pattern": "^5.7.0",
|
|
52
|
-
"@eslint-react/
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/eff": "1.47.
|
|
55
|
-
"@eslint-react/kit": "1.47.
|
|
56
|
-
"@eslint-react/shared": "1.47.
|
|
57
|
-
"@eslint-react/var": "1.47.
|
|
52
|
+
"@eslint-react/core": "1.47.4-next.0",
|
|
53
|
+
"@eslint-react/ast": "1.47.4-next.0",
|
|
54
|
+
"@eslint-react/eff": "1.47.4-next.0",
|
|
55
|
+
"@eslint-react/kit": "1.47.4-next.0",
|
|
56
|
+
"@eslint-react/shared": "1.47.4-next.0",
|
|
57
|
+
"@eslint-react/var": "1.47.4-next.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/react": "^19.1.2",
|