@eslint-react/core 5.2.3-beta.0 → 5.2.3-beta.2
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 +1 -7
- package/dist/index.js +6 -9
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -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
|
*
|
|
@@ -338,12 +338,6 @@ declare function isFunctionHasCallInInitPath(callName: string, initPath: Functio
|
|
|
338
338
|
* @returns `true` if the function is empty, `false` otherwise.
|
|
339
339
|
*/
|
|
340
340
|
declare function isFunctionEmpty(node: TSESTreeFunction): boolean;
|
|
341
|
-
/**
|
|
342
|
-
* Gets all directive expression statements from the top of a function body.
|
|
343
|
-
*
|
|
344
|
-
* @param node - The function AST node.
|
|
345
|
-
* @returns An array of directive expression statements.
|
|
346
|
-
*/
|
|
347
341
|
declare function getFunctionDirectives(node: TSESTreeFunction): TSESTreeDirective[];
|
|
348
342
|
/**
|
|
349
343
|
* Checks if a directive with the given name exists in the function directives.
|
package/dist/index.js
CHANGED
|
@@ -367,7 +367,7 @@ function isRenderMethodCallback(node) {
|
|
|
367
367
|
*/
|
|
368
368
|
function isThisSetStateCall(node) {
|
|
369
369
|
const { callee } = node;
|
|
370
|
-
return callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
370
|
+
return callee.type === AST_NODE_TYPES.MemberExpression && callee.object.type === AST_NODE_TYPES.ThisExpression && callee.property.type === AST_NODE_TYPES.Identifier && callee.property.name === "setState";
|
|
371
371
|
}
|
|
372
372
|
/**
|
|
373
373
|
* @param node The assignment expression node to check.
|
|
@@ -375,7 +375,7 @@ function isThisSetStateCall(node) {
|
|
|
375
375
|
*/
|
|
376
376
|
function isAssignmentToThisState(node) {
|
|
377
377
|
const { left } = node;
|
|
378
|
-
return left.type === AST_NODE_TYPES.MemberExpression &&
|
|
378
|
+
return left.type === AST_NODE_TYPES.MemberExpression && left.object.type === AST_NODE_TYPES.ThisExpression && Extract.propertyName(left.property) === "state";
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
//#endregion
|
|
@@ -521,17 +521,14 @@ function isFunctionHasCallInInitPath(callName, initPath) {
|
|
|
521
521
|
function isFunctionEmpty(node) {
|
|
522
522
|
return node.body.type === AST_NODE_TYPES.BlockStatement && node.body.body.length === 0;
|
|
523
523
|
}
|
|
524
|
-
/**
|
|
525
|
-
* Gets all directive expression statements from the top of a function body.
|
|
526
|
-
*
|
|
527
|
-
* @param node - The function AST node.
|
|
528
|
-
* @returns An array of directive expression statements.
|
|
529
|
-
*/
|
|
530
524
|
function getFunctionDirectives(node) {
|
|
531
525
|
const directives = [];
|
|
532
526
|
if (node.body.type !== AST_NODE_TYPES.BlockStatement) return directives;
|
|
527
|
+
function isDirective(node) {
|
|
528
|
+
return node.type === AST_NODE_TYPES.ExpressionStatement && node.directive != null;
|
|
529
|
+
}
|
|
533
530
|
for (const stmt of node.body.body) {
|
|
534
|
-
if (!
|
|
531
|
+
if (!isDirective(stmt)) continue;
|
|
535
532
|
directives.push(stmt);
|
|
536
533
|
}
|
|
537
534
|
return directives;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/core",
|
|
3
|
-
"version": "5.2.3-beta.
|
|
3
|
+
"version": "5.2.3-beta.2",
|
|
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": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@typescript-eslint/utils": "^8.58.2",
|
|
36
36
|
"ts-pattern": "^5.9.0",
|
|
37
37
|
"ulid": "^3.0.2",
|
|
38
|
-
"@eslint-react/ast": "5.2.3-beta.
|
|
39
|
-
"@eslint-react/eslint": "5.2.3-beta.
|
|
40
|
-
"@eslint-react/shared": "5.2.3-beta.
|
|
41
|
-
"@eslint-react/jsx": "5.2.3-beta.
|
|
42
|
-
"@eslint-react/var": "5.2.3-beta.
|
|
38
|
+
"@eslint-react/ast": "5.2.3-beta.2",
|
|
39
|
+
"@eslint-react/eslint": "5.2.3-beta.2",
|
|
40
|
+
"@eslint-react/shared": "5.2.3-beta.2",
|
|
41
|
+
"@eslint-react/jsx": "5.2.3-beta.2",
|
|
42
|
+
"@eslint-react/var": "5.2.3-beta.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@typescript-eslint/typescript-estree": "^8.58.2",
|