Wojciech Jeleń
Wojciech Jeleń

Reputation: 399

Atom with prettier, eslint and airbnb style guide for React development

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?

Upvotes: 3

Views: 1516

Answers (2)

Chris Mc
Chris Mc

Reputation: 85

Just be aware that prettier-eslint for Atom has been depreciated and prettier-atom doesn't support the Airbnb style guide.

Upvotes: 0

Gardner Bickford
Gardner Bickford

Reputation: 1963

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.

Upvotes: 2

Related Questions