File tree Expand file tree Collapse file tree 4 files changed +396
-210
lines changed
lib/styles/parser/selector Expand file tree Collapse file tree 4 files changed +396
-210
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " eslint-plugin-vue-scoped-css " : patch
3
+ ---
4
+
5
+ fix: error when using ESLint v9.30.0 or later
Original file line number Diff line number Diff line change @@ -174,6 +174,21 @@ export class CSSSelectorParser {
174
174
) : VCSSSelectorNode | null {
175
175
const { sourceCode } = this ;
176
176
177
+ /**
178
+ * Get index from location
179
+ */
180
+ function getIndexFromLoc ( loc : LineAndColumnData ) : number {
181
+ if ( loc . column >= 0 ) {
182
+ return sourceCode . getIndexFromLoc ( loc ) ;
183
+ }
184
+ // A column index can be negative if the starting position contains a newline.
185
+ const index = sourceCode . getIndexFromLoc ( {
186
+ line : loc . line ,
187
+ column : 0 ,
188
+ } ) ;
189
+ return index + loc . column ;
190
+ }
191
+
177
192
const loc = {
178
193
start : getESLintLineAndColumnFromPostCSSSelectorParserNode (
179
194
offsetLocation ,
@@ -186,8 +201,8 @@ export class CSSSelectorParser {
186
201
"end" ,
187
202
) ,
188
203
} ;
189
- const start = sourceCode . getIndexFromLoc ( loc . start ) ;
190
- const end = sourceCode . getIndexFromLoc ( loc . end ) ;
204
+ const start = getIndexFromLoc ( loc . start ) ;
205
+ const end = getIndexFromLoc ( loc . end ) ;
191
206
192
207
const astNode = this [ typeToConvertMethodName ( node . type ) ] (
193
208
node as never ,
You can’t perform that action at this time.
0 commit comments