eslint-plugin-react-naming-convention 1.23.2-next.3 → 1.23.2-next.6
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 +19 -19
- package/dist/index.mjs +20 -20
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var path__default = /*#__PURE__*/_interopDefault(path);
|
|
|
36
36
|
|
|
37
37
|
// package.json
|
|
38
38
|
var name = "eslint-plugin-react-naming-convention";
|
|
39
|
-
var version = "1.23.2-next.
|
|
39
|
+
var version = "1.23.2-next.6";
|
|
40
40
|
var createRule = shared.createRuleForPlugin("naming-convention");
|
|
41
41
|
|
|
42
42
|
// src/rules/component-name.ts
|
|
@@ -97,7 +97,7 @@ function validate(name2, options) {
|
|
|
97
97
|
normalized = normalized.replace(/^_/, "");
|
|
98
98
|
}
|
|
99
99
|
return tsPattern.match(options.rule).with("CONSTANT_CASE", () => shared.RE_CONSTANT_CASE.test(normalized)).with("PascalCase", () => {
|
|
100
|
-
if (
|
|
100
|
+
if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) return options.allowAllCaps;
|
|
101
101
|
return shared.RE_PASCAL_CASE.test(normalized);
|
|
102
102
|
}).otherwise(eff.F.constFalse);
|
|
103
103
|
}
|
|
@@ -137,11 +137,10 @@ var component_name_default = createRule({
|
|
|
137
137
|
const functionComponents = collector.ctx.getAllComponents(node);
|
|
138
138
|
const classComponents = collectorLegacy.ctx.getAllComponents(node);
|
|
139
139
|
for (const { node: component } of functionComponents.values()) {
|
|
140
|
-
const
|
|
141
|
-
if (eff.O.isNone(
|
|
142
|
-
const id =
|
|
143
|
-
|
|
144
|
-
if (validate(name2, options)) continue;
|
|
140
|
+
const mbId = AST__namespace.getFunctionIdentifier(component);
|
|
141
|
+
if (eff.O.isNone(mbId)) continue;
|
|
142
|
+
const id = mbId.value;
|
|
143
|
+
if (validate(id.name, options)) continue;
|
|
145
144
|
context.report({
|
|
146
145
|
messageId: "componentName",
|
|
147
146
|
node: id,
|
|
@@ -151,18 +150,19 @@ var component_name_default = createRule({
|
|
|
151
150
|
});
|
|
152
151
|
}
|
|
153
152
|
for (const { node: component } of classComponents.values()) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
153
|
+
eff.F.pipe(
|
|
154
|
+
AST__namespace.getClassIdentifier(component),
|
|
155
|
+
eff.O.filter((id) => !validate(id.name, options)),
|
|
156
|
+
eff.O.map((id) => {
|
|
157
|
+
context.report({
|
|
158
|
+
messageId: "componentName",
|
|
159
|
+
node: id,
|
|
160
|
+
data: {
|
|
161
|
+
case: options.rule
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
})
|
|
165
|
+
);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as AST from '@eslint-react/ast';
|
|
2
2
|
import { useComponentCollector, useComponentCollectorLegacy, isUseStateCall, isReactHookCallWithNameLoose } from '@eslint-react/core';
|
|
3
|
-
import { O, isString, isObject,
|
|
3
|
+
import { O, F, isString, isObject, isNullable } from '@eslint-react/eff';
|
|
4
4
|
import * as JSX from '@eslint-react/jsx';
|
|
5
5
|
import { createRuleForPlugin, getSettingsFromContext, RE_CONSTANT_CASE, RE_PASCAL_CASE, RE_CAMEL_CASE, RE_KEBAB_CASE, RE_SNAKE_CASE } from '@eslint-react/shared';
|
|
6
6
|
import { match } from 'ts-pattern';
|
|
@@ -10,7 +10,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
|
10
10
|
|
|
11
11
|
// package.json
|
|
12
12
|
var name = "eslint-plugin-react-naming-convention";
|
|
13
|
-
var version = "1.23.2-next.
|
|
13
|
+
var version = "1.23.2-next.6";
|
|
14
14
|
var createRule = createRuleForPlugin("naming-convention");
|
|
15
15
|
|
|
16
16
|
// src/rules/component-name.ts
|
|
@@ -71,7 +71,7 @@ function validate(name2, options) {
|
|
|
71
71
|
normalized = normalized.replace(/^_/, "");
|
|
72
72
|
}
|
|
73
73
|
return match(options.rule).with("CONSTANT_CASE", () => RE_CONSTANT_CASE.test(normalized)).with("PascalCase", () => {
|
|
74
|
-
if (
|
|
74
|
+
if (normalized.length > 3 && /^[A-Z]+$/u.test(normalized)) return options.allowAllCaps;
|
|
75
75
|
return RE_PASCAL_CASE.test(normalized);
|
|
76
76
|
}).otherwise(F.constFalse);
|
|
77
77
|
}
|
|
@@ -111,11 +111,10 @@ var component_name_default = createRule({
|
|
|
111
111
|
const functionComponents = collector.ctx.getAllComponents(node);
|
|
112
112
|
const classComponents = collectorLegacy.ctx.getAllComponents(node);
|
|
113
113
|
for (const { node: component } of functionComponents.values()) {
|
|
114
|
-
const
|
|
115
|
-
if (O.isNone(
|
|
116
|
-
const id =
|
|
117
|
-
|
|
118
|
-
if (validate(name2, options)) continue;
|
|
114
|
+
const mbId = AST.getFunctionIdentifier(component);
|
|
115
|
+
if (O.isNone(mbId)) continue;
|
|
116
|
+
const id = mbId.value;
|
|
117
|
+
if (validate(id.name, options)) continue;
|
|
119
118
|
context.report({
|
|
120
119
|
messageId: "componentName",
|
|
121
120
|
node: id,
|
|
@@ -125,18 +124,19 @@ var component_name_default = createRule({
|
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
126
|
for (const { node: component } of classComponents.values()) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
127
|
+
F.pipe(
|
|
128
|
+
AST.getClassIdentifier(component),
|
|
129
|
+
O.filter((id) => !validate(id.name, options)),
|
|
130
|
+
O.map((id) => {
|
|
131
|
+
context.report({
|
|
132
|
+
messageId: "componentName",
|
|
133
|
+
node: id,
|
|
134
|
+
data: {
|
|
135
|
+
case: options.rule
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
})
|
|
139
|
+
);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-naming-convention",
|
|
3
|
-
"version": "1.23.2-next.
|
|
3
|
+
"version": "1.23.2-next.6",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for naming convention related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"./package.json"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@typescript-eslint/scope-manager": "^8.19.
|
|
45
|
-
"@typescript-eslint/type-utils": "^8.19.
|
|
46
|
-
"@typescript-eslint/types": "^8.19.
|
|
47
|
-
"@typescript-eslint/utils": "^8.19.
|
|
44
|
+
"@typescript-eslint/scope-manager": "^8.19.1",
|
|
45
|
+
"@typescript-eslint/type-utils": "^8.19.1",
|
|
46
|
+
"@typescript-eslint/types": "^8.19.1",
|
|
47
|
+
"@typescript-eslint/utils": "^8.19.1",
|
|
48
48
|
"string-ts": "^2.2.0",
|
|
49
49
|
"ts-pattern": "^5.6.0",
|
|
50
|
-
"@eslint-react/
|
|
51
|
-
"@eslint-react/
|
|
52
|
-
"@eslint-react/jsx": "1.23.2-next.
|
|
53
|
-
"@eslint-react/
|
|
54
|
-
"@eslint-react/
|
|
55
|
-
"@eslint-react/
|
|
50
|
+
"@eslint-react/eff": "1.23.2-next.6",
|
|
51
|
+
"@eslint-react/core": "1.23.2-next.6",
|
|
52
|
+
"@eslint-react/jsx": "1.23.2-next.6",
|
|
53
|
+
"@eslint-react/ast": "1.23.2-next.6",
|
|
54
|
+
"@eslint-react/shared": "1.23.2-next.6",
|
|
55
|
+
"@eslint-react/types": "1.23.2-next.6"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@types/react": "^19.0.
|
|
58
|
+
"@types/react": "^19.0.3",
|
|
59
59
|
"@types/react-dom": "^19.0.2",
|
|
60
60
|
"tsup": "^8.3.5",
|
|
61
61
|
"@workspace/configs": "0.0.0"
|