forked from taiga-family/taiga-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
130 lines (126 loc) · 4.52 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
const CI_MODE = process.env['TUI_CI'] === 'true';
console.log('CI mode', CI_MODE);
const DEFAULT = [
'@tinkoff/eslint-config-angular',
'@tinkoff/eslint-config-angular/html',
'@tinkoff/eslint-config-angular/rxjs',
'@tinkoff/eslint-config-angular/imports',
'@tinkoff/eslint-config-angular/file-progress',
'@tinkoff/eslint-config-angular/line-statements',
'@tinkoff/eslint-config-angular/member-ordering',
'@tinkoff/eslint-config-angular/decorator-position',
// @custom
'./scripts/eslint/common/cypress.js',
'./scripts/eslint/common/naming-convention.js',
];
const ONLY_CI = CI_MODE
? [
'@tinkoff/eslint-config',
'@tinkoff/eslint-config-angular/promise',
// @custom
'./scripts/eslint/ci/nx.js',
]
: [];
/**
* @type {import('eslint').Linter.Config}
*/
module.exports = {
root: true,
extends: [...ONLY_CI, ...DEFAULT],
ignorePatterns: [
'projects/**/test.ts',
'projects/**/icons/all.ts',
'404.html',
'*.js',
'*.json',
'*.less',
'*.md',
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: [require.resolve('./tsconfig.eslint.json')],
},
plugins: ['unicorn', '@taiga-ui/eslint-plugin'],
parser: '@typescript-eslint/parser',
rules: {
quotes: 'off',
'@typescript-eslint/quotes': ['error', 'backtick'],
'dot-notation': 'off',
'@typescript-eslint/dot-notation': [
'error',
{
allowPrivateClassPropertyAccess: true,
allowProtectedClassPropertyAccess: true,
allowIndexSignaturePropertyAccess: true,
},
],
'@typescript-eslint/no-useless-constructor': 'off',
'no-prototype-builtins': 'off',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/prefer-includes': 'error',
'prefer-template': 'error',
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
},
],
'@typescript-eslint/no-base-to-string': 'error',
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'unicorn/prefer-string-slice': 'error',
'unicorn/no-array-push-push': 'error',
'unicorn/require-number-to-fixed-digits-argument': 'error',
'unicorn/no-empty-file': 'error',
'unicorn/new-for-builtins': 'error',
'unicorn/no-useless-spread': 'error',
'unicorn/escape-case': 'error',
'unicorn/no-unsafe-regex': 'error',
'unicorn/filename-case': [
'error',
{
case: 'kebabCase',
},
],
'@taiga-ui/injection-token-description': 'error',
'@taiga-ui/no-deep-imports': [
'error',
{
currentProject: `(?<=projects/)([-\\w]+)`,
ignoreImports: [
'\\?raw',
'@taiga-ui/testing/cypress',
'@taiga-ui/testing/setup-jest',
],
},
],
'@taiga-ui/prefer-inject-decorator': 'error',
// TODO: move to @tinkoff/eslint-config-angular
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'eslint-comments/no-unlimited-disable': 'off',
'eslint-comments/disable-enable-pair': 'off',
'import/no-dynamic-require': 'off',
'promise/catch-or-return': 'off',
'max-nested-callbacks': 'off',
'import/no-deprecated': 'off',
'prefer-destructuring': 'off',
'promise/no-nesting': 'off',
'spaced-comment': 'off',
'no-loop-func': 'off',
'no-bitwise': 'off',
},
};