eslint rules config in PyCharm on Windows [solved]
In PyCharm, I needed to ignore eslint rules in my project **only on my laptop** (which is Windows), and did not want to modify project .eslintrc or similar files (because the rest of the team is on Linux). I tried adding the additional rules per the eslint plugin, but Pycharm was still flagging a million lint errors due to this rule: "Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style in Eslint".
Response from PyCharm:
You can't make PyCharm ignore certain rules in your .eslintrc
if you have ESLint integration enabled - just as you can't do this when running ESLint in terminal. But you can choose a different .eslintrc
with preferred set of rules and root: true
as a configuration file in Settings | Languages & Frameworks | JavaScript | Code Quality Tools | ESLint. Note also that ESLint would still traverse parent dirs looking for other .eslintrc
files. To avoid this, you can pass --no-eslintrc
in Extra eslint options
So the solution that worked for me was:
1. Copied the project .eslintrc into a new .eslintrc config **outside** of my repo
2. Added this rule to the top of the 'rules' section , with a comment:
"linebreak-style": 0, # ignore linebreaks on windows
3. Pointed PyCharm to the new local .eslintrc file (under menu /File/Settings/Languages & Frameworks / Javascript / Code Quality Tools / ESLint; or just use the search feature for 'eslint').
请先登录再写评论。