@eslint-react/ast 1.40.2 → 1.40.3-next.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.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +6 -0
- package/dist/index.mjs +6 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -236,6 +236,13 @@ declare function isKindOfLiteral(node: TSESTree.Node, kind: "number"): node is T
|
|
|
236
236
|
declare function isKindOfLiteral(node: TSESTree.Node, kind: "regexp"): node is TSESTree.RegExpLiteral;
|
|
237
237
|
declare function isKindOfLiteral(node: TSESTree.Node, kind: "string"): node is TSESTree.StringLiteral;
|
|
238
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Check if a node is a line break
|
|
241
|
+
* @param node The AST node to check
|
|
242
|
+
* @returns boolean
|
|
243
|
+
*/
|
|
244
|
+
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
245
|
+
|
|
239
246
|
/**
|
|
240
247
|
* Check if a node is multiline
|
|
241
248
|
* @param node The AST node to check
|
|
@@ -273,4 +280,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
|
|
|
273
280
|
declare function toReadableNodeType(node: TSESTree.Node): "property" | "RegExp literal" | "string literal" | "number literal" | "bigint literal" | "boolean literal" | "symbol literal" | "undefined literal" | "object literal" | "function literal" | "null literal" | "identifier" | "member expression" | "JSX attribute" | "JSX element" | "JSX fragment" | "JSX identifier" | "JSX text" | "JSX closing element" | "JSX closing fragment" | "JSX empty expression" | "JSX expression container" | "JSX member expression" | "JSX namespaced name" | "JSX opening element" | "JSX opening fragment" | "JSX spread attribute" | "JSX spread child" | "decorator" | "program" | "super" | "accessor property" | "array expression" | "array pattern" | "function expression" | "arrow function expression" | "assignment expression" | "assignment pattern" | "await expression" | "binary expression" | "block statement" | "break statement" | "call expression" | "catch clause" | "chain expression" | "class body" | "class declaration" | "class expression" | "conditional expression" | "continue statement" | "debugger statement" | "while statement" | "do while statement" | "empty statement" | "export all declaration" | "export default declaration" | "export named declaration" | "export specifier" | "expression statement" | "for in statement" | "for of statement" | "for statement" | "function declaration" | "if statement" | "import attribute" | "import declaration" | "import default specifier" | "import expression" | "import namespace specifier" | "import specifier" | "labeled statement" | "logical expression" | "meta property" | "method definition" | "new expression" | "object expression" | "object pattern" | "private identifier" | "property definition" | "rest element" | "return statement" | "sequence expression" | "spread element" | "static block" | "switch case" | "switch statement" | "tagged template expression" | "template element" | "template literal" | "this expression" | "throw statement" | "try statement" | "unary expression" | "update expression" | "variable declaration" | "variable declarator" | "with statement" | "yield expression" | "ts abstract accessor property" | "ts abstract keyword" | "ts abstract method definition" | "ts abstract property definition" | "ts any keyword" | "ts array type" | "ts as expression" | "ts async keyword" | "ts big int keyword" | "ts boolean keyword" | "ts call signature declaration" | "ts class implements" | "ts conditional type" | "ts constructor type" | "ts construct signature declaration" | "ts declare function" | "ts declare keyword" | "ts empty body function expression" | "ts enum body" | "ts enum declaration" | "ts enum member" | "ts export assignment" | "ts export keyword" | "ts external module reference" | "ts function type" | "ts import equals declaration" | "ts import type" | "ts indexed access type" | "ts index signature" | "ts infer type" | "ts instantiation expression" | "ts interface body" | "ts interface declaration" | "ts interface heritage" | "ts intersection type" | "ts intrinsic keyword" | "ts literal type" | "ts mapped type" | "ts method signature" | "ts module block" | "ts module declaration" | "ts named tuple member" | "ts namespace export declaration" | "ts never keyword" | "ts non null expression" | "ts null keyword" | "ts number keyword" | "ts object keyword" | "ts optional type" | "ts parameter property" | "ts private keyword" | "ts property signature" | "ts protected keyword" | "ts public keyword" | "ts qualified name" | "ts readonly keyword" | "ts rest type" | "ts satisfies expression" | "ts static keyword" | "ts string keyword" | "ts symbol keyword" | "ts template literal type" | "ts this type" | "ts tuple type" | "ts type alias declaration" | "ts type annotation" | "ts type assertion" | "ts type literal" | "ts type operator" | "ts type parameter" | "ts type parameter declaration" | "ts type parameter instantiation" | "ts type predicate" | "ts type query" | "ts type reference" | "ts undefined keyword" | "ts union type" | "ts unknown keyword" | "ts void keyword";
|
|
274
281
|
type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
|
|
275
282
|
|
|
276
|
-
export { type FunctionInitPath, ITERATOR_FUNCTION_INDEX_PARAM_POSITION, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
|
|
283
|
+
export { type FunctionInitPath, ITERATOR_FUNCTION_INDEX_PARAM_POSITION, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
|
package/dist/index.d.ts
CHANGED
|
@@ -236,6 +236,13 @@ declare function isKindOfLiteral(node: TSESTree.Node, kind: "number"): node is T
|
|
|
236
236
|
declare function isKindOfLiteral(node: TSESTree.Node, kind: "regexp"): node is TSESTree.RegExpLiteral;
|
|
237
237
|
declare function isKindOfLiteral(node: TSESTree.Node, kind: "string"): node is TSESTree.StringLiteral;
|
|
238
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Check if a node is a line break
|
|
241
|
+
* @param node The AST node to check
|
|
242
|
+
* @returns boolean
|
|
243
|
+
*/
|
|
244
|
+
declare function isLineBreak(node: TSESTree.Node): boolean;
|
|
245
|
+
|
|
239
246
|
/**
|
|
240
247
|
* Check if a node is multiline
|
|
241
248
|
* @param node The AST node to check
|
|
@@ -273,4 +280,4 @@ declare function toReadableNodeName(node: TSESTree.Node, getText: (node: TSESTre
|
|
|
273
280
|
declare function toReadableNodeType(node: TSESTree.Node): "property" | "RegExp literal" | "string literal" | "number literal" | "bigint literal" | "boolean literal" | "symbol literal" | "undefined literal" | "object literal" | "function literal" | "null literal" | "identifier" | "member expression" | "JSX attribute" | "JSX element" | "JSX fragment" | "JSX identifier" | "JSX text" | "JSX closing element" | "JSX closing fragment" | "JSX empty expression" | "JSX expression container" | "JSX member expression" | "JSX namespaced name" | "JSX opening element" | "JSX opening fragment" | "JSX spread attribute" | "JSX spread child" | "decorator" | "program" | "super" | "accessor property" | "array expression" | "array pattern" | "function expression" | "arrow function expression" | "assignment expression" | "assignment pattern" | "await expression" | "binary expression" | "block statement" | "break statement" | "call expression" | "catch clause" | "chain expression" | "class body" | "class declaration" | "class expression" | "conditional expression" | "continue statement" | "debugger statement" | "while statement" | "do while statement" | "empty statement" | "export all declaration" | "export default declaration" | "export named declaration" | "export specifier" | "expression statement" | "for in statement" | "for of statement" | "for statement" | "function declaration" | "if statement" | "import attribute" | "import declaration" | "import default specifier" | "import expression" | "import namespace specifier" | "import specifier" | "labeled statement" | "logical expression" | "meta property" | "method definition" | "new expression" | "object expression" | "object pattern" | "private identifier" | "property definition" | "rest element" | "return statement" | "sequence expression" | "spread element" | "static block" | "switch case" | "switch statement" | "tagged template expression" | "template element" | "template literal" | "this expression" | "throw statement" | "try statement" | "unary expression" | "update expression" | "variable declaration" | "variable declarator" | "with statement" | "yield expression" | "ts abstract accessor property" | "ts abstract keyword" | "ts abstract method definition" | "ts abstract property definition" | "ts any keyword" | "ts array type" | "ts as expression" | "ts async keyword" | "ts big int keyword" | "ts boolean keyword" | "ts call signature declaration" | "ts class implements" | "ts conditional type" | "ts constructor type" | "ts construct signature declaration" | "ts declare function" | "ts declare keyword" | "ts empty body function expression" | "ts enum body" | "ts enum declaration" | "ts enum member" | "ts export assignment" | "ts export keyword" | "ts external module reference" | "ts function type" | "ts import equals declaration" | "ts import type" | "ts indexed access type" | "ts index signature" | "ts infer type" | "ts instantiation expression" | "ts interface body" | "ts interface declaration" | "ts interface heritage" | "ts intersection type" | "ts intrinsic keyword" | "ts literal type" | "ts mapped type" | "ts method signature" | "ts module block" | "ts module declaration" | "ts named tuple member" | "ts namespace export declaration" | "ts never keyword" | "ts non null expression" | "ts null keyword" | "ts number keyword" | "ts object keyword" | "ts optional type" | "ts parameter property" | "ts private keyword" | "ts property signature" | "ts protected keyword" | "ts public keyword" | "ts qualified name" | "ts readonly keyword" | "ts rest type" | "ts satisfies expression" | "ts static keyword" | "ts string keyword" | "ts symbol keyword" | "ts template literal type" | "ts this type" | "ts tuple type" | "ts type alias declaration" | "ts type annotation" | "ts type assertion" | "ts type literal" | "ts type operator" | "ts type parameter" | "ts type parameter declaration" | "ts type parameter instantiation" | "ts type predicate" | "ts type query" | "ts type reference" | "ts undefined keyword" | "ts union type" | "ts unknown keyword" | "ts void keyword";
|
|
274
281
|
type ReadableNodeType = ReturnType<typeof toReadableNodeType>;
|
|
275
282
|
|
|
276
|
-
export { type FunctionInitPath, ITERATOR_FUNCTION_INDEX_PARAM_POSITION, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
|
|
283
|
+
export { type FunctionInitPath, ITERATOR_FUNCTION_INDEX_PARAM_POSITION, type ReadableNodeType, type TSESTreeArrayTupleType, type TSESTreeClass, type TSESTreeDestructuringPattern, type TSESTreeFunction, type TSESTreeFunctionType, type TSESTreeJSX, type TSESTreeLoop, type TSESTreeMethodOrProperty, type TSESTreeProperty, type TSESTreeTypeAssertionExpression, type TSESTreeTypeDeclaration, type TSESTreeTypeExpression, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
|
package/dist/index.js
CHANGED
|
@@ -486,6 +486,11 @@ function isKindOfLiteral(node, kind) {
|
|
|
486
486
|
function isMultiLine(node) {
|
|
487
487
|
return node.loc.start.line !== node.loc.end.line;
|
|
488
488
|
}
|
|
489
|
+
|
|
490
|
+
// src/is-line-break.ts
|
|
491
|
+
function isLineBreak(node) {
|
|
492
|
+
return isOneOf([types.AST_NODE_TYPES.Literal, types.AST_NODE_TYPES.JSXText])(node) && typeof node.value === "string" && node.value.trim() === "" && isMultiLine(node);
|
|
493
|
+
}
|
|
489
494
|
var isNodeEqual = eff.dual(2, (a, b) => {
|
|
490
495
|
switch (true) {
|
|
491
496
|
case a === b:
|
|
@@ -608,6 +613,7 @@ exports.isJSXTagNameExpression = isJSXTagNameExpression;
|
|
|
608
613
|
exports.isKindOfLiteral = isKindOfLiteral;
|
|
609
614
|
exports.isLeftHandSideExpression = isLeftHandSideExpression;
|
|
610
615
|
exports.isLeftHandSideExpressionType = isLeftHandSideExpressionType;
|
|
616
|
+
exports.isLineBreak = isLineBreak;
|
|
611
617
|
exports.isLoop = isLoop;
|
|
612
618
|
exports.isMethodOrProperty = isMethodOrProperty;
|
|
613
619
|
exports.isMultiLine = isMultiLine;
|
package/dist/index.mjs
CHANGED
|
@@ -484,6 +484,11 @@ function isKindOfLiteral(node, kind) {
|
|
|
484
484
|
function isMultiLine(node) {
|
|
485
485
|
return node.loc.start.line !== node.loc.end.line;
|
|
486
486
|
}
|
|
487
|
+
|
|
488
|
+
// src/is-line-break.ts
|
|
489
|
+
function isLineBreak(node) {
|
|
490
|
+
return isOneOf([AST_NODE_TYPES.Literal, AST_NODE_TYPES.JSXText])(node) && typeof node.value === "string" && node.value.trim() === "" && isMultiLine(node);
|
|
491
|
+
}
|
|
487
492
|
var isNodeEqual = dual(2, (a, b) => {
|
|
488
493
|
switch (true) {
|
|
489
494
|
case a === b:
|
|
@@ -574,4 +579,4 @@ function toReadableNodeType(node) {
|
|
|
574
579
|
return toLowerCase(delimiterCase(node.type, " "));
|
|
575
580
|
}
|
|
576
581
|
|
|
577
|
-
export { ITERATOR_FUNCTION_INDEX_PARAM_POSITION, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
|
|
582
|
+
export { ITERATOR_FUNCTION_INDEX_PARAM_POSITION, findParentNode, getClassIdentifier, getEcmaExpression, getFunctionIdentifier, getFunctionInitPath, getLiteralValueType, getNestedCallExpressions, getNestedExpressionsOfType, getNestedIdentifiers, getNestedNewExpressions, getNestedReturnStatements, getPropertyName, getTopLevelIdentifier, hasCallInFunctionInitPath, is, isArrayMapCallLoose, isArrayTupleType, isClass, isConditional, isControlFlow, isDestructuringPattern, isEmptyFunction, isFunction, isFunctionType, isJSX, isJSXElement, isJSXFragment, isJSXTagNameExpression, isKindOfLiteral, isLeftHandSideExpression, isLeftHandSideExpressionType, isLineBreak, isLoop, isMethodOrProperty, isMultiLine, isNodeEqual, isOneOf, isProperty, isThisExpression, isTypeAssertionExpression, isTypeDeclaration, isTypeExpression, toReadableNodeName, toReadableNodeType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "1.40.
|
|
3
|
+
"version": "1.40.3-next.0",
|
|
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
|
"@typescript-eslint/utils": "^8.29.0",
|
|
41
41
|
"string-ts": "^2.2.1",
|
|
42
42
|
"ts-pattern": "^5.7.0",
|
|
43
|
-
"@eslint-react/eff": "1.40.
|
|
43
|
+
"@eslint-react/eff": "1.40.3-next.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"tsup": "^8.4.0",
|