-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
164 lines (164 loc) · 4.26 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
jest: true,
node: true,
},
extends: [
'airbnb',
'next/core-web-vitals',
'plugin:@next/next/recommended',
'plugin:@typescript-eslint/recommended',
],
overrides: [
{
files: ['*.test.js', '*.spec.js'],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'global-require': 'off',
},
},
{
files: [
'server/**/*.[jt]s',
'*.node.js',
'*.config.js',
'db/**/*.[jt]s',
'models/**/*.[jt]s',
],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
],
parser: '@typescript-eslint/parser',
// parser: '@babel/eslint-parser',
plugins: ['@typescript-eslint'],
root: true,
rules: {
'array-element-newline': [
'error',
{
ArrayExpression: 'consistent',
},
],
'global-require': ['off'],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: ['**/*.test.js', '**/*.spec.js', '**/jest*.js'] },
],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal'],
pathGroups: [
{
pattern: 'react',
group: 'external',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'import/prefer-default-export': ['off'],
indent: ['warn', 2, {
ignoredNodes: ['ConditionalExpression'],
SwitchCase: 1,
}],
'jsx-a11y/href-no-hash': ['off'],
'lines-between-class-members': ['off'],
'max-len': [
'warn',
{
code: 120,
comments: 120,
ignoreComments: true,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreTrailingComments: true,
ignoreUrls: true,
tabWidth: 2,
},
],
'@next/next/no-img-element': ['off'],
'no-trailing-spaces': ['error', {
ignoreComments: true,
skipBlankLines: true,
}],
'no-restricted-exports': ['off'],
'no-unused-vars': ['off'],
'no-use-before-define': ['off'],
'object-curly-newline': ['error', {
consistent: true,
}],
'padded-blocks': ['off'],
'react/destructuring-assignment': ['off'],
'react/function-component-definition': [
'off', {
namedComponents: 'arrow-function',
},
],
'react/jsx-filename-extension': ['warn', { extensions: ['.js', '.jsx', '.tsx'] }],
'react/jsx-indent': ['warn', 2],
'react/jsx-no-useless-fragment': ['error', {
allowExpressions: true,
}],
'react/jsx-props-no-spreading': ['off'],
'react/prefer-stateless-function': ['off'],
'react/prop-types': ['off'],
'react/react-in-jsx-scope': ['off'],
'react/require-default-props': ['off'],
semi: ['error', 'never'],
'semi-style': ['error', 'first'],
// TODO: replace sort-imports with eslint-plugin-import's import/order
'sort-imports': ['off'],
'spaced-comment': ['off'],
'@typescript-eslint/ban-ts-comment': ['off'],
'@typescript-eslint/no-empty-interface': ['warn', { allowSingleExtends: true }],
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/no-unused-vars': ['warn'],
'@typescript-eslint/no-inferrable-types': ['error', {
ignoreParameters: true,
ignoreProperties: true,
}],
'quote-props': ['error', 'as-needed'],
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
},
settings: {
'import/resolver': {
alias: {
map: [
['@', '.'],
['@components', './src/components'],
['@db', './db'],
['@models', './models'],
['@resources', './resources'],
['@server', './server'],
['@src', './src'],
['@types', './types'],
['@utils', './utils'],
],
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
},
},
}