-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy path.eslintrc.cjs
149 lines (147 loc) · 4.57 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
const path = require('node:path');
const MAX_LINE_LENGTH = 120;
module.exports = {
parser: '@typescript-eslint/parser',
ignorePatterns: ['tests/smoke/**'],
env: {
browser: true,
qunit: true,
},
extends: [
'airbnb-base',
'plugin:jsdoc/recommended',
],
plugins: [
'import',
'import-newlines',
],
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: 'tsconfig.json',
},
},
},
rules: {
indent: ['error', 4, {
SwitchCase: 1,
}],
'no-underscore-dangle': ['error', {
allow: ['__filename', '__dirname'],
}],
'import/extensions': ['error', 'never', { json: 'always' }],
'no-param-reassign': 0,
'no-shadow': 0,
'no-bitwise': 0,
'no-new': 0,
'function-call-argument-newline': [
'error',
'consistent',
],
'import/prefer-default-export': 0,
'no-continue': 0,
'no-await-in-loop': 0,
'max-len': ['error', { code: MAX_LINE_LENGTH, ignoreUrls: true }],
'arrow-body-style': 0,
'import/no-extraneous-dependencies': 'off',
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
'no-constant-condition': ['error', { checkLoops: false }],
// jsdoc rules
'jsdoc/check-param-names': 'error',
'jsdoc/check-tag-names': ['error', {
definedTags: [
'scriptlet',
'trustedScriptlet',
'redirect',
'added',
'jest-environment',
],
}],
'jsdoc/tag-lines': 'off',
'jsdoc/require-jsdoc': 0,
'jsdoc/require-param': 0,
'jsdoc/require-param-description': 0,
'jsdoc/require-returns': 'off',
'jsdoc/require-returns-description': 0,
'jsdoc/no-defaults': 0,
'import-newlines/enforce': ['error', { items: 3, 'max-len': MAX_LINE_LENGTH }],
// Split external and internal imports with an empty line
'import/order': [
'error',
{
groups: [
['builtin', 'external'],
],
'newlines-between': 'always',
},
],
// Force proper import and export of types
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
},
],
},
overrides: [
{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: path.join(__dirname),
project: 'tsconfig.json',
},
extends: [
'airbnb-typescript/base',
],
rules: {
'jsdoc/require-param-type': 0,
'jsdoc/require-returns-type': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/indent': ['error', 4],
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'import/no-extraneous-dependencies': 'off',
'@typescript-eslint/type-annotation-spacing': [
'error',
{
after: true,
},
],
'prefer-object-spread': 0,
},
},
// Array destructuring is not allowed according to the
// ReferenceError: _slicedToArray is not defined
{
files: ['src/**/*.{js,ts}'],
rules: {
'prefer-destructuring': [
'error',
{
array: false,
},
],
'no-restricted-syntax': [
'error',
'ArrayPattern',
],
},
},
],
};