-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.eslintrc.cjs
More file actions
121 lines (121 loc) · 3.8 KB
/
.eslintrc.cjs
File metadata and controls
121 lines (121 loc) · 3.8 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
// 'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: [
'./tsconfig.json',
'./src/tsconfig.app.json',
'./src/tsconfig.spec.json',
'./api/tsconfig.json'
],
tsconfigRootDir: __dirname,
// Performance optimizations
createDefaultProgram: true
},
plugins: ['@typescript-eslint'],
root: true,
// Ignore plain JS config / asset files from type-aware linting to avoid parserOptions.project errors
ignorePatterns: [
'karma.conf.js',
'src/karma.conf.js',
'stryker.node.conf.js',
'api/stryker.node.conf.js',
// Ignore webpack config (plain JS) from type-aware linting
'api/webpack-node.config.js',
'src/assets/**/*',
'src/app/assets/**/*'
],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-extra-semi': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-var-requires': 'off',
'array-bracket-spacing': 'error',
'arrow-parens': ['error', 'always'],
'arrow-spacing': 'error',
'block-spacing': 'error',
'brace-style': ['error', '1tbs'],
'comma-dangle': ['error', 'never'],
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',
'curly': ['error', 'all'],
'dot-notation': 'error',
'eol-last': 'error',
'eqeqeq': 'error',
'func-call-spacing': ['error', 'never'],
// 'func-style': ['error', 'expression'],
'getter-return': 'error',
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
'key-spacing': 'error',
'keyword-spacing': 'error',
'indent': ['error', 2, {
'SwitchCase': 1
}],
'linebreak-style': 'error',
'lines-between-class-members': ['error', 'always', {
'exceptAfterSingleLine': true
}],
'new-parens': ['error', 'always'],
'no-case-declarations': 'off',
'no-else-return': 'error',
'no-empty': 'error',
// 'no-empty-function': ['error', {
// 'allow': ['constructors']
// }],
'no-extra-boolean-cast': 'off',
'no-extra-semi': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-multi-spaces': 'error',
'no-multiple-empty-lines': ['error', {
'max': 1,
'maxEOF': 1
}],
'no-prototype-builtins': 'off',
'no-tabs': 'error',
'no-trailing-spaces': 'error',
'no-whitespace-before-property': 'error',
'no-unreachable': 'error',
'no-unused-expressions': ['error', {
'allowTernary': true
}],
'no-var': 'error',
// 'object-curly-newline': ['error', { 'multiline': true }],
'object-curly-spacing': ['error', 'always'],
// 'object-property-newline': 'error',
'padded-blocks': ['error', 'never'],
'prefer-const': 'error',
'quotes': ['error', 'single'],
'semi': ['error', 'always', {
'omitLastInOneLineBlock': false
}],
'semi-spacing': 'error',
'semi-style': ['error', 'last'],
'space-in-parens': ['error', 'never'],
'switch-colon-spacing': 'error'
},
'overrides': [
{
files: ['**/*.spec.ts', '**/*.spec.js'],
rules: {
// Chai / Sinon assertion style uses expression chains (e.g. expect(x).to.be.true)
// Disable both the base and TS variant of unused-expressions in test specs
'no-unused-expressions': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-unused-vars': 'off'
}
},
{
// Pact spec files legitimately use require() (Pact examples / dynamic loading)
files: ['api/test/pact/pact-tests/**/*.spec.ts'],
rules: {
'@typescript-eslint/no-require-imports': 'off'
}
}
]
};