@eslint-react/ast 3.0.0-next.77 → 3.0.0-next.79
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 +7 -7
- package/dist/index.js +6 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ type TSESTreeTypeExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullEx
|
|
|
55
55
|
*/
|
|
56
56
|
type TSESTreeTypeAssertionExpression = TSESTree$1.TSAsExpression | TSESTree$1.TSNonNullExpression | TSESTree$1.TSSatisfiesExpression | TSESTree$1.TSTypeAssertion;
|
|
57
57
|
/**
|
|
58
|
-
* Represents a directive expression statement in TSESTree (
|
|
58
|
+
* Represents a directive expression statement in TSESTree (ex: "use strict";)
|
|
59
59
|
*/
|
|
60
60
|
type TSESTreeDirective = TSESTree$1.ExpressionStatement & {
|
|
61
61
|
directive: string;
|
|
@@ -156,13 +156,13 @@ declare const getNestedCallExpressions: (node: TSESTree.Node) => TSESTree.CallEx
|
|
|
156
156
|
/**
|
|
157
157
|
* Get all directive expression statements from the top of a program AST node
|
|
158
158
|
* @param node The program AST node
|
|
159
|
-
* @returns The array of directive string literals (
|
|
159
|
+
* @returns The array of directive string literals (ex: "use strict")
|
|
160
160
|
*/
|
|
161
161
|
declare function getFileDirectives(node: TSESTree.Program): TSESTreeDirective[];
|
|
162
162
|
/**
|
|
163
163
|
* Check if a directive with the given name exists in the file or function directives
|
|
164
164
|
* @param node The program or function AST node
|
|
165
|
-
* @param name The directive name to check (
|
|
165
|
+
* @param name The directive name to check (ex: "use strict", "use memo", "use no memo")
|
|
166
166
|
* @returns True if the directive exists, false otherwise
|
|
167
167
|
*/
|
|
168
168
|
declare function isDirectiveInFile(node: TSESTree.Program, name: string): boolean;
|
|
@@ -171,13 +171,13 @@ declare function isDirectiveInFile(node: TSESTree.Program, name: string): boolea
|
|
|
171
171
|
/**
|
|
172
172
|
* Get all directive expression statements from the top of a function AST node
|
|
173
173
|
* @param node The function AST node
|
|
174
|
-
* @returns The array of directive string literals (
|
|
174
|
+
* @returns The array of directive string literals (ex: "use memo", "use no memo")
|
|
175
175
|
*/
|
|
176
176
|
declare function getFunctionDirectives(node: TSESTreeFunction): TSESTreeDirective[];
|
|
177
177
|
/**
|
|
178
178
|
* Check if a directive with the given name exists in the function directives
|
|
179
179
|
* @param node The function AST node
|
|
180
|
-
* @param name The directive name to check (
|
|
180
|
+
* @param name The directive name to check (ex: "use memo", "use no memo")
|
|
181
181
|
* @returns True if the directive exists, false otherwise
|
|
182
182
|
*/
|
|
183
183
|
declare function isDirectiveInFunction(node: TSESTreeFunction, name: string): boolean;
|
|
@@ -214,7 +214,7 @@ declare function getFunctionInitPath(node: TSESTreeFunction): null | FunctionIni
|
|
|
214
214
|
* Check if a specific function call exists in the function initialization path.
|
|
215
215
|
* Useful for detecting HOCs like React.memo, React.forwardRef, etc.
|
|
216
216
|
*
|
|
217
|
-
* @param callName The name of the call to check for (
|
|
217
|
+
* @param callName The name of the call to check for (ex: "memo", "forwardRef")
|
|
218
218
|
* @param initPath The function initialization path to search in
|
|
219
219
|
* @returns True if the call exists in the path, false otherwise
|
|
220
220
|
*/
|
|
@@ -256,7 +256,7 @@ declare function isIdentifierName(name: string): boolean;
|
|
|
256
256
|
* Get the root identifier of a (possibly nested) member expression.
|
|
257
257
|
* For `a.b.c`, returns the `a` Identifier node.
|
|
258
258
|
* @param node The expression to analyze
|
|
259
|
-
* @returns The root Identifier node, or null if it cannot be determined (
|
|
259
|
+
* @returns The root Identifier node, or null if it cannot be determined (ex: non-identifier root)
|
|
260
260
|
*/
|
|
261
261
|
declare function getRootIdentifier(node: TSESTree.Expression | TSESTree.PrivateIdentifier): TSESTree.Identifier | null;
|
|
262
262
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -572,7 +572,7 @@ const getNestedCallExpressions = getNestedExpressionsOfType(AST_NODE_TYPES.CallE
|
|
|
572
572
|
/**
|
|
573
573
|
* Get all directive expression statements from the top of a program AST node
|
|
574
574
|
* @param node The program AST node
|
|
575
|
-
* @returns The array of directive string literals (
|
|
575
|
+
* @returns The array of directive string literals (ex: "use strict")
|
|
576
576
|
*/
|
|
577
577
|
function getFileDirectives(node) {
|
|
578
578
|
const directives = [];
|
|
@@ -585,7 +585,7 @@ function getFileDirectives(node) {
|
|
|
585
585
|
/**
|
|
586
586
|
* Check if a directive with the given name exists in the file or function directives
|
|
587
587
|
* @param node The program or function AST node
|
|
588
|
-
* @param name The directive name to check (
|
|
588
|
+
* @param name The directive name to check (ex: "use strict", "use memo", "use no memo")
|
|
589
589
|
* @returns True if the directive exists, false otherwise
|
|
590
590
|
*/
|
|
591
591
|
function isDirectiveInFile(node, name) {
|
|
@@ -597,7 +597,7 @@ function isDirectiveInFile(node, name) {
|
|
|
597
597
|
/**
|
|
598
598
|
* Get all directive expression statements from the top of a function AST node
|
|
599
599
|
* @param node The function AST node
|
|
600
|
-
* @returns The array of directive string literals (
|
|
600
|
+
* @returns The array of directive string literals (ex: "use memo", "use no memo")
|
|
601
601
|
*/
|
|
602
602
|
function getFunctionDirectives(node) {
|
|
603
603
|
const directives = [];
|
|
@@ -611,7 +611,7 @@ function getFunctionDirectives(node) {
|
|
|
611
611
|
/**
|
|
612
612
|
* Check if a directive with the given name exists in the function directives
|
|
613
613
|
* @param node The function AST node
|
|
614
|
-
* @param name The directive name to check (
|
|
614
|
+
* @param name The directive name to check (ex: "use memo", "use no memo")
|
|
615
615
|
* @returns True if the directive exists, false otherwise
|
|
616
616
|
*/
|
|
617
617
|
function isDirectiveInFunction(node, name) {
|
|
@@ -698,7 +698,7 @@ function getFunctionInitPath(node) {
|
|
|
698
698
|
* Check if a specific function call exists in the function initialization path.
|
|
699
699
|
* Useful for detecting HOCs like React.memo, React.forwardRef, etc.
|
|
700
700
|
*
|
|
701
|
-
* @param callName The name of the call to check for (
|
|
701
|
+
* @param callName The name of the call to check for (ex: "memo", "forwardRef")
|
|
702
702
|
* @param initPath The function initialization path to search in
|
|
703
703
|
* @returns True if the call exists in the path, false otherwise
|
|
704
704
|
*/
|
|
@@ -760,7 +760,7 @@ function isIdentifierName(name) {
|
|
|
760
760
|
* Get the root identifier of a (possibly nested) member expression.
|
|
761
761
|
* For `a.b.c`, returns the `a` Identifier node.
|
|
762
762
|
* @param node The expression to analyze
|
|
763
|
-
* @returns The root Identifier node, or null if it cannot be determined (
|
|
763
|
+
* @returns The root Identifier node, or null if it cannot be determined (ex: non-identifier root)
|
|
764
764
|
*/
|
|
765
765
|
function getRootIdentifier(node) {
|
|
766
766
|
const expr = getUnderlyingExpression(node);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.79",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"string-ts": "^2.3.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"tsdown": "^0.21.0
|
|
39
|
+
"tsdown": "^0.21.0",
|
|
40
40
|
"@local/configs": "0.0.0",
|
|
41
41
|
"@local/eff": "3.0.0-beta.72"
|
|
42
42
|
},
|