-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
146 lines (145 loc) · 5.56 KB
/
Copy patheslint.config.js
File metadata and controls
146 lines (145 loc) · 5.56 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
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
import { defineConfig } from 'eslint/config';
import js from '@eslint/js';
import globals from 'globals';
import tsEslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';
import vitest from '@vitest/eslint-plugin';
export default defineConfig([
js.configs.recommended,
tsEslint.configs.recommendedTypeChecked,
{
languageOptions: {
ecmaVersion: 2022,
globals: globals.node,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
{
plugins: {
'@stylistic': stylistic,
},
rules: {
'array-bracket-spacing': 'error',
'brace-style': 'error',
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': 'error',
'computed-property-spacing': 'error',
curly: 'error',
'dot-notation': 'error',
'eol-last': 'error',
eqeqeq: 'error',
'func-call-spacing': 'error',
indent: [
'error', 4, {
SwitchCase: 1,
},
],
'keyword-spacing': 'error',
'linebreak-style': 'error',
'no-console': [
'error', {
allow: ['assert', 'warn', 'error'],
},
],
'no-constant-binary-expression': 'error',
'no-constructor-return': 'error',
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
'no-multiple-empty-lines': ['error', { max: 1 }],
'no-tabs': 'error',
'no-template-curly-in-string': 'error',
'no-trailing-spaces': 'error',
'no-var': 'error',
'no-whitespace-before-property': 'error',
'object-curly-spacing': ['error', 'always'],
'one-var-declaration-per-line': ['error', 'always'],
'prefer-const': 'error',
'quote-props': ['error', 'as-needed'],
'@stylistic/quotes': ['error', 'single'],
'padded-blocks': ['error', 'never'],
'@stylistic/semi': ['error', 'always'],
'space-before-blocks': 'error',
'space-before-function-paren': [
'error', {
anonymous: 'never',
named: 'never',
},
],
'space-in-parens': 'error',
'space-infix-ops': 'error',
},
},
{
files: ['**/*.{ts,js}'],
rules: {
'@stylistic/indent': [
'error', 4, {
SwitchCase: 1,
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
CallExpression: { arguments: 'first' },
},
],
'@stylistic/member-delimiter-style': [
'error', {
singleline: {
delimiter: 'semi',
requireLast: true,
},
},
],
'@stylistic/no-extra-parens': 'error',
'@stylistic/no-extra-semi': 'error',
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: 'never' }],
'@stylistic/semi': ['error', 'always'],
// TODO: Try to remove existing uses.
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
'@typescript-eslint/explicit-function-return-type': [
'off', {
allowExpressions: true,
},
],
'@typescript-eslint/explicit-module-boundary-types': [
'error', {
allowArgumentsExplicitlyTypedAsAny: true,
},
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': ['error', { allowSingleExtends: true }],
'@typescript-eslint/no-explicit-any': 'off',
// TODO: Investigate whether we can replace it with modern syntax.
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-namespace.md
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unused-vars': [
'error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-useless-constructor': 'error',
// TODO: Try to remove existing uses.
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-non-null-assertion.md
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/restrict-plus-operands': 'error',
},
},
{
files: ['tests/**'],
plugins: {
vitest,
},
rules: {
...vitest.configs.all.rules,
'vitest/max-expects': 'off',
'vitest/no-conditional-in-test': 'off',
'vitest/no-conditional-tests': 'off',
'vitest/no-hooks': 'off',
'vitest/prefer-expect-assertions': 'off',
'vitest/require-top-level-describe': 'off',
},
},
]);