@eslint-react/core 5.8.4-next.0 → 5.8.4-next.1
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.d.ts +3 -8
- package/dist/index.js +7 -4
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -178,16 +178,11 @@ interface ClassComponentSemanticNode extends SemanticNode {
|
|
|
178
178
|
node: TSESTreeClass;
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
|
-
* @param node The AST node to check.
|
|
182
|
-
* @deprecated Class components are legacy. This function exists only to support legacy rules.
|
|
183
|
-
*/
|
|
184
|
-
declare function isClassComponent(node: TSESTree.Node): node is TSESTreeClass;
|
|
185
|
-
/**
|
|
186
|
-
* @param node The AST node to check.
|
|
187
181
|
* @param context The rule context.
|
|
182
|
+
* @param node The AST node to check.
|
|
188
183
|
* @deprecated Class components are legacy. This function exists only to support legacy rules.
|
|
189
184
|
*/
|
|
190
|
-
declare function isClassComponent(node: TSESTree.Node
|
|
185
|
+
declare function isClassComponent(context: RuleContext, node: TSESTree.Node): node is TSESTreeClass;
|
|
191
186
|
declare function isClassComponentLoose(node: TSESTree.Node): node is TSESTreeClass;
|
|
192
187
|
/**
|
|
193
188
|
* @param node The AST node to check.
|
|
@@ -681,7 +676,7 @@ declare function isJsxLike(context: RuleContext, node: TSESTree.Node | null, hin
|
|
|
681
676
|
* annotations found in the source file.
|
|
682
677
|
*/
|
|
683
678
|
interface JsxConfig {
|
|
684
|
-
jsx?:
|
|
679
|
+
jsx?: ts.JsxEmit;
|
|
685
680
|
jsxFactory?: string;
|
|
686
681
|
jsxFragmentFactory?: string;
|
|
687
682
|
jsxImportSource?: string;
|
package/dist/index.js
CHANGED
|
@@ -268,17 +268,20 @@ function getClassId(node) {
|
|
|
268
268
|
|
|
269
269
|
//#endregion
|
|
270
270
|
//#region src/class-component.ts
|
|
271
|
-
|
|
271
|
+
/**
|
|
272
|
+
* @param context The rule context.
|
|
273
|
+
* @param node The AST node to check.
|
|
274
|
+
* @deprecated Class components are legacy. This function exists only to support legacy rules.
|
|
275
|
+
*/
|
|
276
|
+
function isClassComponent(context, node) {
|
|
272
277
|
if ("superClass" in node && node.superClass != null) {
|
|
273
278
|
const re = /^(?:Pure)?Component$/u;
|
|
274
279
|
switch (true) {
|
|
275
280
|
case node.superClass.type === AST_NODE_TYPES.Identifier:
|
|
276
281
|
if (!re.test(node.superClass.name)) return false;
|
|
277
|
-
if (context == null) return true;
|
|
278
282
|
return isAPIFromReact(node.superClass.name, context.sourceCode.getScope(node), "react");
|
|
279
283
|
case node.superClass.type === AST_NODE_TYPES.MemberExpression && node.superClass.property.type === AST_NODE_TYPES.Identifier:
|
|
280
284
|
if (!re.test(node.superClass.property.name)) return false;
|
|
281
|
-
if (context == null) return true;
|
|
282
285
|
if (node.superClass.object.type === AST_NODE_TYPES.Identifier) return isAPIFromReact(node.superClass.object.name, context.sourceCode.getScope(node), "react");
|
|
283
286
|
return true;
|
|
284
287
|
}
|
|
@@ -390,7 +393,7 @@ function getClassComponentCollector(context) {
|
|
|
390
393
|
} };
|
|
391
394
|
const getText = (n) => context.sourceCode.getText(n);
|
|
392
395
|
const collect = (node) => {
|
|
393
|
-
if (!isClassComponent(node)) return;
|
|
396
|
+
if (!isClassComponent(context, node)) return;
|
|
394
397
|
const id = getClassId(node);
|
|
395
398
|
const key = randomBytes(8).toString("hex");
|
|
396
399
|
const name = id == null ? null : Extract.getFullyQualifiedName(id, getText);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.8.4-next.
|
|
3
|
+
"version": "5.8.4-next.1",
|
|
4
4
|
"description": "ESLint React's ESLint utility module for static analysis of React core APIs and patterns.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@typescript-eslint/types": "^8.59.3",
|
|
34
34
|
"@typescript-eslint/utils": "^8.59.3",
|
|
35
35
|
"ts-pattern": "^5.9.0",
|
|
36
|
-
"@eslint-react/ast": "5.8.4-next.
|
|
37
|
-
"@eslint-react/eslint": "5.8.4-next.
|
|
38
|
-
"@eslint-react/
|
|
39
|
-
"@eslint-react/var": "5.8.4-next.
|
|
40
|
-
"@eslint-react/
|
|
36
|
+
"@eslint-react/ast": "5.8.4-next.1",
|
|
37
|
+
"@eslint-react/eslint": "5.8.4-next.1",
|
|
38
|
+
"@eslint-react/shared": "5.8.4-next.1",
|
|
39
|
+
"@eslint-react/var": "5.8.4-next.1",
|
|
40
|
+
"@eslint-react/jsx": "5.8.4-next.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@typescript-eslint/parser": "^8.59.3",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@local/eff": "workspace:*"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
|
-
"build": "tsdown
|
|
66
|
+
"build": "tsdown",
|
|
67
67
|
"build:docs": "typedoc",
|
|
68
68
|
"lint:publish": "publint",
|
|
69
69
|
"lint:ts": "tsl"
|