-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheslint.config.mjs
98 lines (92 loc) · 2.64 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
import eslint from '@eslint/js';
import tsEslint from 'typescript-eslint';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import jsoncPlugin from 'eslint-plugin-jsonc';
import tsdocPlugin from 'eslint-plugin-tsdoc';
import stylistic from '@stylistic/eslint-plugin';
export default tsEslint.config(
// Shared configuration
eslint.configs.recommended,
stylistic.configs.customize({
quoteProps: 'consistent',
semi: true,
jsx: false,
}),
{
ignores: [
'.tsimp/**',
'.vscode/**',
'coverage/**',
'deno/**',
'lib/**',
'node_modules/**',
'package-lock.json',
],
},
// JS configuration
{
files: ['**/*.js'],
plugins: {
'@stylistic': stylistic,
},
rules: {
'@stylistic/array-bracket-spacing': 'off',
'@stylistic/no-multiple-empty-lines': ['error', { 'max': 2 }],
'@stylistic/quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
'@stylistic/space-before-function-paren': ['error', 'always'],
'no-var': 'error',
'no-warning-comments': 'warn',
'prefer-const': 'error',
},
},
// TS configuration
...tsEslint.configs.recommendedTypeChecked.map(
c => ({ ...c, files: ['**/*.ts'] }),
),
{
files: ['**/*.ts'],
languageOptions: {
parserOptions: {
tsconfigRootDir: import.meta.dirname,
projectService: {
allowDefaultProject: [
'test/*.ts',
'examples/*.ts',
'benchmarks/*.ts',
],
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 12,
},
ecmaVersion: 2020,
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': tsPlugin,
'@stylistic': stylistic,
'tsdoc': tsdocPlugin,
},
rules: {
'@stylistic/array-bracket-spacing': 'off',
'@stylistic/no-multiple-empty-lines': ['error', { 'max': 2 }],
'@stylistic/object-curly-newline': ['error', { 'ObjectExpression': { 'minProperties': 3 } }],
'@stylistic/quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': true }],
'@stylistic/space-before-function-paren': ['error', 'always'],
'no-var': 'error',
'no-warning-comments': 'warn',
'prefer-const': 'error',
'tsdoc/syntax': 'error',
},
},
// JSON configuration
...jsoncPlugin.configs['flat/recommended-with-jsonc'],
{
files: ['*.json', '*.json5', '*.jsonc'],
plugins: {
'jsonc': jsoncPlugin,
},
rules: {
'jsonc/array-bracket-newline': ['error', 'consistent'],
'jsonc/array-element-newline': ['error', 'consistent'],
},
},
);