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

Framework: Define all ESLint rules as errors #8562

Closed
aduth opened this issue Oct 6, 2016 · 6 comments
Closed

Framework: Define all ESLint rules as errors #8562

aduth opened this issue Oct 6, 2016 · 6 comments

Comments

@aduth
Copy link
Contributor

aduth commented Oct 6, 2016

We use ESLint to enforce a consistent code standard. Over time, we have changed and added rules to our configuration. In doing so, because legacy code often violated the latest configuration settings, they could not be set to throw errors during continuous integration. As background, ESLint allows you to configure a rule with as a warning (1) or error (2), the latter being of higher severity and failing the continuous integration build. Enforcing our configuration during the continuous integration build step (and pre-commit hooks) helps highlight issues programmatically rather than through human intervention (i.e. peer review).

For this reason, we should seek to upgrade all rules in our ESLint configuration to be defined as errors. Because we extend the eslint-config-wpcalypso shared configuration, the process for doing this is to simply remove our warning overrides from the configuration. As such, rules defined as warnings in our ESLint configuration should effectively serve as a checklist of remaining items to be resolved in the codebase.

@aduth
Copy link
Contributor Author

aduth commented Mar 22, 2017

@nosolosw Is this issue no longer relevant given the merging of #6945 ?

@oandregal
Copy link
Contributor

oandregal commented Mar 23, 2017

Some rules still need fixing, so I believe this is still relevant as a placeholder. It is a good time to re-purpose the goal and change the title and description, though.

One thing I'd like us to do is using ESLint at its full potential: making use of its --fix abilities to reformat our code on the fly directly in the editor. For me, it has worked well for all new files I've written, but I couldn't enable it for older ones as I didn't want to mess with legacy code and make my PRs less readable for the reviewers. That's a blocker we could remove.

I'd suggest focusing the efforts of this task in solving the fixable rules first. From that on, my understanding is that we can have ESLint always activated.

These are the fixable rules in client, server and test directories:

@aduth what do you think?

@aduth
Copy link
Contributor Author

aduth commented Mar 23, 2017

@nosolosw This sounds like a good idea. How do you suggest a person generate a report to tell them which files are problematic? Running the raw ./node_modules/.bin/eslint . ?

@Copons
Copy link
Contributor

Copons commented Mar 23, 2017

Just came back from a bunch of AFK days to find all my ESLint upgrades PR reviewed by @aduth! 🙇
As soon as I rebase and merge all of them I'll update @nosolosw's checklist and keep on fixin' the others.

@oandregal
Copy link
Contributor

How about creating npm run lint-fixable to report the fixable rules? Early work for this in #12517

@stale
Copy link

stale bot commented Jan 11, 2018

This issue has been marked as stale because it hasn't been updated in a while. It will be closed in a week.
If you would like it to remain open, can you please you comment below and see what you can do to get things moving with this issue?
Thanks! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants