Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choose linting options #111

Open
mathieuhendey opened this issue Jun 6, 2019 · 2 comments
Open

Choose linting options #111

mathieuhendey opened this issue Jun 6, 2019 · 2 comments
Assignees
Labels
idea question Further information is requested

Comments

@mathieuhendey
Copy link
Contributor

We're currently using https://github.com/azz/pretty-quick to run Prettier when building/deploying, but we don't actually have any rules defined in .prettierrc.

We should choose a common style guide and refrain from editing it. No one will be happy with everything, so better to choose one that everyone is slightly happy with.

We should also get pretty-quick to run ESLint, as Prettier's configuration seems limited to things like white-space and punctuation. This may be enough but ESLint offers far more rules.

@mathieuhendey mathieuhendey added question Further information is requested idea labels Jun 6, 2019
@barrymcgee
Copy link
Contributor

The ‘.prettierrc’ file is for override options, not setting up initial rules. It’s present but empty as many devs, including myself, configure their editors to auto format on save but only run if a Prettier config file is present.

Prettier is different to Eslint in that it’s only concerned with code style, not code correctness. If you wish to implement Eslint, I’d recommend doing it in such a way that Prettier is solely concerned with code formatting and Eslint is solely concerned with code correctness.

https://prettier.io/docs/en/integrating-with-linters.html

This is the approach favoured by the React team.

@mathieuhendey mathieuhendey self-assigned this Jun 8, 2019
@bgribben
Copy link

autoslap is a great tool for setting up linting or Prettier in JS projects which I would highly recommend using here; once run against a project, ESLint and Prettier will be set up to run on any staged files through a pre-commit hook. It's probably the least intrusive way of ensuring everyone is adhering to the same standards when contributing.

There's some initial work needed after setup e.g. doing an initial run of ESLint/Prettier against all files in the project, or configuring ESLint to play nicely with a React app (use the create-react-app ESLint config), but once that's all taken care of it makes life so much easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants