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

React Hooks support and entry point #17

Closed
arcticicestudio opened this issue Aug 20, 2019 · 0 comments · Fixed by #18
Closed

React Hooks support and entry point #17

arcticicestudio opened this issue Aug 20, 2019 · 0 comments · Fixed by #18

Comments

@arcticicestudio
Copy link
Contributor

arcticicestudio commented Aug 20, 2019

All React based Arctic Ice Studio projects using at least React version 16.8 that introduced the awesome Hooks. Since this comes with a entire new API that follows new design/usage pattern, the React team created an official „Hooks“ ESLint plugin to help to adhere to the „Rules of Hooks“.

Since the @arcticicestudio/eslint-config package already includes support for React and „JSX A11Y“, support for Hooks will also be added through a new shareable configuration entry point that

  • enables the react-hooks plugin.
  • configures both currently available rules react-hooks/rules-of-hooks and react-hooks/exhaustive-deps rule to error level.

Because Hooks make more use of arrow functions the react/jsx-no-bind will be adjusted to prevent compatibility problems by allowing setting the ignoreDOMComponents and allowArrowFunctions options to true.
The react/display-name rule will also be disabled in order to prevent problems due to missing display names for functional components that make use of Hooks instead of being created through a class component.

The new entry point will be available as @arcticicestudio/eslint-config/react-hooks and can be composed with all other available entry points to inherit their rules.

This feature will add the eslint-plugin-react-hooks package as new peer dependency for @arcticicestudio/eslint-config.

@arcticicestudio arcticicestudio added this to the 0.8.0 milestone Aug 20, 2019
@arcticicestudio arcticicestudio self-assigned this Aug 20, 2019
arcticicestudio added a commit that referenced this issue Aug 20, 2019
All React based "Arctic Ice Studio" projects using at least React
version 16.8 (1) that introduced the awesome "Hooks" (2). Since this
comes with an entire new API (3) that follows new design/usage pattern,
the React team created an official "Hooks" ESLint plugin (4) to help to
adhere to the "Rules of Hooks" (5).

Since the `@arcticicestudio/eslint-config` package already includes
support for React and "JSX A11Y", support for "Hooks" have also been
added through a new shareable configuration entry point that

- enables the `react-hooks` plugin.
- configures both currently available rules `react-hooks/rules-of-hooks`
  and `react-hooks/exhaustive-deps` rule to `error` level.

Since "Hooks" make more use of arrow functions the
`react/jsx-no-bind` rule (6) has been adjusted to prevent compatibility
problems by setting the `ignoreDOMComponents` and
`allowArrowFunctions` options to `true`.
Also the `react/display-name` rule has been disabled in order to prevent
problems due to missing "display names" for "functional components" that
make use of "Hooks" instead of being declared as a class component.

The new entry point is available as
`@arcticicestudio/eslint-config/react-hooks` and can be composed with
all other available entry points (7) to inherit their rules.

This feature adds the `eslint-plugin-react-hooks` package as new peer
dependency for `@arcticicestudio/eslint-config`.

References:
  (1) https://reactjs.org/blog/2019/02/06/react-v16.8.0.html
  (2) https://reactjs.org/docs/hooks-intro.html
  (3) https://reactjs.org/docs/hooks-reference.html
  (4) https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks
  (5) https://reactjs.org/docs/hooks-rules.html
  (6) https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
  (7) https://github.com/arcticicestudio/styleguide-javascript/blob/develop/packages/%40arcticicestudio/eslint-config/README.md#entry-points

GH-17
arcticicestudio added a commit that referenced this issue Aug 20, 2019
All React based "Arctic Ice Studio" projects using at least React
version 16.8 (1) that introduced the awesome "Hooks" (2). Since this
comes with an entire new API (3) that follows new design/usage pattern,
the React team created an official "Hooks" ESLint plugin (4) to help to
adhere to the "Rules of Hooks" (5).

Since the `@arcticicestudio/eslint-config` package already includes
support for React and "JSX A11Y", support for "Hooks" have also been
added through a new shareable configuration entry point that

- enables the `react-hooks` plugin.
- configures both currently available rules `react-hooks/rules-of-hooks`
  and `react-hooks/exhaustive-deps` rule to `error` level.

Since "Hooks" make more use of arrow functions the
`react/jsx-no-bind` rule (6) has been adjusted to prevent compatibility
problems by setting the `ignoreDOMComponents` and
`allowArrowFunctions` options to `true`.
Also the `react/display-name` rule has been disabled in order to prevent
problems due to missing "display names" for "functional components" that
make use of "Hooks" instead of being declared as a class component.

The new entry point is available as
`@arcticicestudio/eslint-config/react-hooks` and can be composed with
all other available entry points (7) to inherit their rules.

This feature adds the `eslint-plugin-react-hooks` package as new peer
dependency for `@arcticicestudio/eslint-config`.

References:
  (1) https://reactjs.org/blog/2019/02/06/react-v16.8.0.html
  (2) https://reactjs.org/docs/hooks-intro.html
  (3) https://reactjs.org/docs/hooks-reference.html
  (4) https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks
  (5) https://reactjs.org/docs/hooks-rules.html
  (6) https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
  (7) https://github.com/arcticicestudio/styleguide-javascript/blob/develop/packages/%40arcticicestudio/eslint-config/README.md#entry-points

Resolves GH-17
@arcticicestudio arcticicestudio removed their assignment Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment