File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
packages/eslint-plugin-svelte/src/rules Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 11import { createRule } from '../utils/index.js' ;
2- import { getSourceCode } from '../utils/compat.js' ;
2+ import { getCwd , getSourceCode } from '../utils/compat.js' ;
33
44export default createRule ( 'valid-style-parse' , {
55 meta : {
@@ -9,24 +9,23 @@ export default createRule('valid-style-parse', {
99 recommended : false
1010 } ,
1111 schema : [ ] ,
12- messages : {
13- parseError : 'Error parsing style element'
14- } ,
12+ messages : { } ,
1513 type : 'problem'
1614 } ,
1715 create ( context ) {
1816 const sourceCode = getSourceCode ( context ) ;
1917 if ( ! sourceCode . parserServices . isSvelte ) {
2018 return { } ;
2119 }
20+ const cwd = `${ getCwd ( context ) } /` ;
2221
2322 return {
2423 SvelteStyleElement ( node ) {
2524 const styleContext = sourceCode . parserServices . getStyleContext ! ( ) ;
2625 if ( styleContext . status === 'parse-error' ) {
2726 context . report ( {
2827 loc : node . loc ,
29- messageId : 'parseError'
28+ message : `Error parsing style element. Error message: " ${ styleContext . error . message . replace ( cwd , '' ) } "`
3029 } ) ;
3130 }
3231 if ( styleContext . status === 'unknown-lang' ) {
You can’t perform that action at this time.
0 commit comments