-
Notifications
You must be signed in to change notification settings - Fork 1
/
eslint.config.mjs
98 lines (96 loc) · 2.65 KB
/
eslint.config.mjs
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
// @ts-check
import gitIgnore from 'eslint-config-flat-gitignore';
import js from '@eslint/js';
import ts from 'typescript-eslint';
export default ts.config(
// @ts-expect-error bad type inference for exported members of @eslint/js
js.configs.all,
...ts.configs.recommendedTypeChecked,
gitIgnore(),
{
rules: {
'array-element-newline': ['error', 'consistent'],
'arrow-parens': ['error', 'as-needed'],
'capitalized-comments': 'off',
'comma-dangle': ['error', 'always-multiline'],
'dot-location': 'off',
'dot-notation': 'off',
'func-style': 'off',
'function-call-argument-newline': ['error', 'consistent'],
'function-paren-newline': 'off',
'id-length': 'off',
'implicit-arrow-linebreak': 'off',
'indent': ['error', 'tab'],
'lines-around-comment': 'off',
'lines-between-class-members': 'off',
'max-len': ['error', 160],
'max-lines-per-function': ['error', 100],
'max-statements': ['error', 20],
'multiline-comment-style': 'off',
'multiline-ternary': 'off',
'no-confusing-arrow': 'off',
'no-console': 'off',
'no-extra-parens': 'off',
'no-magic-numbers': 'off',
'no-plusplus': 'off',
'no-shadow': 'off',
'no-tabs': 'off',
'no-ternary': 'off',
'no-undefined': 'off',
'no-undef-init': 'off',
'no-underscore-dangle': 'off',
'object-curly-spacing': ['error', 'always'],
'object-property-newline': ['error', { allowAllPropertiesOnSameLine: true }],
'one-var': ['error', 'never'],
'operator-linebreak': ['error', 'after'],
'padded-blocks': ['error', 'never'],
'prefer-destructuring': 'off',
'quote-props': ['error', 'consistent-as-needed'],
'quotes': ['error', 'single'],
'sort-imports': ['error', { allowSeparatedGroups: true, ignoreCase: true }],
'sort-keys': 'off',
'space-before-function-paren': ['error', 'never'],
},
},
{
files: [
'**/*.mts',
],
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', 'nofunc'],
},
},
// disable type-checked rules for non-TS files
{
files: [
'**/*.cjs',
'**/*.mjs',
],
languageOptions: {
globals: {
process: 'readonly',
console: 'readonly',
},
},
extends: [ts.configs.disableTypeChecked],
},
// workaround for a too broad sourceType setting in base config:
// https://github.com/typescript-eslint/typescript-eslint/blob/v7.6.0/packages/typescript-eslint/src/configs/base.ts#L10
{
files: [
'**/*.cjs',
],
languageOptions: {
sourceType: 'commonjs',
},
},
);