-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
105 lines (103 loc) · 2.85 KB
/
.eslintrc.js
File metadata and controls
105 lines (103 loc) · 2.85 KB
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
const fs = require('fs');
const prettierConfig = fs.readFileSync('./.prettierrc', 'utf8');
const prettierOptions = JSON.parse(prettierConfig);
const isProduction = process.env.NODE_ENV === 'production';
module.exports = {
extends: ['airbnb-base', 'prettier'],
root: true,
env: {
node: true,
es2020: true,
},
plugins: ['json', 'prettier'],
parser: '@babel/eslint-parser',
settings: {
'import/resolver': {
node: {
extensions: ['.ts', '.js', '.json'],
moduleDirectory: ['node_modules'],
},
},
},
reportUnusedDisableDirectives: isProduction,
rules: {
'import/no-extraneous-dependencies': ['off'],
'no-debugger': 'off',
'no-console': 'off',
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-underscore-dangle': 'error',
'no-await-in-loop': 'error', // TODO: enable to improve performance
'no-restricted-syntax': 'off', // Not critical for backend part
'prefer-destructuring': 'error',
'no-continue': 'error',
'no-redeclare': [
'error',
{
builtinGlobals: true,
},
],
'import/order': [
'error',
{
groups: [
'external',
'builtin',
'internal',
'type',
'parent',
'sibling',
'index',
'object',
],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
warnOnUnassignedImports: true,
'newlines-between': 'always',
},
],
'prettier/prettier': ['error', prettierOptions],
'import/prefer-default-export': 'off',
'import/extensions': ['error', { json: 'always' }],
'class-methods-use-this': 'off',
'prefer-promise-reject-errors': 'off',
'max-classes-per-file': 'off',
'no-use-before-define': ['off'],
'no-shadow': 'off',
},
overrides: [
{
files: ['./**/*.ts'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
plugins: ['@typescript-eslint', 'prettier'],
parserOptions: {
project: ['./tsconfig.json'],
warnOnUnsupportedTypeScriptVersion: true,
},
rules: {
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-use-before-define': [
'error',
{
functions: false,
classes: false,
},
],
'@typescript-eslint/no-shadow': ['error'],
},
},
],
};