eslint-plugin-react-naming-convention 2.0.0-next.178 → 2.0.0-next.179
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 +11 -10
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getConfigAdapters, getDocsUrl } from "@eslint-react/shared";
|
|
2
2
|
import * as AST from "@eslint-react/ast";
|
|
3
3
|
import * as ER from "@eslint-react/core";
|
|
4
|
-
import {
|
|
4
|
+
import { RE_CAMEL_CASE, RE_CONSTANT_CASE, RE_KEBAB_CASE, RE_PASCAL_CASE, RE_SNAKE_CASE, toRegExp } from "@eslint-react/kit";
|
|
5
5
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
6
6
|
import { identity, isObject } from "@eslint-react/eff";
|
|
7
7
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
@@ -11,17 +11,18 @@ import { camelCase, kebabCase, pascalCase, snakeCase } from "string-ts";
|
|
|
11
11
|
|
|
12
12
|
//#region rolldown:runtime
|
|
13
13
|
var __defProp = Object.defineProperty;
|
|
14
|
-
var __export = (
|
|
14
|
+
var __export = (all) => {
|
|
15
|
+
let target = {};
|
|
15
16
|
for (var name$2 in all) __defProp(target, name$2, {
|
|
16
17
|
get: all[name$2],
|
|
17
18
|
enumerable: true
|
|
18
19
|
});
|
|
20
|
+
return target;
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
//#endregion
|
|
22
24
|
//#region src/configs/recommended.ts
|
|
23
|
-
var recommended_exports = {
|
|
24
|
-
__export(recommended_exports, {
|
|
25
|
+
var recommended_exports = __export({
|
|
25
26
|
name: () => name$1,
|
|
26
27
|
rules: () => rules
|
|
27
28
|
});
|
|
@@ -31,7 +32,7 @@ const rules = { "react-naming-convention/context-name": "warn" };
|
|
|
31
32
|
//#endregion
|
|
32
33
|
//#region package.json
|
|
33
34
|
var name = "eslint-plugin-react-naming-convention";
|
|
34
|
-
var version = "2.0.0-next.
|
|
35
|
+
var version = "2.0.0-next.179";
|
|
35
36
|
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region src/utils/create-rule.ts
|
|
@@ -128,7 +129,7 @@ function normalizeOptions(options) {
|
|
|
128
129
|
...defaultOpts,
|
|
129
130
|
...typeof opts === "string" ? { rule: opts } : {
|
|
130
131
|
...opts,
|
|
131
|
-
excepts: opts.excepts?.map((s) =>
|
|
132
|
+
excepts: opts.excepts?.map((s) => toRegExp(s)) ?? []
|
|
132
133
|
}
|
|
133
134
|
};
|
|
134
135
|
}
|
|
@@ -137,10 +138,10 @@ function isValidName(name$2, options) {
|
|
|
137
138
|
if (options.excepts.some((regex) => regex.test(name$2))) return true;
|
|
138
139
|
const normalized = name$2.split(".").at(-1) ?? name$2;
|
|
139
140
|
switch (options.rule) {
|
|
140
|
-
case "CONSTANT_CASE": return
|
|
141
|
+
case "CONSTANT_CASE": return RE_CONSTANT_CASE.test(normalized);
|
|
141
142
|
case "PascalCase":
|
|
142
143
|
if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) return options.allowAllCaps;
|
|
143
|
-
return
|
|
144
|
+
return RE_PASCAL_CASE.test(normalized);
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
|
|
@@ -245,12 +246,12 @@ var filename_default = createRule({
|
|
|
245
246
|
function create$2(context) {
|
|
246
247
|
const options = context.options[0] ?? defaultOptions$1[0];
|
|
247
248
|
const rule = typeof options === "string" ? options : options.rule ?? "PascalCase";
|
|
248
|
-
const excepts = typeof options === "string" ? [] : (options.excepts ?? []).map((s) =>
|
|
249
|
+
const excepts = typeof options === "string" ? [] : (options.excepts ?? []).map((s) => toRegExp(s));
|
|
249
250
|
function validate(name$2, casing = rule, ignores = excepts) {
|
|
250
251
|
if (ignores.some((pattern) => pattern.test(name$2))) return true;
|
|
251
252
|
const filteredName = name$2.match(/[\w.-]/gu)?.join("") ?? "";
|
|
252
253
|
if (filteredName.length === 0) return true;
|
|
253
|
-
return match(casing).with("PascalCase", () =>
|
|
254
|
+
return match(casing).with("PascalCase", () => RE_PASCAL_CASE.test(filteredName)).with("camelCase", () => RE_CAMEL_CASE.test(filteredName)).with("kebab-case", () => RE_KEBAB_CASE.test(filteredName)).with("snake_case", () => RE_SNAKE_CASE.test(filteredName)).exhaustive();
|
|
254
255
|
}
|
|
255
256
|
function getSuggestion(name$2, casing = rule) {
|
|
256
257
|
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": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.179",
|
|
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.43.0",
|
|
42
42
|
"string-ts": "^2.2.1",
|
|
43
43
|
"ts-pattern": "^5.8.0",
|
|
44
|
-
"@eslint-react/ast": "2.0.0-next.
|
|
45
|
-
"@eslint-react/eff": "2.0.0-next.
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/
|
|
49
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/ast": "2.0.0-next.179",
|
|
45
|
+
"@eslint-react/eff": "2.0.0-next.179",
|
|
46
|
+
"@eslint-react/kit": "2.0.0-next.179",
|
|
47
|
+
"@eslint-react/core": "2.0.0-next.179",
|
|
48
|
+
"@eslint-react/var": "2.0.0-next.179",
|
|
49
|
+
"@eslint-react/shared": "2.0.0-next.179"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/react": "^19.1.12",
|