-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
135 lines (131 loc) · 3.93 KB
/
.eslintrc.js
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
// 'plugin:react/recommended',
// 'plugin:react/jsx-runtime',
'airbnb',
'prettier',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: [
// 'react',
// 'react-hooks',
'import',
'eslint-comments',
'simple-import-sort',
],
rules: {
// =========== //
// eslint base //
// =========== //
curly: ['error', 'all'],
'linebreak-style': ['error', 'unix'],
'no-mixed-operators': 'error',
'no-console': 'error',
'no-process-exit': 'error',
'no-fallthrough': [
'error',
{ commentPattern: '.*intentional fallthrough.*' },
],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],
// ============================ //
// eslint-plugin-eslint-comment //
// ============================ //
// Require a eslint-enable comment for every eslint-disable comment
'eslint-comments/disable-enable-pair': [
'error',
{
allowWholeFile: true,
},
],
// Disallow a eslint-enable comment for multiple eslint-disable comments
'eslint-comments/no-aggregating-enable': 'error',
// Disallow duplicate eslint-disable comments
'eslint-comments/no-duplicate-disable': 'error',
// Disallow eslint-disable comments without rule names
'eslint-comments/no-unlimited-disable': 'error',
// Disallow unused eslint-disable comments
'eslint-comments/no-unused-disable': 'error',
// Disallow unused eslint-enable comments
'eslint-comments/no-unused-enable': 'error',
// Disallow ESLint directive-comments
'eslint-comments/no-use': [
'error',
{
allow: [
'eslint-disable',
'eslint-disable-line',
'eslint-disable-next-line',
'eslint-enable',
],
},
],
// ==================== //
// eslint-plugin-import //
// ==================== //
// Disallow non-import statements appearing before import statements
'import/first': 'error',
// Require a newline after the last import/require in a group
'import/newline-after-import': 'error',
// Forbid import of modules using absolute paths
'import/no-absolute-path': 'error',
// Disallow AMD require/define
'import/no-amd': 'error',
// Forbid the use of extraneous packages
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
peerDependencies: true,
optionalDependencies: false,
},
],
// Forbid mutable exports
'import/no-mutable-exports': 'error',
// Forbid a module from importing itself
'import/no-self-import': 'error',
// Allow for non-default exports
'import/prefer-default-export': 'off',
// ================================ //
// eslint-plugin-simple-import-sort //
// ================================ //
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': [
'error',
{
groups: [
// Packages. `react` related packages come first.
['^react', '^@?\\w'],
// Internal packages.
['^(assets|objects|reducers|scenes|utils)(/.*|$)'],
// Side effect imports.
['^\\u0000'],
// Parent imports. Put `..` last.
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Other relative imports. Put same-folder imports and `.` behind, and style imports last.
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$', '^.+\\.s?css$'],
],
},
],
// ===== //
// React //
// ===== //
// 'react/jsx-boolean-value': ['error', 'always'],
// 'react/jsx-sort-props': 'error',
// // Checks effect dependencies
// 'react-hooks/exhaustive-deps': 'error',
// // Checks rules of Hooks
// 'react-hooks/rules-of-hooks': 'error',
},
};