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!

10 comments
Comment actions Permalink

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
Comment actions Permalink

 

 

 

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
Comment actions Permalink

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
Comment actions Permalink

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

0
Comment actions Permalink

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
Comment actions Permalink

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
Comment actions Permalink

ah i think WordPress Recommended is using prettier. 

So how can I get the conflicts to go away?

 

0
Comment actions Permalink

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.