This repository was archived by the owner on Oct 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 198
Expand file tree
/
Copy patheslint.config.js
More file actions
73 lines (70 loc) · 2.56 KB
/
eslint.config.js
File metadata and controls
73 lines (70 loc) · 2.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
import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: ['bundle.js', 'eslint.config.js', 'out/**/*', 'public/**/*', 'data/**/*', 'src/3rdparty/**/*', 'src/**/*.test.ts', 'src/**/*.bench.ts']
},
{ languageOptions: { globals: globals.node } },
pluginJs.configs.recommended,
...tseslint.configs.recommended, // recommendedTypeChecked
// {
// languageOptions: {
// parserOptions: {
// projectService: true,
// tsconfigRootDir: import.meta.dirname,
// },
// }
// },
{
settings: {
'import/resolver': {
node: true,
typescript: true
}
}
},
{
rules: {
indent: ['error', 4, { SwitchCase: 1 }],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],
/**
* https://eslint.org/docs/latest/rules/no-constant-condition#checkloops
*
* Allows constant conditions in loops but not in if statements
*/
'no-constant-condition': ['error', { checkLoops: false }],
'no-case-declarations': 'error',
'@typescript-eslint/no-namespace': 'error',
/**
* (jkm)
* The following rule is included in @typescript-eslint/recommended
* I have set it to warn instead of error, to avoid having to fix it
* We should consider fixing it and setting it to error
*/
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
/**
* Allow variables prefixed with underscores to skip this rule.
* There aren't many good reasons to have unused variables,
* but the codebase has 100s of them.
*/
vars: 'all',
varsIgnorePattern: '^_',
/**
* Allow parameters prefixed with underscores to skip this rule.
* This is a common practice for router methods with req and res parameters.
*/
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_'
}
]
}
}
];