diff --git a/.eslintrc.js b/.eslintrc.js index 63f68476..fc008803 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -6,7 +6,7 @@ module.exports = { root: true, parser: 'babel-eslint', extends: ['airbnb', 'prettier', 'prettier/react'], - plugins: ['prettier', 'import', 'jest', 'jsx-a11y', 'react', 'json', 'html'], + plugins: ['prettier', 'import', 'jest', 'jsx-a11y', 'react', 'react-hooks', 'json', 'html'], rules: { 'prettier/prettier': [ 'warn', @@ -33,5 +33,7 @@ module.exports = { }, ], 'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/*.stories.js'] }], + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn" }, }; diff --git a/package.json b/package.json index 3617bfdc..5a9da0db 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "eslint-plugin-jsx-a11y": "^6.1.2", "eslint-plugin-prettier": "^3.0.1", "eslint-plugin-react": "^7.11.1", + "eslint-plugin-react-hooks": "^1.6.1", "husky": "^1.3.1", "lint-staged": "^8.1.4", "prettier": "^1.16.4", diff --git a/src/components/tooltip/ListItem.js b/src/components/tooltip/ListItem.js index 9e9cab26..9523a017 100644 --- a/src/components/tooltip/ListItem.js +++ b/src/components/tooltip/ListItem.js @@ -1,4 +1,4 @@ -import React, { useMemo } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import styled, { css } from 'styled-components'; import { color, typography } from '../shared/styles'; @@ -164,7 +164,7 @@ export function ListItem({ ); if (LinkWrapper) { - const StyledLinkWrapper = useMemo(() => buildStyledLinkWrapper(LinkWrapper), [LinkWrapper]); + const StyledLinkWrapper = buildStyledLinkWrapper(LinkWrapper); return ( diff --git a/yarn.lock b/yarn.lock index 765a207c..012fea42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4322,6 +4322,11 @@ eslint-plugin-prettier@^3.0.1: dependencies: prettier-linter-helpers "^1.0.0" +eslint-plugin-react-hooks@^1.6.1: + version "1.6.1" + resolved "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.1.tgz#3c66a5515ea3e0a221ffc5d4e75c971c217b1a4c" + integrity sha512-wHhmGJyVuijnYIJXZJHDUF2WM+rJYTjulUTqF9k61d3BTk8etydz+M4dXUVH7M76ZRS85rqBTCx0Es/lLsrjnA== + eslint-plugin-react@^7.11.1: version "7.12.4" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.12.4.tgz#b1ecf26479d61aee650da612e425c53a99f48c8c"