Remove lint plugin for react hooks

This commit is contained in:
Aria Minaei 2022-02-23 22:42:09 +01:00
parent 48c060e4be
commit 078fa7a849
3 changed files with 23 additions and 12 deletions

View file

@ -1,7 +1,29 @@
/**
* @remarks
* Notes on plugins we _don't_ use:
*
* ## plugin:react-hooks
* We don't use the react hooks plugin because it disallows valid use-cases
* such as this:
*
* ```ts
* export default function useValToAtom<S>(val: S): Atom<S> {
* const atom = useMemo(() => {
* return new Atom(val)
* }, []) // <-- we don't _need_ to include `val` here, but the lint rule will require it
*
* useLayoutEffect(() => {
* atom.setState(val)
* }, [val]) // <-- we also know `atom` will never change, but the lint rule doesn't
*
* return atom
* ```
*/
module.exports = { module.exports = {
root: true, root: true,
plugins: ['unused-imports', 'eslint-plugin-tsdoc'], plugins: ['unused-imports', 'eslint-plugin-tsdoc'],
extends: ['plugin:react-hooks/recommended'], extends: [],
rules: { rules: {
'unused-imports/no-unused-imports': 'warn', 'unused-imports/no-unused-imports': 'warn',
'tsdoc/syntax': 'warn', 'tsdoc/syntax': 'warn',

View file

@ -41,7 +41,6 @@
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.25.1", "eslint-plugin-react": "^7.25.1",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-tsdoc": "^0.2.14", "eslint-plugin-tsdoc": "^0.2.14",
"eslint-plugin-unused-imports": "^1.1.4", "eslint-plugin-unused-imports": "^1.1.4",
"husky": "^6.0.0", "husky": "^6.0.0",

View file

@ -9728,15 +9728,6 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"eslint-plugin-react-hooks@npm:^4.3.0":
version: 4.3.0
resolution: "eslint-plugin-react-hooks@npm:4.3.0"
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0
checksum: 0ba1566ba0780bbc75a5921f49188edf232db2085ab32c8d3889592f0db9d6fadc97fcf639775e0101dec6b5409ca3c803ec44213b90c8bacaf0bdf921871c2e
languageName: node
linkType: hard
"eslint-plugin-react@npm:^7.21.5": "eslint-plugin-react@npm:^7.21.5":
version: 7.24.0 version: 7.24.0
resolution: "eslint-plugin-react@npm:7.24.0" resolution: "eslint-plugin-react@npm:7.24.0"
@ -20382,7 +20373,6 @@ fsevents@^1.2.7:
eslint: ^7.32.0 eslint: ^7.32.0
eslint-plugin-jsx-a11y: ^6.4.1 eslint-plugin-jsx-a11y: ^6.4.1
eslint-plugin-react: ^7.25.1 eslint-plugin-react: ^7.25.1
eslint-plugin-react-hooks: ^4.3.0
eslint-plugin-tsdoc: ^0.2.14 eslint-plugin-tsdoc: ^0.2.14
eslint-plugin-unused-imports: ^1.1.4 eslint-plugin-unused-imports: ^1.1.4
husky: ^6.0.0 husky: ^6.0.0