0

I am working in a team and none are using Vim. Most are use VS Code, and things are working fine for them.

However, I have this problem:

ticket.additionalNocs.forEach((additionalNoc) => nocs.push(additionalNoc));

If I remove the parens around (additionalNoc) , then run :Prettier, the parens get added back!

Our project has a .prettierrc.js and a .eslintrc.js. For everyone else in the team, the parens do not get added back. There should be no parens, yet for me, Prettier re-adds them.

I did CocInstall coc-prettier coc-eslint.

What am I missing? I do not want to mess with the config files, or add anything in the package.json file for the project, since like I said, I'm the only one facing this issue.

0

2 Answers 2

0

You could try to disable prettier for javascript

In vim :CocConfig (this opens coc-setting.json)

Add this line to the config file (don't forget trailing comma if needed:

"prettier.disableLanguages": ["javascript"]
1

The canonical way to deal with this problem is to disable ESLint's formatting rules, because linting and formatting are two different concepts and one tool should not handle both. (Well, that's a matter of opinion, but certainly two tools should not both be handling one of them).

Prettier provides an eslint plugin to do this for you. Install eslint-config-prettier and then add "prettier" to the end of your extends array in your eslintrc file.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.