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

Add recommended config for eslint-plugin-react-hooks #17976

Conversation

silvenon
Copy link

@silvenon silvenon commented Feb 4, 2020

Summary

Recommended configs are a common practice with ESLint plugins, they offer a quick way to add the plugin and configure basic rules. eslint-plugin-react-hooks is especially straightforward in that regard.

With these changes extending plugin:react-hooks/recommended would be equivalent to:

{
  "plugins": [
    "react-hooks"
  ],
  "rules": {
    "react-hooks/rules-of-hooks": "error",
    "react-hooks/exhaustive-deps": "warn"
  }
}

Test Plan

I tested the config using ESLint's CLIEngine, that seemed to strike a balance between clean and easy.

Fixes #16872.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 4, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@sizebot
Copy link

sizebot commented Feb 4, 2020

Warnings
⚠️ Could not find build artifacts for base commit: 613cbd3

Size changes (stable)

Generated by 🚫 dangerJS against 20ef9a7

@sizebot
Copy link

sizebot commented Feb 4, 2020

Warnings
⚠️ Could not find build artifacts for base commit: 613cbd3

Size changes (experimental)

Generated by 🚫 dangerJS against 20ef9a7

@silvenon silvenon force-pushed the eslint-plugin-react-hooks/recommended branch from 95c0e35 to 20ef9a7 Compare February 5, 2020 11:09
Now the extending `plugin:react-hooks/recommended` adds this plugin and
configures both of its rules.
@silvenon silvenon force-pushed the eslint-plugin-react-hooks/recommended branch from 20ef9a7 to 6324c9f Compare February 17, 2020 11:30
@silvenon
Copy link
Author

Added tests. ✅

@silvenon
Copy link
Author

I don't think these failures are caused by my changes. 🤷‍♂

@Mathspy
Copy link

Mathspy commented Feb 29, 2020

Just a heads up that this has already been merged in #14762

@silvenon
Copy link
Author

Thanks!

@silvenon silvenon closed this Feb 29, 2020
@silvenon silvenon deleted the eslint-plugin-react-hooks/recommended branch February 29, 2020 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal of recommended config in eslint-plugin-react-hooks
5 participants