eslint-plugin-react-naming-convention 2.0.1-beta.1 → 2.0.1-beta.4
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 +9 -9
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getConfigAdapters, getDocsUrl } from "@eslint-react/shared";
|
|
2
2
|
import * as AST from "@eslint-react/ast";
|
|
3
|
-
import
|
|
3
|
+
import { getInstanceId, isComponentName, isCreateContextCall, isUseStateCall, useComponentCollector, useComponentCollectorLegacy } from "@eslint-react/core";
|
|
4
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";
|
|
@@ -32,7 +32,7 @@ const rules = { "react-naming-convention/context-name": "warn" };
|
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region package.json
|
|
34
34
|
var name = "eslint-plugin-react-naming-convention";
|
|
35
|
-
var version = "2.0.1-beta.
|
|
35
|
+
var version = "2.0.1-beta.4";
|
|
36
36
|
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region src/utils/create-rule.ts
|
|
@@ -82,8 +82,8 @@ var component_name_default = createRule({
|
|
|
82
82
|
function create$4(context) {
|
|
83
83
|
const options = normalizeOptions(context.options);
|
|
84
84
|
const { rule } = options;
|
|
85
|
-
const collector =
|
|
86
|
-
const collectorLegacy =
|
|
85
|
+
const collector = useComponentCollector(context);
|
|
86
|
+
const collectorLegacy = useComponentCollectorLegacy();
|
|
87
87
|
return {
|
|
88
88
|
...collector.listeners,
|
|
89
89
|
...collectorLegacy.listeners,
|
|
@@ -162,8 +162,8 @@ var context_name_default = createRule({
|
|
|
162
162
|
function create$3(context) {
|
|
163
163
|
if (!context.sourceCode.text.includes("createContext")) return {};
|
|
164
164
|
return { CallExpression(node) {
|
|
165
|
-
if (!
|
|
166
|
-
const id =
|
|
165
|
+
if (!isCreateContextCall(context, node)) return;
|
|
166
|
+
const id = getInstanceId(node);
|
|
167
167
|
if (id == null) return;
|
|
168
168
|
const name$2 = match(id).with({
|
|
169
169
|
type: AST_NODE_TYPES.Identifier,
|
|
@@ -172,7 +172,7 @@ function create$3(context) {
|
|
|
172
172
|
type: AST_NODE_TYPES.MemberExpression,
|
|
173
173
|
property: { name: P.select(P.string) }
|
|
174
174
|
}, identity).otherwise(() => null);
|
|
175
|
-
if (name$2 != null &&
|
|
175
|
+
if (name$2 != null && isComponentName(name$2) && name$2.endsWith("Context")) return;
|
|
176
176
|
context.report({
|
|
177
177
|
messageId: "invalidContextName",
|
|
178
178
|
node: id
|
|
@@ -380,7 +380,7 @@ var use_state_default = createRule({
|
|
|
380
380
|
});
|
|
381
381
|
function create(context) {
|
|
382
382
|
return { CallExpression(node) {
|
|
383
|
-
if (!
|
|
383
|
+
if (!isUseStateCall(node)) return;
|
|
384
384
|
if (node.parent.type !== AST_NODE_TYPES.VariableDeclarator) {
|
|
385
385
|
context.report({
|
|
386
386
|
messageId: "invalidAssignment",
|
|
@@ -388,7 +388,7 @@ function create(context) {
|
|
|
388
388
|
});
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
|
-
const id =
|
|
391
|
+
const id = getInstanceId(node);
|
|
392
392
|
if (id?.type !== AST_NODE_TYPES.ArrayPattern) {
|
|
393
393
|
context.report({
|
|
394
394
|
messageId: "invalidAssignment",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-react-naming-convention",
|
|
3
|
-
"version": "2.0.1-beta.
|
|
3
|
+
"version": "2.0.1-beta.4",
|
|
4
4
|
"description": "ESLint React's ESLint plugin for naming convention related rules.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"@typescript-eslint/utils": "^8.44.1",
|
|
42
42
|
"string-ts": "^2.2.1",
|
|
43
43
|
"ts-pattern": "^5.8.0",
|
|
44
|
-
"@eslint-react/
|
|
45
|
-
"@eslint-react/
|
|
46
|
-
"@eslint-react/
|
|
47
|
-
"@eslint-react/
|
|
48
|
-
"@eslint-react/var": "2.0.1-beta.
|
|
49
|
-
"@eslint-react/
|
|
44
|
+
"@eslint-react/ast": "2.0.1-beta.4",
|
|
45
|
+
"@eslint-react/core": "2.0.1-beta.4",
|
|
46
|
+
"@eslint-react/kit": "2.0.1-beta.4",
|
|
47
|
+
"@eslint-react/shared": "2.0.1-beta.4",
|
|
48
|
+
"@eslint-react/var": "2.0.1-beta.4",
|
|
49
|
+
"@eslint-react/eff": "2.0.1-beta.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/react": "^19.1.
|
|
52
|
+
"@types/react": "^19.1.14",
|
|
53
53
|
"@types/react-dom": "^19.1.9",
|
|
54
54
|
"tsdown": "^0.15.4",
|
|
55
55
|
"@local/configs": "0.0.0"
|