-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.cjs
84 lines (75 loc) · 2.07 KB
/
.eslintrc.cjs
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
82
83
84
module.exports = {
// Specifies the base configurations to extend
extends: [
// Extends the default configuration for React apps
'react-app',
// Extends recommended rules for TanStack Query
// https://tanstack.com/query/v4/docs/eslint/eslint-plugin-query
'plugin:@tanstack/eslint-plugin-query/recommended',
// Extends recommended rules for working with regular expressions
// https://github.com/ota-meshi/eslint-plugin-regexp
'plugin:regexp/recommended',
],
plugins: [
// Plugin for TanStack Query
'@tanstack/query',
// Plugin for stylistic rules
// https://www.npmjs.com/package/@stylistic/eslint-plugin
'@stylistic',
// Plugin for regex rules
'regexp',
// Plugin for React hooks rules
'react-hooks-extra',
],
parser: '@typescript-eslint/parser',
rules: {
// Prefers using type imports
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'no-redeclare': 0,
// Inline comment should be above
'line-comment-position': [
'warn',
{
position: 'above',
},
],
// Configure padding rules before and after variable declarations and statements
'padding-line-between-statements': [
'warn',
{
blankLine: 'always',
prev: '*',
next: ['return', 'if', 'do', 'while', 'for', 'switch', 'try', 'with'],
},
{
blankLine: 'always',
prev: ['if', 'do', 'while', 'for', 'switch', 'try', 'with'],
next: '*',
},
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['if', 'do', 'while', 'for', 'switch', 'try', 'with'],
},
],
// Disables the TypeScript specific no-redeclare rule
'@typescript-eslint/no-redeclare': 0,
// Warns if a button does not have an explicit type attribute
'react/button-has-type': 1,
// Named components must be arrow functions
'react/function-component-definition': [
1,
{
namedComponents: 'arrow-function',
},
],
// Warns if a component uses `useEffect` with a direct `setState` call
'react-hooks-extra/no-direct-set-state-in-use-effect': 'warn',
},
};