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

feat(config): added shareable configuration plugin:jest/all #276

Merged
merged 2 commits into from Jun 20, 2019

Conversation

nickineering
Copy link
Contributor

This pull request creates an "all" shareable configuration that enables all rules similar to eslint-plugin-react among others. It is a useful starting point for beginners who want to see everything the plugin is capable of before enabling selected rules, and can also make custom configurations less verbose.

I haven't previously contributed to this repository before, so please let me know if I missed anything that should have been included!

@jeysal
Copy link
Member

jeysal commented Jun 9, 2019

Thanks for the PR @nferrara100!
@SimenB wdyt about this?
I'm unsure if it makes sense to have something like this for this plugin atm - there are rules such as the prefer-to-be-null family where I'd prefer nudging people towards literally doing the exact opposite.

@nickineering
Copy link
Contributor Author

Thanks for the feedback! I wasn't aware some rules encourage poor practices. In that case would it make sense to deprecate those rules so the best practice is clear, or at the very least include a caution in the readme?

Perhaps this pull request should be modified to explicitly exclude deprecated rules, while still including the remaining rules? As said in my initial comment having an all setting is useful for beginners and as a starting point for other configurations. I would imagine most of the 22 rules not in the recommended configuration still have at least some value in that regard.

@jeysal
Copy link
Member

jeysal commented Jun 10, 2019

I'd definitely like to change/deprecate some rules first if we'd introduce something like this. Or alternatively as you suggested making it more of a jest/strict that still doesn't include some of the questionable rules.
But let's see what Simen says if he has some time, he's been doing most of the work here lately :)

@SimenB
Copy link
Member

SimenB commented Jun 10, 2019

I'm down with adding this, as long as we document it as breaking all the time, and we're sure none of the rules conflict (I don't think any do, haven't verified though).

We can also include some sort of strict config, but having an all (even though some rules might be less useful) makes sense to me. I guess the use case is "add all the things", and make rules opt-out rather than opt-in, increasing discoverability?

@nickineering nickineering changed the title feat: plugin:jest/all: added shareable configuration feat(config): added shareable configuration plugin:jest/all Jun 11, 2019
@nickineering
Copy link
Contributor Author

I didn't think to check for conflicting rules, but I can't think of any off hand. Is there a good automated way I could test that?

@SimenB
Copy link
Member

SimenB commented Jun 11, 2019

@nferrara100 no, not really. Just running config on large code bases with all rules and see if the rules conflict as they're fixed or not.

@@ -87,6 +87,17 @@ See
[ESLint documentation](http://eslint.org/docs/user-guide/configuring#extending-configuration-files)
for more information about extending configuration files.

### All
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a caveat about this not being subject to semver, so use with caution, blahblah 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@nickineering
Copy link
Contributor Author

I incorporated the changes to the readme suggested by @SimenB. I also ran the configuration against the React codebase and didn't see anything that appeared abnormal to me. It raised 6645 errors, so obviously I didn't attempt to correct them all, but in general it was a neat way to learn about rules I hadn't used before, which is one of the main use cases for this configuration. I also ran it against a personal codebase of mine and didn't get any conflicts, but that is pretty small so it may have just been luck. If anyone has a more pointed test they would like to see done, or has a more in depth knowledge of the various rules, please let me know.

@SimenB SimenB merged commit d7a9532 into jest-community:master Jun 20, 2019
@SimenB
Copy link
Member

SimenB commented Jun 20, 2019

Thanks!

@SimenB
Copy link
Member

SimenB commented Jun 20, 2019

🎉 This PR is included in version 22.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

None yet

3 participants