conflicting eslint issues
I have an eslint config file. I use npm to add eslint to the project.
My js files turn red with tons of errors, and I click fix eslint problems. This changes some strings to use single quotes.
Then I get new issues telling me that I should be using double quotes. I fix again.
There must be some conflicting issues on how to format my code...
help!
请先登录再写评论。
Is it ESLint that tells you to use double quotes? looks strange, as they were changed to single with ESLint fix...
Please provide screenshots of the error messages
Eslint: I click fix quotes. Then it makes it a double quote. Then I press fix again when its unhappy and it goes back... This goes on forever.
Looks like your ESLint settings conflict with Prettier ones. Please try settings from https://github.com/prettier/prettier/issues/2280#issuecomment-336608596 - does it help?
but I don't have prettier installed? Do I?
How can I know? I have no idea what your setup looks like; from the errors it seems that you have
in your eslint configuration file
my config file
module.exports = {env: {
browser: true,
commonjs: true,
es6: true,
node: true
},
extends: ["eslint:recommended", "plugin:@wordpress/eslint-plugin/recommended"],
parserOptions: {
sourceType: "module"
},
rules: {
indent: ["error", "tab"],
"linebreak-style": ["error", "unix"],
quotes: ["error", "single"],
semi: ["error", "always"]
}
};
phpstorm seems to not need prettier right? it fixes things by itself?
ah i think WordPress Recommended is using prettier.
So how can I get the conflicts to go away?
I'd suggest asking this at https://github.com/WordPress/gutenberg/issues
See also https://github.com/WordPress/gutenberg/issues/20509
ok. Lastly if i remove the WordPress part it works nicely. but the cmd+opt L which cleans up code matches phpstorm settings, while "fix eslint issues" changes it a different way....
How can I get phpstorm to match eslint?
Please try importing code style preferences from ESLint (https://www.jetbrains.com/help/webstorm/2020.1/eslint.html#ws_js_linters_eslint_import_code_style_from_eslint)