@eslint-react/ast 2.0.0-next.153 → 2.0.0-next.155

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
@@ -162,7 +162,15 @@ declare function hasCallInFunctionInitPath(callName: string, initPath: FunctionI
162
162
  declare function isFunctionEmpty(node: TSESTreeFunction): boolean;
163
163
  declare function isFunctionImmediatelyInvoked(node: TSESTreeFunction): boolean;
164
164
  //#endregion
165
- //#region src/line.d.ts
165
+ //#region src/literal.d.ts
166
+ declare function isLiteral(node: TSESTree.Node): node is TSESTree.Literal;
167
+ declare function isLiteral(node: TSESTree.Node, type: "boolean"): node is TSESTree.BooleanLiteral;
168
+ declare function isLiteral(node: TSESTree.Node, type: "null"): node is TSESTree.NullLiteral;
169
+ declare function isLiteral(node: TSESTree.Node, type: "number"): node is TSESTree.NumberLiteral;
170
+ declare function isLiteral(node: TSESTree.Node, type: "regexp"): node is TSESTree.RegExpLiteral;
171
+ declare function isLiteral(node: TSESTree.Node, type: "string"): node is TSESTree.StringLiteral;
172
+ //#endregion
173
+ //#region src/misc.d.ts
166
174
  /**
167
175
  * Check if a node is multiline
168
176
  * @param node The AST node to check
@@ -176,14 +184,6 @@ declare function isMultiLine(node: TSESTree.Node): boolean;
176
184
  */
177
185
  declare function isLineBreak(node: TSESTree.Node): boolean;
178
186
  //#endregion
179
- //#region src/literal.d.ts
180
- declare function isLiteral(node: TSESTree.Node): node is TSESTree.Literal;
181
- declare function isLiteral(node: TSESTree.Node, type: "boolean"): node is TSESTree.BooleanLiteral;
182
- declare function isLiteral(node: TSESTree.Node, type: "null"): node is TSESTree.NullLiteral;
183
- declare function isLiteral(node: TSESTree.Node, type: "number"): node is TSESTree.NumberLiteral;
184
- declare function isLiteral(node: TSESTree.Node, type: "regexp"): node is TSESTree.RegExpLiteral;
185
- declare function isLiteral(node: TSESTree.Node, type: "string"): node is TSESTree.StringLiteral;
186
- //#endregion
187
187
  //#region src/promise-then.d.ts
188
188
  declare function isThenCall(node: TSESTree.CallExpression): boolean;
189
189
  //#endregion
package/dist/index.js CHANGED
@@ -520,7 +520,21 @@ function isFunctionImmediatelyInvoked(node) {
520
520
  }
521
521
 
522
522
  //#endregion
523
- //#region src/line.ts
523
+ //#region src/literal.ts
524
+ function isLiteral(node, type) {
525
+ if (node.type !== AST_NODE_TYPES.Literal) return false;
526
+ if (type == null) return true;
527
+ switch (type) {
528
+ case "boolean": return typeof node.value === "boolean";
529
+ case "null": return node.value === null;
530
+ case "number": return typeof node.value === "number";
531
+ case "regexp": return "regex" in node;
532
+ case "string": return typeof node.value === "string";
533
+ }
534
+ }
535
+
536
+ //#endregion
537
+ //#region src/misc.ts
524
538
  /**
525
539
  * Check if a node is multiline
526
540
  * @param node The AST node to check
@@ -538,20 +552,6 @@ function isLineBreak(node) {
538
552
  return isOneOf([AST_NODE_TYPES.Literal, AST_NODE_TYPES.JSXText])(node) && typeof node.value === "string" && node.value.trim() === "" && isMultiLine(node);
539
553
  }
540
554
 
541
- //#endregion
542
- //#region src/literal.ts
543
- function isLiteral(node, type) {
544
- if (node.type !== AST_NODE_TYPES.Literal) return false;
545
- if (type == null) return true;
546
- switch (type) {
547
- case "boolean": return typeof node.value === "boolean";
548
- case "null": return node.value === null;
549
- case "number": return typeof node.value === "number";
550
- case "regexp": return "regex" in node;
551
- case "string": return typeof node.value === "string";
552
- }
553
- }
554
-
555
555
  //#endregion
556
556
  //#region src/promise-then.ts
557
557
  function isThenCall(node) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eslint-react/ast",
3
- "version": "2.0.0-next.153",
3
+ "version": "2.0.0-next.155",
4
4
  "description": "ESLint React's TSESTree AST utility module.",
5
5
  "homepage": "https://github.com/Rel1cx/eslint-react",
6
6
  "bugs": {
@@ -32,7 +32,7 @@
32
32
  "@typescript-eslint/utils": "^8.41.0",
33
33
  "string-ts": "^2.2.1",
34
34
  "ts-pattern": "^5.8.0",
35
- "@eslint-react/eff": "2.0.0-next.153"
35
+ "@eslint-react/eff": "2.0.0-next.155"
36
36
  },
37
37
  "devDependencies": {
38
38
  "tsdown": "^0.14.2",