-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
109 lines (106 loc) · 3.76 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
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin', '@stylistic'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:prettier/recommended',
'plugin:sonarjs/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
],
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: ['tsconfig.json', 'apps/*/tsconfig.app.json', 'libs/*/tsconfig.app.json'],
},
node: {
project: ['tsconfig.json', 'apps/*/tsconfig.app.json', 'libs/*/tsconfig.app.json'],
},
},
},
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
// TS rules
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
// SonarJS rules
'sonarjs/no-nested-template-literals': 'warn',
// Quotes
quotes: 'off',
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
// Code Style
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'enumMember',
format: null,
},
],
'@typescript-eslint/member-ordering': [
'error',
{
default: [
// Index signature
// No accessibility for index signature. See above.
// Fields
'public-field', // = ["public-static-field", "public-instance-field"]
'protected-field', // = ["protected-static-field", "protected-instance-field"]
'private-field', // = ["private-static-field", "private-instance-field"]
// Constructors
// Only the accessibility of constructors is configurable. See below.
// Methods
'public-method', // = ["public-static-method", "public-instance-method"]
'protected-method', // = ["protected-static-method", "protected-instance-method"]
'private-method', // = ["private-static-method", "private-instance-method"]
],
},
],
'@stylistic/indent': ['error', 2],
'prettier/prettier': ['error'],
// ESLint rules
'no-process-env': 'error',
curly: ['error', 'all'],
'prefer-object-spread': 'error',
'object-shorthand': ['error', 'properties'],
'no-param-reassign': 'error',
'no-implicit-coercion': 'error',
'no-lonely-if': 'error',
'no-negated-condition': 'error',
'no-throw-literal': 'error',
'no-nested-ternary': 'error',
'no-confusing-arrow': 'warn',
radix: 'error',
'max-depth': ['error', 3],
// enforces return await
'no-return-await': 'off',
'@typescript-eslint/return-await': ['error', 'always'],
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
},
};