@eslint-react/ast 5.30.0-beta.14 → 5.30.0-beta.16
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 +4 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ type TSESTreeTypeExpression = TSESTree.TSAsExpression | TSESTree.TSInstantiation
|
|
|
28
28
|
/** Union of expression node types that wrap another expression (TypeScript type expressions and chain expressions) — the nodes `Extract.unwrap` strips. */
|
|
29
29
|
type TSESTreeTypeOrChainExpression = TSESTree.ChainExpression | TSESTreeTypeExpression;
|
|
30
30
|
declare namespace check_d_exports {
|
|
31
|
-
export { is, isArrayPatternElementDefault, isCallExpression, isClass,
|
|
31
|
+
export { is, isArrayPatternElementDefault, isCallExpression, isClass, isConditionalOrLoop, isDirective, isExpression, isFunction, isFunctionOrClass, isIdentifier, isJSX, isJSXElement, isJSXElementOrFragment, isJSXExpressionContainer, isJSXFragment, isJSXSpreadAttribute, isJSXTagNameExpression, isLoopStatement, isMemberExpression, isObjectExpression, isObjectPatternElementDefault, isOneOf, isProperty, isPropertyOrMethod, isReturnStatement, isTypeAssertionExpression, isTypeExpression, isTypeOrChainExpression };
|
|
32
32
|
}
|
|
33
33
|
/** Check if a node is of the given type. */
|
|
34
34
|
declare const is: <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) => (node: TSESTree.Node | null | undefined) => node is Extract<TSESTree.Node, {
|
|
@@ -67,8 +67,8 @@ declare const isLoopStatement: (node: TSESTree.Node | null | undefined) => node
|
|
|
67
67
|
declare const isReturnStatement: (node: TSESTree.Node | null | undefined) => node is TSESTree.ReturnStatement;
|
|
68
68
|
/** Check if a node is a class declaration or class expression. */
|
|
69
69
|
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression;
|
|
70
|
-
/** Check if a node is a conditional or logical expression, or a
|
|
71
|
-
declare const
|
|
70
|
+
/** Check if a node is a conditional or logical expression, a conditional statement, or a loop statement. */
|
|
71
|
+
declare const isConditionalOrLoop: (node: TSESTree.Node | null | undefined) => node is TSESTree.ConditionalExpression | TSESTree.DoWhileStatement | TSESTree.ForInStatement | TSESTree.ForOfStatement | TSESTree.ForStatement | TSESTree.IfStatement | TSESTree.LogicalExpression | TSESTree.SwitchStatement | TSESTree.WhileStatement;
|
|
72
72
|
/** Check if a node is a function declaration, function expression, or arrow function expression. */
|
|
73
73
|
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpressionWithBlockBody | TSESTree.ArrowFunctionExpressionWithExpressionBody | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression;
|
|
74
74
|
/** Check if a node is a function declaration, function expression, arrow function expression, class declaration, or class expression. */
|
|
@@ -128,7 +128,7 @@ declare namespace compare_d_exports {
|
|
|
128
128
|
/**
|
|
129
129
|
* Check if two nodes are structurally equal.
|
|
130
130
|
*
|
|
131
|
-
* - Supports identifiers, literals, template literals/elements, member/call/chain expressions, JSX identifiers/namespaced names/member expressions/attributes, and `this`.
|
|
131
|
+
* - Supports identifiers, private identifiers, literals, template literals/elements, member/call/chain expressions, JSX identifiers/namespaced names/member expressions/attributes, and `this`.
|
|
132
132
|
* - Node types outside that list (including functions and classes) are equal only when they are the same node.
|
|
133
133
|
* - Compares chain expressions through their inner expression, so optional segments remain significant (`a?.b` equals `a?.b` but not `a.b`).
|
|
134
134
|
* - Compares literals by value and regex literals by `pattern` and `flags`.
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ var check_exports = /* @__PURE__ */ __exportAll({
|
|
|
8
8
|
isArrayPatternElementDefault: () => isArrayPatternElementDefault,
|
|
9
9
|
isCallExpression: () => isCallExpression,
|
|
10
10
|
isClass: () => isClass,
|
|
11
|
-
|
|
11
|
+
isConditionalOrLoop: () => isConditionalOrLoop,
|
|
12
12
|
isDirective: () => isDirective,
|
|
13
13
|
isExpression: () => isExpression,
|
|
14
14
|
isFunction: () => isFunction$1,
|
|
@@ -90,7 +90,7 @@ const isLoopStatement = isOneOf([
|
|
|
90
90
|
]);
|
|
91
91
|
const isReturnStatement = is(AST_NODE_TYPES.ReturnStatement);
|
|
92
92
|
const isClass = isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]);
|
|
93
|
-
const
|
|
93
|
+
const isConditionalOrLoop = isOneOf([
|
|
94
94
|
AST_NODE_TYPES.IfStatement,
|
|
95
95
|
AST_NODE_TYPES.LogicalExpression,
|
|
96
96
|
AST_NODE_TYPES.ConditionalExpression,
|
|
@@ -293,8 +293,8 @@ function getJSXName(node) {
|
|
|
293
293
|
function getFullyQualifiedName(node, getText) {
|
|
294
294
|
const expr = unwrap(node);
|
|
295
295
|
switch (expr.type) {
|
|
296
|
-
case AST_NODE_TYPES.Identifier:
|
|
297
|
-
case AST_NODE_TYPES.PrivateIdentifier: return expr.name
|
|
296
|
+
case AST_NODE_TYPES.Identifier: return expr.name;
|
|
297
|
+
case AST_NODE_TYPES.PrivateIdentifier: return `#${expr.name}`;
|
|
298
298
|
case AST_NODE_TYPES.JSXIdentifier:
|
|
299
299
|
case AST_NODE_TYPES.JSXMemberExpression:
|
|
300
300
|
case AST_NODE_TYPES.JSXNamespacedName: return getJSXName(expr);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "5.30.0-beta.
|
|
3
|
+
"version": "5.30.0-beta.16",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@tsconfig/node20": "^20.1.10",
|
|
41
41
|
"@types/node": "^20.19.43",
|
|
42
42
|
"eslint": "^10.13.0",
|
|
43
|
-
"tsdown": "^0.23.
|
|
43
|
+
"tsdown": "^0.23.4",
|
|
44
44
|
"typescript": "6.0.3",
|
|
45
45
|
"vitest": "^5.0.5"
|
|
46
46
|
},
|