Skip to content

Commit 3f46844

Browse files
ghmcadamsgaearon
andauthored
[eslint-plugin-react-hooks] Added meta property (including docs) (#16607)
* [eslint-plugin-react-hooks] Added meta property (including docs) * [eslint-plugin-react-hooks] Fixed typo (`RuleOfHooks` -> `RulesOfHooks`) Co-authored-by: Dan Abramov <[email protected]>
1 parent 2bf60d9 commit 3f46844

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111

1212
export default {
1313
meta: {
14+
type: 'suggestion',
15+
docs: {
16+
description:
17+
'verifies the list of dependencies for Hooks like useEffect and similar',
18+
category: 'Best Practices',
19+
recommended: true,
20+
url: 'https://github.com/facebook/react/issues/14920',
21+
},
1422
fixable: 'code',
1523
schema: [
1624
{

packages/eslint-plugin-react-hooks/src/RulesOfHooks.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ function isInsideComponentOrHook(node) {
106106
}
107107

108108
export default {
109+
meta: {
110+
type: 'problem',
111+
docs: {
112+
description: 'enforces the Rules of Hooks',
113+
category: 'Possible Errors',
114+
recommended: true,
115+
url: 'https://reactjs.org/docs/hooks-rules.html',
116+
},
117+
},
109118
create(context) {
110119
const codePathReactHooksMapStack = [];
111120
const codePathSegmentStack = [];

packages/eslint-plugin-react-hooks/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
'use strict';
99

10-
import RuleOfHooks from './RulesOfHooks';
10+
import RulesOfHooks from './RulesOfHooks';
1111
import ExhaustiveDeps from './ExhaustiveDeps';
1212

1313
export const configs = {
@@ -21,6 +21,6 @@ export const configs = {
2121
};
2222

2323
export const rules = {
24-
'rules-of-hooks': RuleOfHooks,
24+
'rules-of-hooks': RulesOfHooks,
2525
'exhaustive-deps': ExhaustiveDeps,
2626
};

0 commit comments

Comments
 (0)