@@ -2,39 +2,7 @@ import type { TSESTree } from "@typescript-eslint/types";
22import { AST_NODE_TYPES as AST } from "@typescript-eslint/types" ;
33import { delimiterCase , replace , toLowerCase } from "string-ts" ;
44
5- import { isJSX , isOneOf } from "./is" ;
6-
7- /**
8- * Check if a node is multiline
9- * @param node The AST node to check
10- * @returns `true` if the node is multiline
11- */
12- export function isMultiLine ( node : TSESTree . Node ) {
13- return node . loc . start . line !== node . loc . end . line ;
14- }
15-
16- /**
17- * Check if a node is a line break
18- * @param node The AST node to check
19- * @returns boolean
20- */
21- export function isLineBreak ( node : TSESTree . Node ) {
22- return isOneOf ( [ AST . Literal , AST . JSXText ] ) ( node )
23- && typeof node . value === "string"
24- && node . value . trim ( ) === ""
25- && isMultiLine ( node ) ;
26- }
27-
28- /**
29- * Get the type of a literal value
30- * @param input The literal value
31- * @returns The type of the literal value
32- */
33- function getLiteralValueType ( input : bigint | boolean | null | number | string | symbol ) {
34- // eslint-disable-next-line function-rule-2/function-rule
35- if ( input === null ) return "null" ;
36- return typeof input ;
37- }
5+ import { isJSX } from "./is" ;
386
397/**
408 * Convert a node type to a delimiter format string
@@ -47,7 +15,11 @@ export function toDelimiterFormat(node: TSESTree.Node, delimiter = " ") {
4715 if ( "regex" in node ) {
4816 return "RegExp literal" ;
4917 }
50- return `${ getLiteralValueType ( node . value ) } literal` as const ;
18+ // eslint-disable-next-line function-rule-2/function-rule
19+ if ( node . value === null ) {
20+ return "null literal" as const ;
21+ }
22+ return `${ typeof node . value } literal` as const ;
5123 }
5224 if ( isJSX ( node ) ) {
5325 return `JSX ${ toLowerCase ( delimiterCase ( replace ( node . type , "JSX" , "" ) , delimiter ) ) } ` as const ;
0 commit comments