@eslint-react/core 5.2.4-next.2 → 5.2.4-next.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.d.ts +14 -16
- package/dist/index.js +7 -12
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TSESTreeClass, TSESTreeDirective, TSESTreeFunction, TSESTreeMethodOrPropertyDefinition } from "@eslint-react/ast";
|
|
2
2
|
import { TSESTree } from "@typescript-eslint/types";
|
|
3
|
-
import { RuleContext } from "@eslint-react/eslint";
|
|
4
3
|
import { RegExpLike } from "@eslint-react/shared";
|
|
5
|
-
import { ESLintUtils, TSESTree as TSESTree$1 } from "@typescript-eslint/utils";
|
|
6
4
|
import ts from "typescript";
|
|
5
|
+
import { RuleContext } from "@eslint-react/eslint";
|
|
7
6
|
import { Scope } from "@typescript-eslint/scope-manager";
|
|
7
|
+
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
8
8
|
|
|
9
9
|
//#region src/api.d.ts
|
|
10
10
|
declare namespace isAPI {
|
|
@@ -315,7 +315,7 @@ type FunctionSemanticNode = ClientFunctionSemanticNode | ServerFunctionSemanticN
|
|
|
315
315
|
* @param node - The function node to analyze.
|
|
316
316
|
* @returns The identifier node if found, `null` otherwise.
|
|
317
317
|
*/
|
|
318
|
-
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.
|
|
318
|
+
declare function getFunctionId(node: TSESTree.Expression | TSESTreeFunction): TSESTree.ArrayExpression | TSESTree.ArrayPattern | TSESTree.ArrowFunctionExpression | TSESTree.AssignmentExpression | TSESTree.AwaitExpression | TSESTree.PrivateInExpression | TSESTree.SymmetricBinaryExpression | TSESTree.CallExpression | TSESTree.ChainExpression | TSESTree.ClassExpression | TSESTree.ConditionalExpression | TSESTree.FunctionExpression | TSESTree.Identifier | TSESTree.ImportExpression | TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.BigIntLiteral | TSESTree.BooleanLiteral | TSESTree.NullLiteral | TSESTree.NumberLiteral | TSESTree.RegExpLiteral | TSESTree.StringLiteral | TSESTree.TemplateLiteral | TSESTree.LogicalExpression | TSESTree.MemberExpressionComputedName | TSESTree.MemberExpressionNonComputedName | TSESTree.MetaProperty | TSESTree.NewExpression | TSESTree.ObjectExpression | TSESTree.ObjectPattern | TSESTree.SequenceExpression | TSESTree.Super | TSESTree.TaggedTemplateExpression | TSESTree.ThisExpression | TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion | TSESTree.UnaryExpressionBitwiseNot | TSESTree.UnaryExpressionDelete | TSESTree.UnaryExpressionMinus | TSESTree.UnaryExpressionNot | TSESTree.UnaryExpressionPlus | TSESTree.UnaryExpressionTypeof | TSESTree.UnaryExpressionVoid | TSESTree.UpdateExpression | TSESTree.YieldExpression | TSESTree.PrivateIdentifier | null;
|
|
319
319
|
/**
|
|
320
320
|
* Identifies the initialization path of a function node in the AST.
|
|
321
321
|
*
|
|
@@ -347,6 +347,16 @@ declare function getFunctionDirectives(node: TSESTreeFunction): TSESTreeDirectiv
|
|
|
347
347
|
* @returns `true` if the directive exists, `false` otherwise.
|
|
348
348
|
*/
|
|
349
349
|
declare function isFunctionHasDirective(node: TSESTreeFunction, name: string): boolean;
|
|
350
|
+
type FunctionDisplayNameAssignment = TSESTree.AssignmentExpression & {
|
|
351
|
+
left: TSESTree.MemberExpression & {
|
|
352
|
+
property: TSESTree.Identifier & {
|
|
353
|
+
name: "displayName";
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
operator: "=";
|
|
357
|
+
right: TSESTree.Literal;
|
|
358
|
+
};
|
|
359
|
+
declare const SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT: string;
|
|
350
360
|
//#endregion
|
|
351
361
|
//#region src/function-component.d.ts
|
|
352
362
|
/**
|
|
@@ -519,18 +529,6 @@ declare namespace getFunctionComponentCollector {
|
|
|
519
529
|
*/
|
|
520
530
|
declare function getFunctionComponentCollector(context: RuleContext, options?: getFunctionComponentCollector.Options): getFunctionComponentCollector.ReturnType;
|
|
521
531
|
//#endregion
|
|
522
|
-
//#region src/function-display-name.d.ts
|
|
523
|
-
type FunctionDisplayNameAssignment = TSESTree.AssignmentExpression & {
|
|
524
|
-
left: TSESTree.MemberExpression & {
|
|
525
|
-
property: TSESTree.Identifier & {
|
|
526
|
-
name: "displayName";
|
|
527
|
-
};
|
|
528
|
-
};
|
|
529
|
-
operator: "=";
|
|
530
|
-
right: TSESTree.Literal;
|
|
531
|
-
};
|
|
532
|
-
declare const SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT: string;
|
|
533
|
-
//#endregion
|
|
534
532
|
//#region src/hook.d.ts
|
|
535
533
|
/**
|
|
536
534
|
* Represents a semantic hook node in the AST
|
|
@@ -604,7 +602,7 @@ declare function isUseEffectCleanupCallback(node: TSESTree.Node | null): boolean
|
|
|
604
602
|
declare namespace getHookCollector {
|
|
605
603
|
type ReturnType = {
|
|
606
604
|
api: {
|
|
607
|
-
getAllHooks(node: TSESTree
|
|
605
|
+
getAllHooks(node: TSESTree.Program): HookSemanticNode[];
|
|
608
606
|
};
|
|
609
607
|
visitor: ESLintUtils.RuleListener;
|
|
610
608
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Check, Extract, Traverse, is, isOneOf } from "@eslint-react/ast";
|
|
2
2
|
import { resolveImportSource } from "@eslint-react/var";
|
|
3
3
|
import { AST_NODE_TYPES } from "@typescript-eslint/types";
|
|
4
|
-
import "@eslint-react/eslint";
|
|
5
4
|
import { randomBytes } from "node:crypto";
|
|
6
5
|
import { JsxDetectionHint, isJsxLike } from "@eslint-react/jsx";
|
|
7
6
|
import { RE_COMPONENT_NAME, RE_COMPONENT_NAME_LOOSE } from "@eslint-react/shared";
|
|
8
|
-
import { AST_NODE_TYPES as AST_NODE_TYPES$1 } from "@typescript-eslint/utils";
|
|
9
7
|
import { P, isMatching, match } from "ts-pattern";
|
|
10
8
|
import ts from "typescript";
|
|
11
9
|
|
|
@@ -543,6 +541,12 @@ function getFunctionDirectives(node) {
|
|
|
543
541
|
function isFunctionHasDirective(node, name) {
|
|
544
542
|
return getFunctionDirectives(node).some((d) => d.directive === name);
|
|
545
543
|
}
|
|
544
|
+
const SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT = [
|
|
545
|
+
"AssignmentExpression",
|
|
546
|
+
"[operator='=']",
|
|
547
|
+
"[left.type='MemberExpression']",
|
|
548
|
+
"[left.property.name='displayName']"
|
|
549
|
+
].join("");
|
|
546
550
|
|
|
547
551
|
//#endregion
|
|
548
552
|
//#region src/function-component.ts
|
|
@@ -706,15 +710,6 @@ function isFunctionComponentDefinition(context, node, hint) {
|
|
|
706
710
|
return true;
|
|
707
711
|
}
|
|
708
712
|
|
|
709
|
-
//#endregion
|
|
710
|
-
//#region src/function-display-name.ts
|
|
711
|
-
const SEL_FUNCTION_DISPLAY_NAME_ASSIGNMENT = [
|
|
712
|
-
"AssignmentExpression",
|
|
713
|
-
"[operator='=']",
|
|
714
|
-
"[left.type='MemberExpression']",
|
|
715
|
-
"[left.property.name='displayName']"
|
|
716
|
-
].join("");
|
|
717
|
-
|
|
718
713
|
//#endregion
|
|
719
714
|
//#region src/hook.ts
|
|
720
715
|
const REACT_BUILTIN_HOOK_NAMES = [
|
|
@@ -974,7 +969,7 @@ function getHookCollector(context) {
|
|
|
974
969
|
const entry = getCurrentEntry();
|
|
975
970
|
if (entry == null) return;
|
|
976
971
|
const { body } = entry.node;
|
|
977
|
-
if (body.type === AST_NODE_TYPES
|
|
972
|
+
if (body.type === AST_NODE_TYPES.BlockStatement) return;
|
|
978
973
|
entry.rets.push(body);
|
|
979
974
|
},
|
|
980
975
|
CallExpression(node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.2.4-next.
|
|
3
|
+
"version": "5.2.4-next.4",
|
|
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": {
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"@typescript-eslint/types": "^8.58.2",
|
|
35
35
|
"@typescript-eslint/utils": "^8.58.2",
|
|
36
36
|
"ts-pattern": "^5.9.0",
|
|
37
|
-
"@eslint-react/ast": "5.2.4-next.
|
|
38
|
-
"@eslint-react/eslint": "5.2.4-next.
|
|
39
|
-
"@eslint-react/
|
|
40
|
-
"@eslint-react/
|
|
41
|
-
"@eslint-react/
|
|
37
|
+
"@eslint-react/ast": "5.2.4-next.4",
|
|
38
|
+
"@eslint-react/eslint": "5.2.4-next.4",
|
|
39
|
+
"@eslint-react/shared": "5.2.4-next.4",
|
|
40
|
+
"@eslint-react/var": "5.2.4-next.4",
|
|
41
|
+
"@eslint-react/jsx": "5.2.4-next.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@typescript-eslint/typescript-estree": "^8.58.2",
|
|
45
45
|
"tsdown": "^0.21.9",
|
|
46
|
-
"@local/
|
|
47
|
-
"@local/
|
|
46
|
+
"@local/eff": "3.0.0-beta.72",
|
|
47
|
+
"@local/configs": "0.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"eslint": "^10.2.0",
|