File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import {
39
39
type StyleContextUnknownLang ,
40
40
styleNodeLoc ,
41
41
styleNodeRange ,
42
+ styleSelectorNodeLoc ,
42
43
} from "./style-context.js" ;
43
44
import { getGlobalsForSvelte , getGlobalsForSvelteScript } from "./globals.js" ;
44
45
import type { NormalizedParserOptions } from "./parser-options.js" ;
@@ -251,6 +252,7 @@ function parseAsSvelte(
251
252
} ,
252
253
styleNodeLoc,
253
254
styleNodeRange,
255
+ styleSelectorNodeLoc,
254
256
svelteParseContext,
255
257
} ) ;
256
258
resultScript . visitorKeys = Object . assign ( { } , KEYS , resultScript . visitorKeys ) ;
Original file line number Diff line number Diff line change @@ -141,6 +141,24 @@ export function styleNodeRange(
141
141
] ;
142
142
}
143
143
144
+ /**
145
+ * Extracts a node location (like that of any ESLint node) from a parsed svelte selector node.
146
+ */
147
+ export function styleSelectorNodeLoc (
148
+ node : SelectorNode ,
149
+ ) : Partial < SourceLocation > {
150
+ return {
151
+ start :
152
+ node . source ?. start !== undefined
153
+ ? {
154
+ line : node . source . start . line ,
155
+ column : node . source . start . column - 1 ,
156
+ }
157
+ : undefined ,
158
+ end : node . source ?. end ,
159
+ } ;
160
+ }
161
+
144
162
/**
145
163
* Fixes PostCSS AST locations to be relative to the whole file instead of relative to the <style> element.
146
164
*/
You can’t perform that action at this time.
0 commit comments