@eslint-react/ast 5.2.5-next.0 → 5.3.0-beta.0
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 +4 -4
- package/dist/index.js +6 -6
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type TSESTreeDirective = TSESTree.ExpressionStatement & {
|
|
|
13
13
|
};
|
|
14
14
|
type TSESTreeTypeExpression = TSESTree.TSAsExpression | TSESTree.TSTypeAssertion | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSInstantiationExpression;
|
|
15
15
|
declare namespace check_d_exports {
|
|
16
|
-
export { is, isClass, isDirective, isFunction, isIdentifier, isJSX, isJSXElement,
|
|
16
|
+
export { is, isClass, isDirective, isFunction, isIdentifier, isJSX, isJSXElement, isJSXElementOrFragment, isJSXFragment, isJSXTagNameExpression, isLiteral, isOneOf, isProperty, isPropertyOrMethod, isTypeAssertionExpression, isTypeExpression };
|
|
17
17
|
}
|
|
18
18
|
declare const is: <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree.Node | null | undefined) => node is Extract<TSESTree.Node, {
|
|
19
19
|
type: NodeType;
|
|
@@ -29,13 +29,13 @@ declare function isLiteral(kind: "regexp"): (node: TSESTree.Node) => node is TSE
|
|
|
29
29
|
declare function isLiteral(kind: "string"): (node: TSESTree.Node) => node is TSESTree.StringLiteral;
|
|
30
30
|
declare function isDirective(name: string): (node: TSESTree.Node) => node is TSESTreeDirective;
|
|
31
31
|
declare function isIdentifier(name: string): (node: TSESTree.Node) => node is TSESTree.Identifier;
|
|
32
|
-
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression;
|
|
33
32
|
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression;
|
|
34
|
-
declare const
|
|
33
|
+
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression;
|
|
35
34
|
declare const isProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName | TSESTree.TSIndexSignature | TSESTree.TSParameterProperty | TSESTree.TSPropertySignatureComputedName | TSESTree.TSPropertySignatureNonComputedName;
|
|
35
|
+
declare const isPropertyOrMethod: (node: TSESTree.Node | null | undefined) => node is TSESTree.MethodDefinitionComputedName | TSESTree.MethodDefinitionNonComputedName | TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName;
|
|
36
36
|
declare const isJSXElement: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXElement;
|
|
37
37
|
declare const isJSXFragment: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXFragment;
|
|
38
|
-
declare const
|
|
38
|
+
declare const isJSXElementOrFragment: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXElement | TSESTree.JSXFragment;
|
|
39
39
|
declare const isJSXTagNameExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName;
|
|
40
40
|
declare const isJSX: (node: TSESTree.Node | null | undefined) => node is TSESTree.JSXAttribute | TSESTree.JSXClosingElement | TSESTree.JSXClosingFragment | TSESTree.JSXElement | TSESTree.JSXEmptyExpression | TSESTree.JSXExpressionContainer | TSESTree.JSXFragment | TSESTree.JSXIdentifier | TSESTree.JSXMemberExpression | TSESTree.JSXNamespacedName | TSESTree.JSXOpeningElement | TSESTree.JSXOpeningFragment | TSESTree.JSXSpreadAttribute | TSESTree.JSXSpreadChild | TSESTree.JSXText;
|
|
41
41
|
declare const isTypeExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSAsExpression | TSESTree.TSInstantiationExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
package/dist/index.js
CHANGED
|
@@ -12,13 +12,13 @@ var check_exports = /* @__PURE__ */ __exportAll({
|
|
|
12
12
|
isIdentifier: () => isIdentifier,
|
|
13
13
|
isJSX: () => isJSX,
|
|
14
14
|
isJSXElement: () => isJSXElement,
|
|
15
|
+
isJSXElementOrFragment: () => isJSXElementOrFragment,
|
|
15
16
|
isJSXFragment: () => isJSXFragment,
|
|
16
|
-
isJSXLike: () => isJSXLike,
|
|
17
17
|
isJSXTagNameExpression: () => isJSXTagNameExpression,
|
|
18
18
|
isLiteral: () => isLiteral,
|
|
19
|
-
isMethodOrProperty: () => isMethodOrProperty,
|
|
20
19
|
isOneOf: () => isOneOf,
|
|
21
20
|
isProperty: () => isProperty,
|
|
21
|
+
isPropertyOrMethod: () => isPropertyOrMethod,
|
|
22
22
|
isTypeAssertionExpression: () => isTypeAssertionExpression,
|
|
23
23
|
isTypeExpression: () => isTypeExpression
|
|
24
24
|
});
|
|
@@ -44,22 +44,22 @@ function isDirective(name) {
|
|
|
44
44
|
function isIdentifier(name) {
|
|
45
45
|
return (node) => node.type === AST_NODE_TYPES.Identifier && node.name === name;
|
|
46
46
|
}
|
|
47
|
+
const isClass = isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]);
|
|
47
48
|
const isFunction = isOneOf([
|
|
48
49
|
AST_NODE_TYPES.ArrowFunctionExpression,
|
|
49
50
|
AST_NODE_TYPES.FunctionDeclaration,
|
|
50
51
|
AST_NODE_TYPES.FunctionExpression
|
|
51
52
|
]);
|
|
52
|
-
const isClass = isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]);
|
|
53
|
-
const isMethodOrProperty = isOneOf([AST_NODE_TYPES.PropertyDefinition, AST_NODE_TYPES.MethodDefinition]);
|
|
54
53
|
const isProperty = isOneOf([
|
|
55
54
|
AST_NODE_TYPES.PropertyDefinition,
|
|
56
55
|
AST_NODE_TYPES.TSIndexSignature,
|
|
57
56
|
AST_NODE_TYPES.TSParameterProperty,
|
|
58
57
|
AST_NODE_TYPES.TSPropertySignature
|
|
59
58
|
]);
|
|
59
|
+
const isPropertyOrMethod = isOneOf([AST_NODE_TYPES.PropertyDefinition, AST_NODE_TYPES.MethodDefinition]);
|
|
60
60
|
const isJSXElement = is(AST_NODE_TYPES.JSXElement);
|
|
61
61
|
const isJSXFragment = is(AST_NODE_TYPES.JSXFragment);
|
|
62
|
-
const
|
|
62
|
+
const isJSXElementOrFragment = isOneOf([AST_NODE_TYPES.JSXElement, AST_NODE_TYPES.JSXFragment]);
|
|
63
63
|
const isJSXTagNameExpression = isOneOf([
|
|
64
64
|
AST_NODE_TYPES.JSXIdentifier,
|
|
65
65
|
AST_NODE_TYPES.JSXMemberExpression,
|
|
@@ -224,7 +224,7 @@ var extract_exports = /* @__PURE__ */ __exportAll({
|
|
|
224
224
|
unwrap: () => unwrap
|
|
225
225
|
});
|
|
226
226
|
function unwrap(node) {
|
|
227
|
-
if (isTypeExpression(node)) return unwrap(node.expression);
|
|
227
|
+
if (isTypeExpression(node) || node.type === AST_NODE_TYPES.ChainExpression) return unwrap(node.expression);
|
|
228
228
|
return node;
|
|
229
229
|
}
|
|
230
230
|
function getRootIdentifier(node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0-beta.0",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@local/eff": "3.0.0-beta.72"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"eslint": "^10.2.
|
|
44
|
+
"eslint": "^10.2.1",
|
|
45
45
|
"typescript": "*"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|