-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.js
231 lines (226 loc) · 8.86 KB
/
node.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
module.exports = {
env: {
es2021: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:eslint-comments/recommended',
'plugin:import/recommended',
'plugin:promise/recommended',
'plugin:security/recommended-legacy',
'plugin:unicorn/recommended'
],
plugins: [
'@typescript-eslint',
'@stylistic',
'eslint-comments',
'import',
'promise',
'security',
'unicorn'
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {
'class-methods-use-this': 'off',
'handle-callback-err': ['error', '^(err|error)$'],
'max-classes-per-file': 'off',
'no-console': ['error', { allow: ['error'] }],
'no-continue': 'off',
'no-restricted-syntax': 'off',
'no-return-await': 'off',
'no-use-before-define': 'off',
'sort-imports': ['error', {
ignoreCase: false,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
allowSeparatedGroups: true
}],
'@stylistic/array-bracket-spacing': ['error', 'never'],
'@stylistic/array-bracket-newline': ['error', 'consistent'],
'@stylistic/array-element-newline': 'off',
'@stylistic/arrow-parens': 'error',
'@stylistic/arrow-spacing': 'error',
'@stylistic/block-spacing': 'error',
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
'@stylistic/computed-property-spacing': ['error', 'never'],
'@stylistic/dot-location': ['error', 'property'],
'@stylistic/eol-last': 'error',
'@stylistic/function-call-argument-newline': 'off',
'@stylistic/function-call-spacing': ['error', 'never'],
'@stylistic/function-paren-newline': ['error', 'consistent'],
'@stylistic/generator-star-spacing': ['error', { before: true, after: false }],
'@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
'@stylistic/indent': ['error', 2, {
SwitchCase: 1,
ignoredNodes: [
'FunctionExpression > .params[decorators.length > 0]',
'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
'ClassBody.body > PropertyDefinition[decorators.length > 0] > .key'
]
}],
'@stylistic/key-spacing': ['error', {
beforeColon: false, afterColon: true, mode: 'strict'
}],
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
'@stylistic/linebreak-style': 'off',
'@stylistic/line-comment-position': 'off',
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'@stylistic/max-len': ['error', {
code: 120, tabWidth: 2, ignoreComments: true, ignoreUrls: true,
ignoreStrings: true, ignoreTemplateLiterals: true, ignoreRegExpLiterals: true
}],
'@stylistic/max-statements-per-line': ['error', { max: 1 }],
'@stylistic/member-delimiter-style': ['error', {
multiline: { delimiter: 'semi', requireLast: true },
singleline: { delimiter: 'semi', requireLast: true }
}],
'@stylistic/multiline-comment-style': 'off',
'@stylistic/multiline-ternary': 'off',
'@stylistic/new-parens': 'error',
'@stylistic/newline-per-chained-call': 'off',
'@stylistic/no-confusing-arrow': 'error',
'@stylistic/no-extra-parens': 'off',
'@stylistic/no-extra-semi': 'error',
'@stylistic/no-floating-decimal': 'error',
'@stylistic/no-mixed-operators': 'error',
'@stylistic/no-mixed-spaces-and-tabs': 'error',
'@stylistic/no-multi-spaces': 'error',
'@stylistic/no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
'@stylistic/no-tabs': 'error',
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/no-whitespace-before-property': 'error',
'@stylistic/nonblock-statement-body-position': 'off',
'@stylistic/object-curly-newline': ['error', { consistent: true }],
'@stylistic/object-curly-spacing': ['error', 'always'],
'@stylistic/object-property-newline': 'off',
'@stylistic/one-var-declaration-per-line': 'error',
'@stylistic/operator-linebreak': ['error', 'before'],
'@stylistic/padded-blocks': ['error', 'never'],
'@stylistic/padding-line-between-statements': 'off',
'@stylistic/quote-props': ['error', 'as-needed'],
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/rest-spread-spacing': ['error', 'never'],
'@stylistic/semi': ['error', 'always'],
'@stylistic/semi-spacing': 'error',
'@stylistic/semi-style': ['error', 'last'],
'@stylistic/space-before-blocks': ['error', {
functions: 'always', keywords: 'always', classes: 'always'
}],
'@stylistic/space-before-function-paren': ['error', {
anonymous: 'always', named: 'never', asyncArrow: 'always'
}],
'@stylistic/space-in-parens': ['error', 'never'],
'@stylistic/space-infix-ops': 'error',
'@stylistic/space-unary-ops': 'error',
'@stylistic/spaced-comment': ['error', 'always'],
'@stylistic/switch-colon-spacing': 'error',
'@stylistic/template-curly-spacing': 'error',
'@stylistic/template-tag-spacing': 'error',
'@stylistic/type-annotation-spacing': 'error',
'@stylistic/type-generic-spacing': 'error',
'@stylistic/type-named-tuple-spacing': 'error',
'@stylistic/wrap-iife': 'off',
'@stylistic/yield-star-spacing': ['error', 'before'],
'eslint-comments/disable-enable-pair': 'off',
'import/named': 'off',
'import/namespace': 'off',
'import/no-cycle': ['error', { maxDepth: 1 }],
'import/no-default-export': 'error',
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',
'import/order': ['error', {
groups: [
'builtin',
'external',
'internal',
'unknown',
['parent', 'sibling', 'index'],
'type',
'object'
],
pathGroups: [
{ pattern: '@external/**', group: 'internal', position: 'after' },
{ pattern: '@middlewares/**', group: 'internal', position: 'after' },
{ pattern: '@controllers/**', group: 'internal', position: 'after' },
{ pattern: '@useCases/**', group: 'internal', position: 'after' },
{ pattern: '@repositories/**', group: 'internal', position: 'after' },
{ pattern: '@entities/**', group: 'internal', position: 'after' },
{ pattern: '@shared/**', group: 'internal', position: 'after' },
{ pattern: '@interfaces/**', group: 'internal', position: 'after' }
],
alphabetize: { order: 'asc', caseInsensitive: false },
distinctGroup: true,
'newlines-between': 'always',
warnOnUnassignedImports: false,
pathGroupsExcludedImportTypes: ['builtin']
}],
'security/detect-non-literal-fs-filename': 'off',
'security/detect-non-literal-regexp': 'off',
'security/detect-object-injection': 'off',
'unicorn/catch-error-name': ['error', { name: 'err' }],
'unicorn/expiring-todo-comments': 'off',
'unicorn/filename-case': 'off',
'unicorn/import-style': 'off',
'unicorn/no-array-method-this-argument': 'off',
'unicorn/no-null': 'off',
'unicorn/no-thenable': 'off',
'unicorn/no-useless-undefined': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-node-protocol': 'off',
'unicorn/prevent-abbreviations': 'off'
},
overrides: [
{
files: ['*.ts', '*.d.ts'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
rules: {
'@typescript-eslint/default-param-last': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/naming-convention': ['error', {
selector: 'variable',
format: ['camelCase', 'PascalCase', 'snake_case', 'UPPER_CASE']
}],
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/return-await': 'off',
},
parserOptions: {
project: true
},
}
],
settings: {
'import/resolver': {
alias: {
map: [
['@external', './src/external'],
['@entities', './src/entities'],
['@controllers', './src/adapters/controllers'],
['@middlewares', './src/adapters/middlewares'],
['@repositories', './src/adapters/repositories'],
['@useCases', './src/adapters/useCases'],
['@interfaces', './src/interfaces'],
['@shared', './src/shared']
],
extensions: ['.ts', '.tsx']
}
},
'import/parsers': {
[require.resolve('@typescript-eslint/parser')]: ['.ts', '.d.ts'],
},
},
ignorePatterns: ['node_modules']
}