Does anyone know how to properly setup eslint with prettier in Atom editor? I wanted to use airbnb presets, but when I check ESlint integration in prettier settings, after I save my file, I have trailing commas after some functions, and other strange issues. How to set it up to make prettier respect airbnb rules after file save?
2 Answers
You may want to check out https://github.com/prettier/prettier-eslint
From the description:
The problem
The fix feature of eslint is pretty great and can auto-format/fix much of your code according to your ESLint config. prettier is a more powerful automatic formatter. One of the nice things about prettier is how opinionated it is. Unfortunately it's not opinionated enough and/or some opinions differ from my own. So after prettier formats the code, I start getting linting errors.
This solution
This formats your code via prettier, and then passes the result of that to eslint --fix. This way you can get the benefits of prettier's superior formatting capabilities, but also benefit from the configuration capabilities of eslint.
For files with an extension of .css, .less, .scss, or .json this only runs prettier since eslint cannot process those.