File tree 1 file changed +4
-5
lines changed
packages/eslint-plugin-svelte/src/rules
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
1
import { createRule } from '../utils/index.js' ;
2
- import { getSourceCode } from '../utils/compat.js' ;
2
+ import { getCwd , getSourceCode } from '../utils/compat.js' ;
3
3
4
4
export default createRule ( 'valid-style-parse' , {
5
5
meta : {
@@ -9,24 +9,23 @@ export default createRule('valid-style-parse', {
9
9
recommended : false
10
10
} ,
11
11
schema : [ ] ,
12
- messages : {
13
- parseError : 'Error parsing style element'
14
- } ,
12
+ messages : { } ,
15
13
type : 'problem'
16
14
} ,
17
15
create ( context ) {
18
16
const sourceCode = getSourceCode ( context ) ;
19
17
if ( ! sourceCode . parserServices . isSvelte ) {
20
18
return { } ;
21
19
}
20
+ const cwd = `${ getCwd ( context ) } /` ;
22
21
23
22
return {
24
23
SvelteStyleElement ( node ) {
25
24
const styleContext = sourceCode . parserServices . getStyleContext ! ( ) ;
26
25
if ( styleContext . status === 'parse-error' ) {
27
26
context . report ( {
28
27
loc : node . loc ,
29
- messageId : 'parseError'
28
+ message : `Error parsing style element. Error message: " ${ styleContext . error . message . replace ( cwd , '' ) } "`
30
29
} ) ;
31
30
}
32
31
if ( styleContext . status === 'unknown-lang' ) {
You can’t perform that action at this time.
0 commit comments