-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
128 lines (123 loc) · 4.26 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
module.exports = {
env: {
node: true,
es6: true,
},
plugins: [
'@typescript-eslint',
'unicorn',
'jest',
'eslint-plugin-tsdoc',
'jsdoc',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsdoc/recommended',
'plugin:unicorn/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
rules: {
// Vanilla ESLint
'array-bracket-newline': ['error', { 'multiline': false, 'minItems': 3 }],
'array-bracket-spacing': ['error', 'never'],
'array-element-newline': ['error', { 'multiline': true, 'minItems': 3 }],
'arrow-body-style': ['error', 'as-needed'],
'arrow-parens': ['error', 'always'],
'arrow-spacing': ['error'],
'block-spacing': ['error'],
'brace-style': 'off',
'comma-dangle': 'off',
'comma-spacing': 'off',
'curly': ['error'],
'eol-last': ['error', 'always'],
'eqeqeq': 'error',
'func-call-spacing': 'off',
'function-call-argument-newline': ['error', 'consistent'],
'function-paren-newline': ['error', 'multiline-arguments'],
'indent': ['error', 2],
'key-spacing': ['error', { 'beforeColon': false }],
'keyword-spacing': 'off',
'multiline-ternary': ['error', 'always'],
'newline-per-chained-call': ['error', { 'ignoreChainWithDepth': 2 }],
'no-trailing-spaces': 'error',
'no-unneeded-ternary': 'error',
'no-use-before-define': 'off',
'no-var': 'error',
'no-whitespace-before-property': 'error',
'object-curly-spacing': 'off',
'object-property-newline': ['error', { 'allowAllPropertiesOnSameLine': true }],
'operator-linebreak': ['error', 'after'],
'prefer-template': 'error',
'quotes': 'off',
'require-await': 'error',
'semi': 'off',
'space-before-blocks': 'error',
'space-before-function-paren': 'off',
'space-infix-ops': 'off',
'spaced-comment': ['error', 'always'],
'template-curly-spacing': 'error',
'max-len': ['error',
{
'code': 120,
'ignoreComments': true,
'ignoreStrings': true,
'ignoreTemplateLiterals': true,
'ignoreRegExpLiterals': true,
}],
// Typescript
'@typescript-eslint/array-type': ['error'],
'@typescript-eslint/brace-style': ['error'],
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
'@typescript-eslint/comma-spacing': ['error', { 'before': false, 'after': true }],
'@typescript-eslint/explicit-function-return-type': ['error'],
'@typescript-eslint/explicit-module-boundary-types': ['error'],
'@typescript-eslint/func-call-spacing': ['error', 'never'],
'@typescript-eslint/keyword-spacing': ['error', { 'before': true }],
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-use-before-define': ['error', { 'functions': false, 'classes': true, 'variables': true }],
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
'@typescript-eslint/quotes': ['error', 'single'],
'@typescript-eslint/semi': ['error'],
'@typescript-eslint/space-before-function-paren': ['error', 'never'],
'@typescript-eslint/space-infix-ops': ['error'],
'@typescript-eslint/type-annotation-spacing': ['error'],
// JSDoc
'jsdoc/require-description': ['error'],
'jsdoc/require-param-type': 0,
'jsdoc/require-returns': 0,
'jsdoc/require-returns-type': 0,
'jsdoc/match-description': ['error',
{
mainDescription: '[A-Z].*',
tags:
{
param: {
message: 'The parameter description has to start with "The"',
match: 'The .*',
},
},
}],
// TSDoc
'tsdoc/syntax': 'error',
// Jest
'jest/no-alias-methods': ['error'],
'jest/prefer-called-with': ['error'],
'jest/prefer-expect-resolves': ['error'],
'jest/prefer-strict-equal': ['error'],
'jest/prefer-to-contain': ['error'],
'jest/prefer-to-have-length': ['error'],
'jest/require-top-level-describe': ['error'],
'jest/no-restricted-matchers': ['error',
{
'toBeTruthy': 'Avoid `toBeTruthy`',
'toBeFalsy': 'Avoid `toBeFalsy`',
}],
// Unicorn
'unicorn/no-process-exit': 0,
},
};