prettier-vscode: Prettier eslint integration is not working

Hello,

the "prettier.eslintIntegration": trueis not working. I tried to install prettier-eslint as local and global package and it was the same. I tried to use eslint as local and as global package and it was the same. I even tried to install all three packages including prettier to local and global and it was the same. I tried different variations and it wasn’t working. I mean it’s formatting, but it doesn’t do eslint --fix.

The Prettier output is clean, it has in sidebar ✓ symbol. ESLint output is good too.

VS Code: 1.14.2 macOS Sierra: 10.12.6 (16G29)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 17 (7 by maintainers)

Most upvoted comments

I got the problem:

"prettier.eslintIntegration": true Need to be set in the editor config file.

Not on .prettierrc/package.json/.prettier.config.js

“prettier.tslintIntegration” and “prettier.eslintIntegration” in VSCode both give me “Unknown Configuration Setting” error.

@lucasfeliciano I set "prettier.eslintIntegration": truein vscode setting ,then it works.

Seems everything fine for me, I guess I can close this issue.

@CiGit @RobinMalfait It’s configured good, ESLint works in both ways if you left only "error" or ["error", "always"]. I tried to use ["error", "always"] and it wasn’t working (I’m talking about Prettier). Using one param for e.g. "warn" or "error" always works if that rule have default type in this example "arrow-parens" default type is always. I can use both approaches "error" or ["error", "always"] and ESLint always works without any problems.

I tried on new and clean project with only index.js and .eslintrc.json:

{
	"env": {
		"es6": true
	},
	"rules": {
		"arrow-parens": "error"
	}
}

And it was working! Prettier doesn’t remove the parens, BUT how to fix that on my project? I think maybe it can be, because that project is having 2 ESLint files and both are not in root, the structure is like this:

root ->

  • api ->
    • .eslintrc.json
    • other files
  • frontend ->
    • .eslintrc.json`
    • other files
  • other files, but no .eslintrc.json in root

I configured my VS Code workspaces settings to use ESLint config from frontend folder and it’s working for ESLint, but Prettier is not working, I even tried to add .eslintrc.json in the root, but Prettier still is not working… Maybe we need new prettier setting to show where is and which ESLint config to use? Or Prettier is communicating with ESLint to know correct place of config?

In short: Prettier is working if everything is in root, but if I have different structure it doesn’t working, but ESLint does. I mean it’s formatting, but not respecting ESLint configuration even if integration is true.