@eslint-react/ast 5.8.5 → 5.8.6

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 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 { is, isClass, isDirective, isFunction, isIdentifier, isJSX, isJSXElement, isJSXElementOrFragment, isJSXFragment, isJSXTagNameExpression, isLiteral, isOneOf, isProperty, isPropertyOrMethod, isTypeAssertionExpression, isTypeExpression };
16
+ export { is, isClass, isDirective, isFunction, isIdentifier, isJSX, isJSXElement, isJSXElementOrFragment, isJSXFragment, isJSXTagNameExpression, isOneOf, isProperty, isPropertyOrMethod, isStringLiteral, 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,9 @@ 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 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
24
  declare function isDirective(name: string): (node: TSESTree.Node) => node is TSESTreeDirective;
31
25
  declare function isIdentifier(name: string): (node: TSESTree.Node) => node is TSESTree.Identifier;
26
+ declare function isStringLiteral(node: TSESTree.Node): node is TSESTree.StringLiteral;
32
27
  declare const isClass: (node: TSESTree.Node | null | undefined) => node is TSESTree.ClassDeclarationWithName | TSESTree.ClassDeclarationWithOptionalName | TSESTree.ClassExpression;
33
28
  declare const isFunction: (node: TSESTree.Node | null | undefined) => node is TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclarationWithName | TSESTree.FunctionDeclarationWithOptionalName | TSESTree.FunctionExpression;
34
29
  declare const isProperty: (node: TSESTree.Node | null | undefined) => node is TSESTree.PropertyDefinitionComputedName | TSESTree.PropertyDefinitionNonComputedName | TSESTree.TSIndexSignature | TSESTree.TSParameterProperty | TSESTree.TSPropertySignatureComputedName | TSESTree.TSPropertySignatureNonComputedName;
package/dist/index.js CHANGED
@@ -15,35 +15,24 @@ var check_exports = /* @__PURE__ */ __exportAll({
15
15
  isJSXElementOrFragment: () => isJSXElementOrFragment,
16
16
  isJSXFragment: () => isJSXFragment,
17
17
  isJSXTagNameExpression: () => isJSXTagNameExpression,
18
- isLiteral: () => isLiteral,
19
18
  isOneOf: () => isOneOf,
20
19
  isProperty: () => isProperty,
21
20
  isPropertyOrMethod: () => isPropertyOrMethod,
21
+ isStringLiteral: () => isStringLiteral,
22
22
  isTypeAssertionExpression: () => isTypeAssertionExpression,
23
23
  isTypeExpression: () => isTypeExpression
24
24
  });
25
25
  const is = ASTUtils.isNodeOfType;
26
26
  const isOneOf = ASTUtils.isNodeOfTypes;
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
- };
40
- }
41
27
  function isDirective(name) {
42
28
  return (node) => node.type === AST_NODE_TYPES.ExpressionStatement && node.directive === name;
43
29
  }
44
30
  function isIdentifier(name) {
45
31
  return (node) => node.type === AST_NODE_TYPES.Identifier && node.name === name;
46
32
  }
33
+ function isStringLiteral(node) {
34
+ return node.type === AST_NODE_TYPES.Literal && typeof node.value === "string";
35
+ }
47
36
  const isClass = isOneOf([AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.ClassExpression]);
48
37
  const isFunction = isOneOf([
49
38
  AST_NODE_TYPES.ArrowFunctionExpression,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "5.8.5",
3
+ "version": "5.8.6",
4
4
  "description": "ESLint React's TSESTree AST utility module.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -29,16 +29,16 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@typescript-eslint/types": "^8.59.4",
33
- "@typescript-eslint/typescript-estree": "^8.59.4",
34
- "@typescript-eslint/utils": "^8.59.4",
32
+ "@typescript-eslint/types": "^8.60.0",
33
+ "@typescript-eslint/typescript-estree": "^8.60.0",
34
+ "@typescript-eslint/utils": "^8.60.0",
35
35
  "string-ts": "^2.3.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@typescript-eslint/parser": "^8.59.4",
38
+ "@typescript-eslint/parser": "^8.60.0",
39
39
  "eslint": "^10.4.0",
40
40
  "tsdown": "^0.22.0",
41
- "typescript": "^6.0.3",
41
+ "typescript": "5.9.3",
42
42
  "vitest": "^4.1.7",
43
43
  "@local/configs": "0.0.0",
44
44
  "@local/eff": "3.0.0-beta.72"