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!

0
10 comments

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

0
Avatar
Permanently deleted user

 

 

 

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.

0

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?

0
Avatar
Permanently deleted user

but I don't have prettier installed? Do I?

0

How can I know? I have no idea what your setup looks like; from the errors it seems that you have

"plugins": [
        "prettier"
    ],
... "rules": {
... "prettier/prettier": "error"
...
}

in your eslint configuration file

0
Avatar
Permanently deleted user

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?

0
Avatar
Permanently deleted user

ah i think WordPress Recommended is using prettier. 

So how can I get the conflicts to go away?

 

0
Avatar
Permanently deleted user

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?

0

Please sign in to leave a comment.