-
Notifications
You must be signed in to change notification settings - Fork 6
/
.eslintrc.cjs
106 lines (97 loc) · 2.58 KB
/
.eslintrc.cjs
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
module.exports = {
root: true,
env: {
es6: true,
commonjs: true,
},
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.eslint.json',
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:import/typescript',
'prettier',
],
plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'import'],
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin'],
rules: {
// Overwrites ts rules that conflicts with basic eslint rules
/**
* `no-shadow` doesn't support Typescript enums
* see https://github.com/typescript-eslint/typescript-eslint/issues/2483
*/
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
prefix: ['I'],
},
],
},
},
{
files: ['**/*.spec.{js,ts,tsx}'],
rules: {
'tsdoc/syntax': 'off',
},
},
],
rules: {
'no-console': 'error',
'no-void': ['error', { allowAsStatement: true }],
'no-constant-condition': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-misused-promises': [
'error',
{
checksVoidReturn: false,
},
],
'tsdoc/syntax': 'warn',
// note you must disable the base rule as it can report incorrect errors
'no-return-await': 'off',
'@typescript-eslint/return-await': 'error',
/**
* Import eslint rules
*/
'import/no-cycle': ['error', { ignoreExternal: true }],
'import/no-useless-path-segments': 'error',
'import/no-extraneous-dependencies': 'error',
'import/no-default-export': 'error',
'import/order': [
'error',
{
alphabetize: { order: 'asc' },
groups: ['builtin', 'external', 'unknown', ['internal', 'parent', 'sibling', 'index']],
pathGroups: [
{
pattern: '$**',
group: 'unknown',
position: 'after',
},
],
'newlines-between': 'always',
},
],
'import/no-duplicates': 'error',
},
};