Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set eslint to ignore @import from scss files

In React project, I am running linter on js and scss files. In scss files, I have used @import statement but lint gives me following error

Parsing error: Unexpected keyword 'import'
@import './../shared/variables.scss';

I want linter to ignore these @import lines.

Do I need to add any rule in in eslintrc file? Currently I am having following import rules in config:

'import/no-unresolved': 0,
'import/no-dynamic-require': 0,
'import/no-extraneous-dependencies': 0

Is there any comment line for scss files to ignore specific line, like we have it for js files? e.g. // eslint-disable-next-line

I have gone through a lot of online sources and added babel-eslint parser as well and also passed parserOptions too but nothing is working.

like image 381
Umair Jameel Avatar asked Dec 21 '25 17:12

Umair Jameel


1 Answers

According to https://github.com/eslint/eslint/issues/12752#issuecomment-571561845 :

Looks like the cause is eslint 'src/**' command. You are linting other files than JavaScript.

like image 157
Eliya Cohen Avatar answered Dec 24 '25 11:12

Eliya Cohen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!