@eslint-react/ast 3.0.0-next.12 → 3.0.0-next.14
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 +20 -20
- package/dist/index.js +19 -19
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -108,15 +108,6 @@ declare function isDirectiveKind(kind: string): kind is DirectiveKind;
|
|
|
108
108
|
*/
|
|
109
109
|
declare function isDirectiveName(name: string): boolean;
|
|
110
110
|
//#endregion
|
|
111
|
-
//#region src/expression-base.d.ts
|
|
112
|
-
/**
|
|
113
|
-
* Unwraps any type expressions to get the underlying JavaScript expression node.
|
|
114
|
-
* Recursively processes nodes until a non-type expression is found.
|
|
115
|
-
* @param node The AST node to unwrap
|
|
116
|
-
* @returns The underlying JavaScript expression node
|
|
117
|
-
*/
|
|
118
|
-
declare function getUnderlyingExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTypeExpression>;
|
|
119
|
-
//#endregion
|
|
120
111
|
//#region src/expression-is.d.ts
|
|
121
112
|
/**
|
|
122
113
|
* Check if the given expression is a 'this' expression
|
|
@@ -455,7 +446,16 @@ declare function findParentNode<A extends TSESTree.Node>(node: TSESTree.Node | u
|
|
|
455
446
|
*/
|
|
456
447
|
declare function findParentNode(node: TSESTree.Node | unit, test: (node: TSESTree.Node) => boolean): TSESTree.Node | unit;
|
|
457
448
|
//#endregion
|
|
458
|
-
//#region src/
|
|
449
|
+
//#region src/node-unwrap.d.ts
|
|
450
|
+
/**
|
|
451
|
+
* Unwraps any type expressions to get the underlying JavaScript expression node.
|
|
452
|
+
* Recursively processes nodes until a non-type expression is found.
|
|
453
|
+
* @param node The AST node to unwrap
|
|
454
|
+
* @returns The underlying JavaScript expression node
|
|
455
|
+
*/
|
|
456
|
+
declare function getUnderlyingExpression(node: TSESTree.Node): Exclude<TSESTree.Node, TSESTreeTypeExpression>;
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/pattern-process-env-node-env.d.ts
|
|
459
459
|
/**
|
|
460
460
|
* Check if the given node is a member expression that accesses `process.env.NODE_ENV`
|
|
461
461
|
* @param node The AST node
|
|
@@ -471,16 +471,7 @@ declare function isProcessEnvNodeEnv(node: TSESTree.Node | null | unit): node is
|
|
|
471
471
|
*/
|
|
472
472
|
declare function isProcessEnvNodeEnvCompare(node: TSESTree.Node | null | unit, operator: "===" | "!==", value: "development" | "production"): node is TSESTree.BinaryExpression;
|
|
473
473
|
//#endregion
|
|
474
|
-
//#region src/
|
|
475
|
-
/**
|
|
476
|
-
* Get the name of a property from a node
|
|
477
|
-
* Handles identifiers, private identifiers, literals, and template literals
|
|
478
|
-
* @param node The node to get the property name from
|
|
479
|
-
* @returns The property name or unit if not determinable
|
|
480
|
-
*/
|
|
481
|
-
declare function getPropertyName(node: TSESTree.Node): string | unit;
|
|
482
|
-
//#endregion
|
|
483
|
-
//#region src/vitest-mock.d.ts
|
|
474
|
+
//#region src/pattern-vitest-mock.d.ts
|
|
484
475
|
/**
|
|
485
476
|
* Check if the given node is a `vi.mock`.
|
|
486
477
|
* @param node The node to check
|
|
@@ -496,4 +487,13 @@ declare function isViMock(node: TSESTree.Node | null | unit): node is TSESTree.M
|
|
|
496
487
|
*/
|
|
497
488
|
declare function isViMockCallback(node: TSESTree.Node | null | unit): boolean;
|
|
498
489
|
//#endregion
|
|
490
|
+
//#region src/property-name.d.ts
|
|
491
|
+
/**
|
|
492
|
+
* Get the name of a property from a node
|
|
493
|
+
* Handles identifiers, private identifiers, literals, and template literals
|
|
494
|
+
* @param node The node to get the property name from
|
|
495
|
+
* @returns The property name or unit if not determinable
|
|
496
|
+
*/
|
|
497
|
+
declare function getPropertyName(node: TSESTree.Node): string | unit;
|
|
498
|
+
//#endregion
|
|
499
499
|
export { DirectiveKind, DisplayNameAssignmentExpression, FunctionID, FunctionInitPath, ImplicitReturnArrowFunctionExpression, ObjectDestructuringVariableDeclarator, SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, TSESTreeArrayTupleType, TSESTreeClass, TSESTreeDestructuringPattern, TSESTreeDirective, TSESTreeDirectiveLike, TSESTreeFunction, TSESTreeFunctionType, TSESTreeJSX, TSESTreeJSXAttributeLike, TSESTreeLoop, TSESTreeMethodOrProperty, TSESTreeProperty, TSESTreeTypeAssertionExpression, TSESTreeTypeDeclaration, TSESTreeTypeExpression, findParentNode, getClassId, getFileDirectives, getFullyQualifiedName, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHumanReadableKind, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getUnderlyingExpression, hasCallInFunctionInitPath, is, isClass, isConditional, isControlFlow, isDirective, isDirectiveInFile, isDirectiveInFunction, isDirectiveKind, isDirectiveLike, isDirectiveName, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isIdentifier, isIdentifierName, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback };
|
package/dist/index.js
CHANGED
|
@@ -227,7 +227,7 @@ const isTypeAssertionExpression = isOneOf([
|
|
|
227
227
|
]);
|
|
228
228
|
|
|
229
229
|
//#endregion
|
|
230
|
-
//#region src/
|
|
230
|
+
//#region src/node-unwrap.ts
|
|
231
231
|
/**
|
|
232
232
|
* Unwraps any type expressions to get the underlying JavaScript expression node.
|
|
233
233
|
* Recursively processes nodes until a non-type expression is found.
|
|
@@ -737,7 +737,7 @@ const SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION = [
|
|
|
737
737
|
].join("");
|
|
738
738
|
|
|
739
739
|
//#endregion
|
|
740
|
-
//#region src/process-env-node-env.ts
|
|
740
|
+
//#region src/pattern-process-env-node-env.ts
|
|
741
741
|
/**
|
|
742
742
|
* Check if the given node is a member expression that accesses `process.env.NODE_ENV`
|
|
743
743
|
* @param node The AST node
|
|
@@ -763,23 +763,7 @@ function isProcessEnvNodeEnvCompare(node, operator, value) {
|
|
|
763
763
|
}
|
|
764
764
|
|
|
765
765
|
//#endregion
|
|
766
|
-
//#region src/
|
|
767
|
-
/**
|
|
768
|
-
* Get the name of a property from a node
|
|
769
|
-
* Handles identifiers, private identifiers, literals, and template literals
|
|
770
|
-
* @param node The node to get the property name from
|
|
771
|
-
* @returns The property name or unit if not determinable
|
|
772
|
-
*/
|
|
773
|
-
function getPropertyName(node) {
|
|
774
|
-
if (isTypeExpression(node)) return getPropertyName(getUnderlyingExpression(node));
|
|
775
|
-
if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier) return node.name;
|
|
776
|
-
if (node.type === AST_NODE_TYPES.Literal) return String(node.value);
|
|
777
|
-
if (node.type === AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) return node.quasis[0]?.value.raw;
|
|
778
|
-
return unit;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
//#endregion
|
|
782
|
-
//#region src/vitest-mock.ts
|
|
766
|
+
//#region src/pattern-vitest-mock.ts
|
|
783
767
|
/**
|
|
784
768
|
* Check if the given node is a `vi.mock`.
|
|
785
769
|
* @param node The node to check
|
|
@@ -799,5 +783,21 @@ function isViMockCallback(node) {
|
|
|
799
783
|
return node != null && isFunction(node) && node.parent.type === AST_NODE_TYPES.CallExpression && isViMock(node.parent.callee) && node.parent.arguments[1] === node;
|
|
800
784
|
}
|
|
801
785
|
|
|
786
|
+
//#endregion
|
|
787
|
+
//#region src/property-name.ts
|
|
788
|
+
/**
|
|
789
|
+
* Get the name of a property from a node
|
|
790
|
+
* Handles identifiers, private identifiers, literals, and template literals
|
|
791
|
+
* @param node The node to get the property name from
|
|
792
|
+
* @returns The property name or unit if not determinable
|
|
793
|
+
*/
|
|
794
|
+
function getPropertyName(node) {
|
|
795
|
+
if (isTypeExpression(node)) return getPropertyName(getUnderlyingExpression(node));
|
|
796
|
+
if (node.type === AST_NODE_TYPES.Identifier || node.type === AST_NODE_TYPES.PrivateIdentifier) return node.name;
|
|
797
|
+
if (node.type === AST_NODE_TYPES.Literal) return String(node.value);
|
|
798
|
+
if (node.type === AST_NODE_TYPES.TemplateLiteral && node.expressions.length === 0) return node.quasis[0]?.value.raw;
|
|
799
|
+
return unit;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
802
|
//#endregion
|
|
803
803
|
export { SEL_DISPLAY_NAME_ASSIGNMENT_EXPRESSION, SEL_IMPLICIT_RETURN_ARROW_FUNCTION_EXPRESSION, SEL_OBJECT_DESTRUCTURING_VARIABLE_DECLARATOR, findParentNode, getClassId, getFileDirectives, getFullyQualifiedName, getFunctionDirectives, getFunctionId, getFunctionInitPath, getHumanReadableKind, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getUnderlyingExpression, hasCallInFunctionInitPath, is, isClass, isConditional, isControlFlow, isDirective, isDirectiveInFile, isDirectiveInFunction, isDirectiveKind, isDirectiveLike, isDirectiveName, isFunction, isFunctionEmpty, isFunctionImmediatelyInvoked, isFunctionType, isIdentifier, isIdentifierName, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isLineBreak, isLiteral, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProcessEnvNodeEnv, isProcessEnvNodeEnvCompare, isProperty, isThisExpressionLoose, isTypeAssertionExpression, isTypeExpression, isViMock, isViMockCallback };
|
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.14",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@typescript-eslint/typescript-estree": "canary",
|
|
35
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.14"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsdown": "^0.20.3",
|