-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Expand file tree
/
Copy pathreact-hooks.js
More file actions
81 lines (63 loc) · 3.36 KB
/
react-hooks.js
File metadata and controls
81 lines (63 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
module.exports = {
plugins: [
'react-hooks',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
rules: {
// Enforce Rules of Hooks
// https://react.dev/reference/eslint-plugin-react-hooks/lints/rules-of-hooks
'react-hooks/rules-of-hooks': 'error',
// Verify the list of the dependencies for Hooks like useEffect and similar
// https://react.dev/reference/eslint-plugin-react-hooks/lints/exhaustive-deps
'react-hooks/exhaustive-deps': 'error',
// Validates higher order functions defining nested components or hooks
// https://react.dev/reference/eslint-plugin-react-hooks/lints/component-hook-factories
'react-hooks/component-hook-factories': 'error',
// Validates the compiler configuration options
// https://react.dev/reference/eslint-plugin-react-hooks/lints/config
'react-hooks/config': 'error',
// Validates usage of Error Boundaries instead of try/catch for child errors
// https://react.dev/reference/eslint-plugin-react-hooks/lints/error-boundaries
'react-hooks/error-boundaries': 'error',
// Validates configuration of gating mode
// https://react.dev/reference/eslint-plugin-react-hooks/lints/gating
'react-hooks/gating': 'error',
// Validates against assignment/mutation of globals during render
// https://react.dev/reference/eslint-plugin-react-hooks/lints/globals
'react-hooks/globals': 'error',
// Validates against mutating props, state, and other immutable values
// https://react.dev/reference/eslint-plugin-react-hooks/lints/immutability
'react-hooks/immutability': 'error',
// Validates against usage of libraries which are incompatible with memoization
// https://react.dev/reference/eslint-plugin-react-hooks/lints/incompatible-library
'react-hooks/incompatible-library': 'warn',
// Validates that existing manual memoization is preserved by the compiler
// https://react.dev/reference/eslint-plugin-react-hooks/lints/preserve-manual-memoization
'react-hooks/preserve-manual-memoization': 'error',
// Validates that existing manual memoization is preserved by the compiler
// https://react.dev/reference/eslint-plugin-react-hooks/lints/purity
'react-hooks/purity': 'error',
// Validates correct usage of refs, not reading/writing during render
// https://react.dev/reference/eslint-plugin-react-hooks/lints/refs
'react-hooks/refs': 'error',
// Validates against calling setState synchronously in an effect
// https://react.dev/reference/eslint-plugin-react-hooks/lints/set-state-in-effect
'react-hooks/set-state-in-effect': 'error',
// Validates against setting state during render
// https://react.dev/reference/eslint-plugin-react-hooks/lints/set-state-in-render
'react-hooks/set-state-in-render': 'error',
// Validates that components are static, not recreated every render
// https://react.dev/reference/eslint-plugin-react-hooks/lints/static-components
'react-hooks/static-components': 'error',
// Validates against syntax that React Compiler does not support
// https://react.dev/reference/eslint-plugin-react-hooks/lints/unsupported-syntax
'react-hooks/unsupported-syntax': 'warn',
// Validates usage of the `useMemo` hook without a return value
// https://react.dev/reference/eslint-plugin-react-hooks/lints/use-memo
'react-hooks/use-memo': 'error',
},
};