@eslint-react/ast 2.0.0-next.154 → 2.0.0-next.156
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 +13 -13
- package/dist/index.js +15 -15
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -39,15 +39,15 @@ declare const is: <NodeType extends TSESTree.AST_NODE_TYPES>(nodeType: NodeType)
|
|
|
39
39
|
declare const isOneOf: <NodeTypes extends readonly TSESTree.AST_NODE_TYPES[]>(nodeTypes: NodeTypes) => (node: TSESTree.Node | null | undefined) => node is Extract<TSESTree.Node, {
|
|
40
40
|
type: NodeTypes[number];
|
|
41
41
|
}>;
|
|
42
|
-
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.
|
|
43
|
-
declare const isFunctionType: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.
|
|
44
|
-
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.
|
|
42
|
+
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName;
|
|
43
|
+
declare const isFunctionType: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructSignatureDeclaration | TSESTree.TSDeclareFunctionNoDeclare | TSESTree.TSDeclareFunctionWithDeclare | TSESTree.TSEmptyBodyFunctionExpression | TSESTree.TSFunctionType | TSESTree.TSMethodSignatureComputedName | TSESTree.TSMethodSignatureNonComputedName;
|
|
44
|
+
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassExpression | TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName;
|
|
45
45
|
declare const isMethodOrProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.MethodDefinitionComputedName | TSESTree.MethodDefinitionNonComputedName | TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName;
|
|
46
46
|
declare const isProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName | TSESTree.TSIndexSignature | TSESTree.TSParameterProperty | TSESTree.TSPropertySignatureComputedName | TSESTree.TSPropertySignatureNonComputedName;
|
|
47
47
|
declare const isJSXElement: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXElement;
|
|
48
48
|
declare const isJSXFragment: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXFragment;
|
|
49
49
|
declare const isJSXTagNameExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName;
|
|
50
|
-
declare const isJSX: (node: TSESTree.Node | null | undefined) => node is TSESTree.
|
|
50
|
+
declare const isJSX: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXElement | TSESTree.JSXFragment | TSESTree.JSXAttribute | TSESTree.JSXClosingElement | TSESTree.JSXClosingFragment | TSESTree.JSXEmptyExpression | TSESTree.JSXExpressionContainer | TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName | TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment | TSESTree.JSXSpreadAttribute | TSESTree.JSXSpreadChild | TSESTree.JSXText;
|
|
51
51
|
declare const isLoop: (node: TSESTree.Node | null | undefined) => node is TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.WhileStatement;
|
|
52
52
|
declare const isTypeExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
|
53
53
|
declare const isTypeAssertionExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSAsExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
|
@@ -162,7 +162,15 @@ declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionI
|
|
|
162
162
|
declare function isFunctionEmpty(node: TSESTreeFunction): boolean;
|
|
163
163
|
declare function isFunctionImmediatelyInvoked(node: TSESTreeFunction): boolean;
|
|
164
164
|
//#endregion
|
|
165
|
-
//#region src/
|
|
165
|
+
//#region src/literal.d.ts
|
|
166
|
+
declare function isLiteral(node: TSESTree.Node): node is TSESTree.Literal;
|
|
167
|
+
declare function isLiteral(node: TSESTree.Node, type: "boolean"): node is TSESTree.BooleanLiteral;
|
|
168
|
+
declare function isLiteral(node: TSESTree.Node, type: "null"): node is TSESTree.NullLiteral;
|
|
169
|
+
declare function isLiteral(node: TSESTree.Node, type: "number"): node is TSESTree.NumberLiteral;
|
|
170
|
+
declare function isLiteral(node: TSESTree.Node, type: "regexp"): node is TSESTree.RegExpLiteral;
|
|
171
|
+
declare function isLiteral(node: TSESTree.Node, type: "string"): node is TSESTree.StringLiteral;
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/misc.d.ts
|
|
166
174
|
/**
|
|
167
175
|
* Check if a node is multiline
|
|
168
176
|
* @param node The AST node to check
|
|
@@ -176,14 +184,6 @@ declare function isMultiLine(node: TSESTree.Node): boolean;
|
|
|
176
184
|
*/
|
|
177
185
|
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
178
186
|
//#endregion
|
|
179
|
-
//#region src/literal.d.ts
|
|
180
|
-
declare function isLiteral(node: TSESTree.Node): node is TSESTree.Literal;
|
|
181
|
-
declare function isLiteral(node: TSESTree.Node, type: "boolean"): node is TSESTree.BooleanLiteral;
|
|
182
|
-
declare function isLiteral(node: TSESTree.Node, type: "null"): node is TSESTree.NullLiteral;
|
|
183
|
-
declare function isLiteral(node: TSESTree.Node, type: "number"): node is TSESTree.NumberLiteral;
|
|
184
|
-
declare function isLiteral(node: TSESTree.Node, type: "regexp"): node is TSESTree.RegExpLiteral;
|
|
185
|
-
declare function isLiteral(node: TSESTree.Node, type: "string"): node is TSESTree.StringLiteral;
|
|
186
|
-
//#endregion
|
|
187
187
|
//#region src/promise-then.d.ts
|
|
188
188
|
declare function isThenCall(node: TSESTree.CallExpression): boolean;
|
|
189
189
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -520,7 +520,21 @@ function isFunctionImmediatelyInvoked(node) {
|
|
|
520
520
|
}
|
|
521
521
|
|
|
522
522
|
//#endregion
|
|
523
|
-
//#region src/
|
|
523
|
+
//#region src/literal.ts
|
|
524
|
+
function isLiteral(node, type) {
|
|
525
|
+
if (node.type !== AST_NODE_TYPES.Literal) return false;
|
|
526
|
+
if (type == null) return true;
|
|
527
|
+
switch (type) {
|
|
528
|
+
case "boolean": return typeof node.value === "boolean";
|
|
529
|
+
case "null": return node.value === null;
|
|
530
|
+
case "number": return typeof node.value === "number";
|
|
531
|
+
case "regexp": return "regex" in node;
|
|
532
|
+
case "string": return typeof node.value === "string";
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region src/misc.ts
|
|
524
538
|
/**
|
|
525
539
|
* Check if a node is multiline
|
|
526
540
|
* @param node The AST node to check
|
|
@@ -538,20 +552,6 @@ function isLineBreak(node) {
|
|
|
538
552
|
return isOneOf([AST_NODE_TYPES.Literal, AST_NODE_TYPES.JSXText])(node) && typeof node.value === "string" && node.value.trim() === "" && isMultiLine(node);
|
|
539
553
|
}
|
|
540
554
|
|
|
541
|
-
//#endregion
|
|
542
|
-
//#region src/literal.ts
|
|
543
|
-
function isLiteral(node, type) {
|
|
544
|
-
if (node.type !== AST_NODE_TYPES.Literal) return false;
|
|
545
|
-
if (type == null) return true;
|
|
546
|
-
switch (type) {
|
|
547
|
-
case "boolean": return typeof node.value === "boolean";
|
|
548
|
-
case "null": return node.value === null;
|
|
549
|
-
case "number": return typeof node.value === "number";
|
|
550
|
-
case "regexp": return "regex" in node;
|
|
551
|
-
case "string": return typeof node.value === "string";
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
|
|
555
555
|
//#endregion
|
|
556
556
|
//#region src/promise-then.ts
|
|
557
557
|
function isThenCall(node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.156",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@typescript-eslint/utils": "^8.41.0",
|
|
33
33
|
"string-ts": "^2.2.1",
|
|
34
34
|
"ts-pattern": "^5.8.0",
|
|
35
|
-
"@eslint-react/eff": "2.0.0-next.
|
|
35
|
+
"@eslint-react/eff": "2.0.0-next.156"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"tsdown": "^0.14.2",
|