@wistia/eslint-config 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +4 -10
- package/src/configs/react.mjs +2 -13
- package/src/rules/react.mjs +197 -476
- package/src/rules/vitest.mjs +2 -1
- package/test/__snapshots__/react.mjs.snap +287 -525
- package/test/__snapshots__/vitest.mjs.snap +1 -1
- package/src/rules/react-hooks.mjs +0 -72
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// only add react hooks rules
|
|
2
|
-
// see: https://react.dev/reference/rules/rules-of-hooks
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
// Enforce Rules of Hooks
|
|
6
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#rules-of-hooks
|
|
7
|
-
'react-hooks/rules-of-hooks': 'error',
|
|
8
|
-
|
|
9
|
-
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
10
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#exhaustive-deps
|
|
11
|
-
'react-hooks/exhaustive-deps': 'error',
|
|
12
|
-
|
|
13
|
-
// Validates the compiler configuration options
|
|
14
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#config
|
|
15
|
-
'react-hooks/config': 'off',
|
|
16
|
-
|
|
17
|
-
// Validates higher order functions defining nested components or hooks
|
|
18
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#component-hook-factories
|
|
19
|
-
'react-hooks/component-hook-factories': 'error',
|
|
20
|
-
|
|
21
|
-
// Validates usage of Error Boundaries instead of try/catch for child errors
|
|
22
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#error-boundaries
|
|
23
|
-
'react-hooks/error-boundaries': 'error',
|
|
24
|
-
|
|
25
|
-
// Validates configuration of gating mode
|
|
26
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#gating
|
|
27
|
-
'react-hooks/gating': 'off',
|
|
28
|
-
|
|
29
|
-
// Validates against assignment/mutation of globals during render
|
|
30
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#globals
|
|
31
|
-
'react-hooks/globals': 'error',
|
|
32
|
-
|
|
33
|
-
// Validates against mutating props, state, and other immutable values
|
|
34
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#immutability
|
|
35
|
-
'react-hooks/immutability': 'error',
|
|
36
|
-
|
|
37
|
-
// Validates against usage of libraries which are incompatible with memoization
|
|
38
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#incompatible-library
|
|
39
|
-
'react-hooks/incompatible-library': 'error',
|
|
40
|
-
|
|
41
|
-
// Validates that existing manual memoization is preserved by the compiler
|
|
42
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#preserve-manual-memoization
|
|
43
|
-
'react-hooks/preserve-manual-memoization': 'error',
|
|
44
|
-
|
|
45
|
-
// Validates that components/hooks are pure by checking known-impure functions
|
|
46
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#purity
|
|
47
|
-
'react-hooks/purity': 'error',
|
|
48
|
-
|
|
49
|
-
// Validates correct usage of refs, not reading/writing during render
|
|
50
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#refs
|
|
51
|
-
'react-hooks/refs': 'error',
|
|
52
|
-
|
|
53
|
-
// Validates against calling setState synchronously in an effect
|
|
54
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#set-state-in-effect
|
|
55
|
-
'react-hooks/set-state-in-effect': 'error',
|
|
56
|
-
|
|
57
|
-
// Validates against setting state during render
|
|
58
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#set-state-in-render
|
|
59
|
-
'react-hooks/set-state-in-render': 'error',
|
|
60
|
-
|
|
61
|
-
// Validates that components are static, not recreated every render
|
|
62
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#static-components
|
|
63
|
-
'react-hooks/static-components': 'error',
|
|
64
|
-
|
|
65
|
-
// Validates against syntax that React Compiler does not support
|
|
66
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#unsupported-syntax
|
|
67
|
-
'react-hooks/unsupported-syntax': 'error',
|
|
68
|
-
|
|
69
|
-
// Validates usage of the useMemo hook without a return value
|
|
70
|
-
// https://react.dev/reference/eslint-plugin-react-hooks#use-memo
|
|
71
|
-
'react-hooks/use-memo': 'error',
|
|
72
|
-
};
|