File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ import { isEnhancedParserObject, isParserObject } from "../common/parser-object"
67
67
import type { TSESTree } from "@typescript-eslint/utils"
68
68
import type { GenericProcessInfo } from "./generic"
69
69
import { extractGeneric } from "./generic"
70
+ import { isUndefined } from "lodash"
70
71
71
72
// [1] = aliases.
72
73
// [2] = delimiter.
@@ -635,15 +636,8 @@ export function parseScriptElement(
635
636
result . ast . tokens ?. [ 0 ] ,
636
637
result . ast . comments ?. [ 0 ] ,
637
638
]
638
- . sort ( ( a , b ) =>
639
- a == null
640
- ? b == null
641
- ? 0
642
- : 1
643
- : b == null
644
- ? - 1
645
- : a . range [ 0 ] - b . range [ 0 ] ,
646
- )
639
+ . filter ( ( e ) : e is NonNullable < typeof e > => Boolean ( e ) )
640
+ . sort ( ( a , b ) => a . range [ 0 ] - b . range [ 0 ] )
647
641
. find ( ( t ) => Boolean ( t ) )
648
642
649
643
// Restore Program node location
You can’t perform that action at this time.
0 commit comments