@eslint-react/ast 3.0.0-next.1 → 3.0.0-next.12
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 +30 -28
- package/dist/index.js +51 -48
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -77,34 +77,6 @@ type TSESTreeDirectiveLike = TSESTree$1.ExpressionStatement & {
|
|
|
77
77
|
*/
|
|
78
78
|
declare function getClassId(node: TSESTreeClass): TSESTree.BindingName | unit;
|
|
79
79
|
//#endregion
|
|
80
|
-
//#region src/directive-helper.d.ts
|
|
81
|
-
/**
|
|
82
|
-
* Get all directive expression statements from the top of a program AST node
|
|
83
|
-
* @param node The program AST node
|
|
84
|
-
* @returns The array of directive string literals (e.g., "use strict")
|
|
85
|
-
*/
|
|
86
|
-
declare function getFileDirectives(node: TSESTree.Program): TSESTreeDirective[];
|
|
87
|
-
/**
|
|
88
|
-
* Get all directive expression statements from the top of a function AST node
|
|
89
|
-
* @param node The function AST node
|
|
90
|
-
* @returns The array of directive string literals (e.g., "use memo", "use no memo")
|
|
91
|
-
*/
|
|
92
|
-
declare function getFunctionDirectives(node: TSESTreeFunction): TSESTreeDirective[];
|
|
93
|
-
/**
|
|
94
|
-
* Check if a directive with the given name exists in the file or function directives
|
|
95
|
-
* @param node The program or function AST node
|
|
96
|
-
* @param name The directive name to check (e.g., "use strict", "use memo", "use no memo")
|
|
97
|
-
* @returns True if the directive exists, false otherwise
|
|
98
|
-
*/
|
|
99
|
-
declare function isDirectiveInFile(node: TSESTree.Program, name: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Check if a directive with the given name exists in the function directives
|
|
102
|
-
* @param node The function AST node
|
|
103
|
-
* @param name The directive name to check (e.g., "use memo", "use no memo")
|
|
104
|
-
* @returns True if the directive exists, false otherwise
|
|
105
|
-
*/
|
|
106
|
-
declare function isDirectiveInFunction(node: TSESTreeFunction, name: string): boolean;
|
|
107
|
-
//#endregion
|
|
108
80
|
//#region src/directive-is.d.ts
|
|
109
81
|
/**
|
|
110
82
|
* Check if a node is a directive expression statement
|
|
@@ -190,6 +162,36 @@ declare const getNestedNewExpressions: (node: TSESTree.Node) => TSESTree.NewExpr
|
|
|
190
162
|
*/
|
|
191
163
|
declare const getNestedCallExpressions: (node: TSESTree.Node) => TSESTree.CallExpression[];
|
|
192
164
|
//#endregion
|
|
165
|
+
//#region src/file-directive.d.ts
|
|
166
|
+
/**
|
|
167
|
+
* Get all directive expression statements from the top of a program AST node
|
|
168
|
+
* @param node The program AST node
|
|
169
|
+
* @returns The array of directive string literals (e.g., "use strict")
|
|
170
|
+
*/
|
|
171
|
+
declare function getFileDirectives(node: TSESTree.Program): TSESTreeDirective[];
|
|
172
|
+
/**
|
|
173
|
+
* Check if a directive with the given name exists in the file or function directives
|
|
174
|
+
* @param node The program or function AST node
|
|
175
|
+
* @param name The directive name to check (e.g., "use strict", "use memo", "use no memo")
|
|
176
|
+
* @returns True if the directive exists, false otherwise
|
|
177
|
+
*/
|
|
178
|
+
declare function isDirectiveInFile(node: TSESTree.Program, name: string): boolean;
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/function-directive.d.ts
|
|
181
|
+
/**
|
|
182
|
+
* Get all directive expression statements from the top of a function AST node
|
|
183
|
+
* @param node The function AST node
|
|
184
|
+
* @returns The array of directive string literals (e.g., "use memo", "use no memo")
|
|
185
|
+
*/
|
|
186
|
+
declare function getFunctionDirectives(node: TSESTreeFunction): TSESTreeDirective[];
|
|
187
|
+
/**
|
|
188
|
+
* Check if a directive with the given name exists in the function directives
|
|
189
|
+
* @param node The function AST node
|
|
190
|
+
* @param name The directive name to check (e.g., "use memo", "use no memo")
|
|
191
|
+
* @returns True if the directive exists, false otherwise
|
|
192
|
+
*/
|
|
193
|
+
declare function isDirectiveInFunction(node: TSESTreeFunction, name: string): boolean;
|
|
194
|
+
//#endregion
|
|
193
195
|
//#region src/function-id.d.ts
|
|
194
196
|
/**
|
|
195
197
|
* Gets the static name of a function AST node. For function declarations it is
|
package/dist/index.js
CHANGED
|
@@ -60,54 +60,6 @@ function isDirectiveLike(node) {
|
|
|
60
60
|
return node.type === AST_NODE_TYPES.ExpressionStatement && isLiteral(node.expression, "string") && isDirectiveName(node.expression.value);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region src/directive-helper.ts
|
|
65
|
-
/**
|
|
66
|
-
* Get all directive expression statements from the top of a program AST node
|
|
67
|
-
* @param node The program AST node
|
|
68
|
-
* @returns The array of directive string literals (e.g., "use strict")
|
|
69
|
-
*/
|
|
70
|
-
function getFileDirectives(node) {
|
|
71
|
-
const directives = [];
|
|
72
|
-
for (const stmt of node.body) {
|
|
73
|
-
if (!isDirective(stmt)) continue;
|
|
74
|
-
directives.push(stmt);
|
|
75
|
-
}
|
|
76
|
-
return directives;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Get all directive expression statements from the top of a function AST node
|
|
80
|
-
* @param node The function AST node
|
|
81
|
-
* @returns The array of directive string literals (e.g., "use memo", "use no memo")
|
|
82
|
-
*/
|
|
83
|
-
function getFunctionDirectives(node) {
|
|
84
|
-
const directives = [];
|
|
85
|
-
if (node.body.type !== AST_NODE_TYPES.BlockStatement) return directives;
|
|
86
|
-
for (const stmt of node.body.body) {
|
|
87
|
-
if (!isDirective(stmt)) continue;
|
|
88
|
-
directives.push(stmt);
|
|
89
|
-
}
|
|
90
|
-
return directives;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Check if a directive with the given name exists in the file or function directives
|
|
94
|
-
* @param node The program or function AST node
|
|
95
|
-
* @param name The directive name to check (e.g., "use strict", "use memo", "use no memo")
|
|
96
|
-
* @returns True if the directive exists, false otherwise
|
|
97
|
-
*/
|
|
98
|
-
function isDirectiveInFile(node, name) {
|
|
99
|
-
return getFileDirectives(node).some((d) => d.directive === name);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Check if a directive with the given name exists in the function directives
|
|
103
|
-
* @param node The function AST node
|
|
104
|
-
* @param name The directive name to check (e.g., "use memo", "use no memo")
|
|
105
|
-
* @returns True if the directive exists, false otherwise
|
|
106
|
-
*/
|
|
107
|
-
function isDirectiveInFunction(node, name) {
|
|
108
|
-
return getFunctionDirectives(node).some((d) => d.directive === name);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
63
|
//#endregion
|
|
112
64
|
//#region src/directive-kind.ts
|
|
113
65
|
/**
|
|
@@ -495,6 +447,57 @@ const getNestedNewExpressions = getNestedExpressionsOfType(AST_NODE_TYPES.NewExp
|
|
|
495
447
|
*/
|
|
496
448
|
const getNestedCallExpressions = getNestedExpressionsOfType(AST_NODE_TYPES.CallExpression);
|
|
497
449
|
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/file-directive.ts
|
|
452
|
+
/**
|
|
453
|
+
* Get all directive expression statements from the top of a program AST node
|
|
454
|
+
* @param node The program AST node
|
|
455
|
+
* @returns The array of directive string literals (e.g., "use strict")
|
|
456
|
+
*/
|
|
457
|
+
function getFileDirectives(node) {
|
|
458
|
+
const directives = [];
|
|
459
|
+
for (const stmt of node.body) {
|
|
460
|
+
if (!isDirective(stmt)) continue;
|
|
461
|
+
directives.push(stmt);
|
|
462
|
+
}
|
|
463
|
+
return directives;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Check if a directive with the given name exists in the file or function directives
|
|
467
|
+
* @param node The program or function AST node
|
|
468
|
+
* @param name The directive name to check (e.g., "use strict", "use memo", "use no memo")
|
|
469
|
+
* @returns True if the directive exists, false otherwise
|
|
470
|
+
*/
|
|
471
|
+
function isDirectiveInFile(node, name) {
|
|
472
|
+
return getFileDirectives(node).some((d) => d.directive === name);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/function-directive.ts
|
|
477
|
+
/**
|
|
478
|
+
* Get all directive expression statements from the top of a function AST node
|
|
479
|
+
* @param node The function AST node
|
|
480
|
+
* @returns The array of directive string literals (e.g., "use memo", "use no memo")
|
|
481
|
+
*/
|
|
482
|
+
function getFunctionDirectives(node) {
|
|
483
|
+
const directives = [];
|
|
484
|
+
if (node.body.type !== AST_NODE_TYPES.BlockStatement) return directives;
|
|
485
|
+
for (const stmt of node.body.body) {
|
|
486
|
+
if (!isDirective(stmt)) continue;
|
|
487
|
+
directives.push(stmt);
|
|
488
|
+
}
|
|
489
|
+
return directives;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Check if a directive with the given name exists in the function directives
|
|
493
|
+
* @param node The function AST node
|
|
494
|
+
* @param name The directive name to check (e.g., "use memo", "use no memo")
|
|
495
|
+
* @returns True if the directive exists, false otherwise
|
|
496
|
+
*/
|
|
497
|
+
function isDirectiveInFunction(node, name) {
|
|
498
|
+
return getFunctionDirectives(node).some((d) => d.directive === name);
|
|
499
|
+
}
|
|
500
|
+
|
|
498
501
|
//#endregion
|
|
499
502
|
//#region src/function-id.ts
|
|
500
503
|
/**
|
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.12",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"./package.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@typescript-eslint/types": "
|
|
34
|
-
"@typescript-eslint/typescript-estree": "
|
|
35
|
-
"@typescript-eslint/utils": "
|
|
33
|
+
"@typescript-eslint/types": "canary",
|
|
34
|
+
"@typescript-eslint/typescript-estree": "canary",
|
|
35
|
+
"@typescript-eslint/utils": "canary",
|
|
36
36
|
"string-ts": "^2.3.1",
|
|
37
|
-
"@eslint-react/eff": "3.0.0-next.
|
|
37
|
+
"@eslint-react/eff": "3.0.0-next.12"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsdown": "^0.20.3",
|