@eslint-react/ast 1.23.3-next.1 → 1.23.3-next.3
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -27
- package/dist/index.mjs +10 -28
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -2381,14 +2381,14 @@ declare function isEmptyFunction(node: TSESTreeFunction): boolean;
|
|
|
2381
2381
|
* @param node The node to check.
|
|
2382
2382
|
* @returns `true` if the node is a function expression or arrow function expression of a class method, `false` otherwise.
|
|
2383
2383
|
*/
|
|
2384
|
-
declare
|
|
2384
|
+
declare function isFunctionOfClassMethod(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
|
|
2385
2385
|
|
|
2386
2386
|
/**
|
|
2387
2387
|
* Checks if the given node is a function expression or arrow function expression of a class property.
|
|
2388
2388
|
* @param node The node to check.
|
|
2389
2389
|
* @returns `true` if the node is a function expression or arrow function expression of a class property, `false` otherwise.
|
|
2390
2390
|
*/
|
|
2391
|
-
declare
|
|
2391
|
+
declare function isFunctionOfClassProperty(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
|
|
2392
2392
|
|
|
2393
2393
|
declare function isFunctionOfImmediatelyInvoked(node: TSESTreeFunction): boolean;
|
|
2394
2394
|
|
|
@@ -2397,7 +2397,7 @@ declare function isFunctionOfImmediatelyInvoked(node: TSESTreeFunction): boolean
|
|
|
2397
2397
|
* @param node The node to check.
|
|
2398
2398
|
* @returns `true` if the node is a function expression or arrow function expression of a object method, `false` otherwise.
|
|
2399
2399
|
*/
|
|
2400
|
-
declare
|
|
2400
|
+
declare function isFunctionOfObjectMethod(node: TSESTree.Node): boolean;
|
|
2401
2401
|
|
|
2402
2402
|
declare function isKeyLiteralLike(node: TSESTree.MemberExpression | TSESTree.MethodDefinition | TSESTree.Property | TSESTree.PropertyDefinition, property: TSESTree.Node): boolean;
|
|
2403
2403
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2381,14 +2381,14 @@ declare function isEmptyFunction(node: TSESTreeFunction): boolean;
|
|
|
2381
2381
|
* @param node The node to check.
|
|
2382
2382
|
* @returns `true` if the node is a function expression or arrow function expression of a class method, `false` otherwise.
|
|
2383
2383
|
*/
|
|
2384
|
-
declare
|
|
2384
|
+
declare function isFunctionOfClassMethod(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
|
|
2385
2385
|
|
|
2386
2386
|
/**
|
|
2387
2387
|
* Checks if the given node is a function expression or arrow function expression of a class property.
|
|
2388
2388
|
* @param node The node to check.
|
|
2389
2389
|
* @returns `true` if the node is a function expression or arrow function expression of a class property, `false` otherwise.
|
|
2390
2390
|
*/
|
|
2391
|
-
declare
|
|
2391
|
+
declare function isFunctionOfClassProperty(node: TSESTree.Node): node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression;
|
|
2392
2392
|
|
|
2393
2393
|
declare function isFunctionOfImmediatelyInvoked(node: TSESTreeFunction): boolean;
|
|
2394
2394
|
|
|
@@ -2397,7 +2397,7 @@ declare function isFunctionOfImmediatelyInvoked(node: TSESTreeFunction): boolean
|
|
|
2397
2397
|
* @param node The node to check.
|
|
2398
2398
|
* @returns `true` if the node is a function expression or arrow function expression of a object method, `false` otherwise.
|
|
2399
2399
|
*/
|
|
2400
|
-
declare
|
|
2400
|
+
declare function isFunctionOfObjectMethod(node: TSESTree.Node): boolean;
|
|
2401
2401
|
|
|
2402
2402
|
declare function isKeyLiteralLike(node: TSESTree.MemberExpression | TSESTree.MethodDefinition | TSESTree.Property | TSESTree.PropertyDefinition, property: TSESTree.Node): boolean;
|
|
2403
2403
|
|
package/dist/index.js
CHANGED
|
@@ -488,36 +488,18 @@ function getTopLevelIdentifier(node) {
|
|
|
488
488
|
function isEmptyFunction(node) {
|
|
489
489
|
return node.body.type === types.AST_NODE_TYPES.BlockStatement && node.body.body.length === 0;
|
|
490
490
|
}
|
|
491
|
-
|
|
492
|
-
type
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
var isFunctionOfClassProperty = tsPattern.isMatching({
|
|
501
|
-
type: tsPattern.P.union([types.AST_NODE_TYPES.FunctionExpression, types.AST_NODE_TYPES.ArrowFunctionExpression]),
|
|
502
|
-
parent: {
|
|
503
|
-
type: types.AST_NODE_TYPES.Property,
|
|
504
|
-
parent: {
|
|
505
|
-
type: types.AST_NODE_TYPES.ClassBody
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
});
|
|
491
|
+
function isFunctionOfClassMethod(node) {
|
|
492
|
+
return (node.type === types.AST_NODE_TYPES.FunctionExpression || node.type === types.AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === types.AST_NODE_TYPES.MethodDefinition;
|
|
493
|
+
}
|
|
494
|
+
function isFunctionOfClassProperty(node) {
|
|
495
|
+
return (node.type === types.AST_NODE_TYPES.FunctionExpression || node.type === types.AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === types.AST_NODE_TYPES.Property;
|
|
496
|
+
}
|
|
509
497
|
function isFunctionOfImmediatelyInvoked(node) {
|
|
510
498
|
return node.type !== types.AST_NODE_TYPES.FunctionDeclaration && node.parent.type === types.AST_NODE_TYPES.CallExpression && node.parent.callee === node;
|
|
511
499
|
}
|
|
512
|
-
|
|
513
|
-
type
|
|
514
|
-
|
|
515
|
-
type: types.AST_NODE_TYPES.Property,
|
|
516
|
-
parent: {
|
|
517
|
-
type: types.AST_NODE_TYPES.ObjectExpression
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
});
|
|
500
|
+
function isFunctionOfObjectMethod(node) {
|
|
501
|
+
return (node.type === types.AST_NODE_TYPES.FunctionExpression || node.type === types.AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === types.AST_NODE_TYPES.Property && node.parent.parent.type === types.AST_NODE_TYPES.ObjectExpression;
|
|
502
|
+
}
|
|
521
503
|
function isKeyLiteralLike(node, property) {
|
|
522
504
|
return tsPattern.match(property).with({ type: types.AST_NODE_TYPES.Literal }, eff.F.constTrue).with({ type: types.AST_NODE_TYPES.TemplateLiteral, expressions: [] }, eff.F.constTrue).with({ type: types.AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(eff.F.constFalse);
|
|
523
505
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { F, O, or, isString } from '@eslint-react/eff';
|
|
2
2
|
import { AST_NODE_TYPES } from '@typescript-eslint/types';
|
|
3
3
|
import { ASTUtils } from '@typescript-eslint/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { match, P } from 'ts-pattern';
|
|
5
5
|
import { AST_NODE_TYPES as AST_NODE_TYPES$1, simpleTraverse } from '@typescript-eslint/typescript-estree';
|
|
6
6
|
import { zip } from '@eslint-react/types';
|
|
7
7
|
import { toLowerCase, delimiterCase, replace } from 'string-ts';
|
|
@@ -486,36 +486,18 @@ function getTopLevelIdentifier(node) {
|
|
|
486
486
|
function isEmptyFunction(node) {
|
|
487
487
|
return node.body.type === AST_NODE_TYPES.BlockStatement && node.body.body.length === 0;
|
|
488
488
|
}
|
|
489
|
-
|
|
490
|
-
type
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
var isFunctionOfClassProperty = isMatching({
|
|
499
|
-
type: P.union([AST_NODE_TYPES.FunctionExpression, AST_NODE_TYPES.ArrowFunctionExpression]),
|
|
500
|
-
parent: {
|
|
501
|
-
type: AST_NODE_TYPES.Property,
|
|
502
|
-
parent: {
|
|
503
|
-
type: AST_NODE_TYPES.ClassBody
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
});
|
|
489
|
+
function isFunctionOfClassMethod(node) {
|
|
490
|
+
return (node.type === AST_NODE_TYPES.FunctionExpression || node.type === AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === AST_NODE_TYPES.MethodDefinition;
|
|
491
|
+
}
|
|
492
|
+
function isFunctionOfClassProperty(node) {
|
|
493
|
+
return (node.type === AST_NODE_TYPES.FunctionExpression || node.type === AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === AST_NODE_TYPES.Property;
|
|
494
|
+
}
|
|
507
495
|
function isFunctionOfImmediatelyInvoked(node) {
|
|
508
496
|
return node.type !== AST_NODE_TYPES.FunctionDeclaration && node.parent.type === AST_NODE_TYPES.CallExpression && node.parent.callee === node;
|
|
509
497
|
}
|
|
510
|
-
|
|
511
|
-
type
|
|
512
|
-
|
|
513
|
-
type: AST_NODE_TYPES.Property,
|
|
514
|
-
parent: {
|
|
515
|
-
type: AST_NODE_TYPES.ObjectExpression
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
});
|
|
498
|
+
function isFunctionOfObjectMethod(node) {
|
|
499
|
+
return (node.type === AST_NODE_TYPES.FunctionExpression || node.type === AST_NODE_TYPES.ArrowFunctionExpression) && node.parent.type === AST_NODE_TYPES.Property && node.parent.parent.type === AST_NODE_TYPES.ObjectExpression;
|
|
500
|
+
}
|
|
519
501
|
function isKeyLiteralLike(node, property) {
|
|
520
502
|
return match(property).with({ type: AST_NODE_TYPES.Literal }, F.constTrue).with({ type: AST_NODE_TYPES.TemplateLiteral, expressions: [] }, F.constTrue).with({ type: AST_NODE_TYPES.Identifier }, () => !node.computed).otherwise(F.constFalse);
|
|
521
503
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/ast",
|
|
3
|
-
"version": "1.23.3-next.
|
|
3
|
+
"version": "1.23.3-next.3",
|
|
4
4
|
"description": "ESLint React's TSESTree AST utility module.",
|
|
5
5
|
"homepage": "https://github.com/rEl1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@typescript-eslint/utils": "^8.19.1",
|
|
41
41
|
"string-ts": "^2.2.0",
|
|
42
42
|
"ts-pattern": "^5.6.0",
|
|
43
|
-
"@eslint-react/
|
|
44
|
-
"@eslint-react/
|
|
43
|
+
"@eslint-react/types": "1.23.3-next.3",
|
|
44
|
+
"@eslint-react/eff": "1.23.3-next.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"tsup": "^8.3.5",
|