@@ -9,12 +9,8 @@ import type {
9
9
SvelteSpreadAttribute ,
10
10
SvelteStyleDirective ,
11
11
} from "svelte-eslint-parser/lib/ast"
12
- import {
13
- default as selectorParser ,
14
- type Node ,
15
- type Root as SelectorRoot ,
16
- } from "postcss-selector-parser"
17
- import type { AnyNode , AtRule , Root } from "postcss"
12
+ import { default as selectorParser , type Node } from "postcss-selector-parser"
13
+ import type { AnyNode } from "postcss"
18
14
19
15
export default createRule ( "no-unused-class-name" , {
20
16
meta : {
@@ -106,8 +102,8 @@ function findClassesInPostCSSNode(node: AnyNode): string[] {
106
102
)
107
103
return classes
108
104
}
109
- if ( [ "root" , "atrule" ] . includes ( node . type ) ) {
110
- return ( node as Root | AtRule ) . nodes . flatMap ( findClassesInPostCSSNode )
105
+ if ( node . type === "root" || node . type === "atrule" ) {
106
+ return node . nodes . flatMap ( findClassesInPostCSSNode )
111
107
}
112
108
return [ ]
113
109
}
@@ -119,8 +115,8 @@ function findClassesInSelector(node: Node): string[] {
119
115
if ( node . type === "class" ) {
120
116
return [ node . value ]
121
117
}
122
- if ( [ "root" , "selector" ] . includes ( node . type ) ) {
123
- return ( node as SelectorRoot ) . nodes . flatMap ( findClassesInSelector )
118
+ if ( node . type === "root" || node . type === "selector" ) {
119
+ return node . nodes . flatMap ( findClassesInSelector )
124
120
}
125
121
return [ ]
126
122
}
0 commit comments