-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Expand file tree
/
Copy patheslint.config.mjs
More file actions
103 lines (90 loc) · 3.48 KB
/
eslint.config.mjs
File metadata and controls
103 lines (90 loc) · 3.48 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
import js from '@eslint/js';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
// import { importX } from 'eslint-plugin-import-x';
// import simpleImportSort from 'eslint-plugin-simple-import-sort';
import eslintPluginYml from 'eslint-plugin-yml';
import { defineConfig } from 'eslint/config';
import globals from 'globals';
const SOURCE_FILES_GLOB = '**/*.?([cm])[jt]s?(x)';
export default defineConfig([
{
ignores: ['**/coverage', '**/.vscode', '**/docker-compose.yml', '!.github', 'assets/build', 'lib/routes-deprecated', 'lib/router.js', 'dist', 'dist-lib', 'dist-worker'],
},
{
files: [SOURCE_FILES_GLOB],
plugins: {
'@typescript-eslint': typescriptEslint,
// github,
js,
},
// extends: [typescriptEslint.configs['flat/recommended'], typescriptEslint.configs['flat/stylistic'], n.configs['flat/recommended-script']],
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
},
linterOptions: {
reportUnusedDisableDirectives: false,
},
rules: {
// #region typescript
/*
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off', // stylistic
'@typescript-eslint/consistent-type-definitions': 'off', // stylistic
'@typescript-eslint/no-empty-function': 'off', // stylistic && tests
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-inferrable-types': ['error', { ignoreParameters: true, ignoreProperties: true }],
'@typescript-eslint/no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true }],
'@typescript-eslint/no-unused-vars': ['error', { args: 'after-used', argsIgnorePattern: '^_' }],
*/
// #endregion
},
},
{
files: ['.puppeteerrc.cjs'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
{
/*
files: [SOURCE_FILES_GLOB],
plugins: {
'simple-import-sort': simpleImportSort,
'import-x': importX,
},
rules: {
'sort-imports': 'off',
'import-x/order': 'off',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'import-x/first': 'error',
'import-x/newline-after-import': 'error',
'no-duplicate-imports': 'off',
'import-x/no-duplicates': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
},*/
},
{
files: ['**/*.yaml', '**/*.yml'],
ignores: ['pnpm-lock.yaml'],
plugins: {
yml: eslintPluginYml,
},
language: 'yml/yaml',
rules: {
'lines-around-comment': ['error', { beforeBlockComment: false }],
'yml/indent': ['error', 4, { indicatorValueIndent: 2 }],
'yml/no-empty-mapping-value': 'off',
'yml/quotes': ['error', { prefer: 'single' }],
},
},
]);