@eslint-react/ast 5.2.3-next.1 → 5.2.3-next.2
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 +9 -10
- package/dist/index.js +21 -23
- package/package.json +1 -1
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 {
|
|
16
|
+
export { is, isClass, isDirective, isFunction, isIdentifier, isJSX, isJSXElement, isJSXFragment, isJSXLike, isJSXTagNameExpression, isLiteral, isMethodOrProperty, isOneOf, isProperty, 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;
|
|
@@ -21,14 +21,14 @@ declare const is: <NodeType extends AST_NODE_TYPES>(nodeType: NodeType) => (node
|
|
|
21
21
|
declare const isOneOf: <NodeTypes extends readonly AST_NODE_TYPES[]>(nodeTypes: NodeTypes) => (node: TSESTree.Node | null | undefined) => node is Extract<TSESTree.Node, {
|
|
22
22
|
type: NodeTypes[number];
|
|
23
23
|
}>;
|
|
24
|
-
declare function
|
|
25
|
-
declare function
|
|
26
|
-
declare function
|
|
27
|
-
declare function
|
|
28
|
-
declare function
|
|
29
|
-
declare function
|
|
30
|
-
declare function
|
|
31
|
-
declare function
|
|
24
|
+
declare function isLiteral(): (node: TSESTree.Node) => node is TSESTree.Literal;
|
|
25
|
+
declare function isLiteral(kind: "boolean"): (node: TSESTree.Node) => node is TSESTree.BooleanLiteral;
|
|
26
|
+
declare function isLiteral(kind: "null"): (node: TSESTree.Node) => node is TSESTree.NullLiteral;
|
|
27
|
+
declare function isLiteral(kind: "number"): (node: TSESTree.Node) => node is TSESTree.NumberLiteral;
|
|
28
|
+
declare function isLiteral(kind: "regexp"): (node: TSESTree.Node) => node is TSESTree.RegExpLiteral;
|
|
29
|
+
declare function isLiteral(kind: "string"): (node: TSESTree.Node) => node is TSESTree.StringLiteral;
|
|
30
|
+
declare function isDirective(name: string): (node: TSESTree.Node) => node is TSESTreeDirective;
|
|
31
|
+
declare function isIdentifier(name: string): (node: TSESTree.Node) => node is TSESTree.Identifier;
|
|
32
32
|
declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression;
|
|
33
33
|
declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression;
|
|
34
34
|
declare const isMethodOrProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.MethodDefinitionComputedName | TSESTree.MethodDefinitionNonComputedName | TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName;
|
|
@@ -40,7 +40,6 @@ declare const isJSXTagNameExpression: (node: TSESTree.Node | null | undefined) =
|
|
|
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;
|
|
42
42
|
declare const isTypeAssertionExpression: (node: TSESTree.Node | null | undefined) => node is TSESTree.TSAsExpression | TSESTree.TSNonNullExpression | TSESTree.TSSatisfiesExpression | TSESTree.TSTypeAssertion;
|
|
43
|
-
declare function directive(node: TSESTree.Node): node is TSESTreeDirective;
|
|
44
43
|
declare namespace compare_d_exports {
|
|
45
44
|
export { areEqual };
|
|
46
45
|
}
|
package/dist/index.js
CHANGED
|
@@ -5,43 +5,44 @@ import { delimiterCase, replace, toLowerCase } from "string-ts";
|
|
|
5
5
|
|
|
6
6
|
//#region src/check.ts
|
|
7
7
|
var check_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
-
directive: () => directive,
|
|
9
|
-
identifier: () => identifier,
|
|
10
8
|
is: () => is,
|
|
11
9
|
isClass: () => isClass,
|
|
10
|
+
isDirective: () => isDirective,
|
|
12
11
|
isFunction: () => isFunction,
|
|
12
|
+
isIdentifier: () => isIdentifier,
|
|
13
13
|
isJSX: () => isJSX,
|
|
14
14
|
isJSXElement: () => isJSXElement,
|
|
15
15
|
isJSXFragment: () => isJSXFragment,
|
|
16
16
|
isJSXLike: () => isJSXLike,
|
|
17
17
|
isJSXTagNameExpression: () => isJSXTagNameExpression,
|
|
18
|
+
isLiteral: () => isLiteral,
|
|
18
19
|
isMethodOrProperty: () => isMethodOrProperty,
|
|
19
20
|
isOneOf: () => isOneOf,
|
|
20
21
|
isProperty: () => isProperty,
|
|
21
22
|
isTypeAssertionExpression: () => isTypeAssertionExpression,
|
|
22
|
-
isTypeExpression: () => isTypeExpression
|
|
23
|
-
literal: () => literal,
|
|
24
|
-
thisExpression: () => thisExpression
|
|
23
|
+
isTypeExpression: () => isTypeExpression
|
|
25
24
|
});
|
|
26
25
|
const is = ASTUtils.isNodeOfType;
|
|
27
26
|
const isOneOf = ASTUtils.isNodeOfTypes;
|
|
28
|
-
function
|
|
29
|
-
return
|
|
27
|
+
function isLiteral(kind) {
|
|
28
|
+
return (node) => {
|
|
29
|
+
if (node.type !== AST_NODE_TYPES.Literal) return false;
|
|
30
|
+
if (kind == null) return true;
|
|
31
|
+
switch (kind) {
|
|
32
|
+
case "boolean": return typeof node.value === "boolean";
|
|
33
|
+
case "null": return node.value === null;
|
|
34
|
+
case "number": return typeof node.value === "number";
|
|
35
|
+
case "regexp": return "regex" in node;
|
|
36
|
+
case "string": return typeof node.value === "string";
|
|
37
|
+
default: return false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
30
40
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
if (ofKind == null) return true;
|
|
34
|
-
switch (ofKind) {
|
|
35
|
-
case "boolean": return typeof node.value === "boolean";
|
|
36
|
-
case "null": return node.value === null;
|
|
37
|
-
case "number": return typeof node.value === "number";
|
|
38
|
-
case "regexp": return "regex" in node;
|
|
39
|
-
case "string": return typeof node.value === "string";
|
|
40
|
-
default: return false;
|
|
41
|
-
}
|
|
41
|
+
function isDirective(name) {
|
|
42
|
+
return (node) => node.type === AST_NODE_TYPES.ExpressionStatement && node.directive === name;
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
return
|
|
44
|
+
function isIdentifier(name) {
|
|
45
|
+
return (node) => node.type === AST_NODE_TYPES.Identifier && node.name === name;
|
|
45
46
|
}
|
|
46
47
|
const isFunction = isOneOf([
|
|
47
48
|
AST_NODE_TYPES.ArrowFunctionExpression,
|
|
@@ -94,9 +95,6 @@ const isTypeAssertionExpression = isOneOf([
|
|
|
94
95
|
AST_NODE_TYPES.TSNonNullExpression,
|
|
95
96
|
AST_NODE_TYPES.TSSatisfiesExpression
|
|
96
97
|
]);
|
|
97
|
-
function directive(node) {
|
|
98
|
-
return node.type === AST_NODE_TYPES.ExpressionStatement && node.directive != null;
|
|
99
|
-
}
|
|
100
98
|
|
|
101
99
|
//#endregion
|
|
102
100
|
//#region ../../.pkgs/eff/dist/index.js
|