forked from mempool/mempool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
92 lines (90 loc) · 2.89 KB
/
eslint.config.js
File metadata and controls
92 lines (90 loc) · 2.89 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
import js from '@eslint/js';
import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';
// Flat config migrated from legacy .eslintrc
export default [
{
ignores: [
'node_modules/**',
'dist/**',
'src/resources/**',
// Keep parity with legacy .eslintignore
'frontend/**',
'server.run.js',
],
},
js.configs.recommended,
// Node globals for local JS utility scripts in this package
{
// Apply to all JS files in this package (including nested ones)
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
languageOptions: {
globals: {
require: 'readonly',
module: 'readonly',
process: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
Buffer: 'readonly',
console: 'readonly',
InitWally: 'readonly',
document: 'readonly',
window: 'readonly',
},
},
},
{
files: ['**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
// Make common browser globals available in TS as well
globals: {
document: 'readonly',
window: 'readonly',
},
},
plugins: {
'@typescript-eslint': tsPlugin,
},
rules: {
// Adjust base recommended rules for TypeScript (matches legacy extends: plugin:@typescript-eslint/eslint-recommended)
...tsPlugin.configs['eslint-recommended']?.overrides?.[0]?.rules,
// Start from @typescript-eslint's recommended rules
...tsPlugin.configs.recommended.rules,
// Project-specific rules migrated from .eslintrc
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-namespace': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/explicit-function-return-type': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-require-imports': 'warn',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'no-case-declarations': 'warn',
'no-console': 'warn',
'no-constant-condition': 'warn',
'no-dupe-else-if': 'warn',
'no-empty': 'warn',
'no-extra-boolean-cast': 'warn',
'no-prototype-builtins': 'warn',
'no-self-assign': 'warn',
'no-useless-catch': 'warn',
'no-var': 'warn',
'prefer-const': 'warn',
'prefer-rest-params': 'warn',
'quotes': ['warn', 'single', { allowTemplateLiterals: true }],
'semi': 'warn',
'curly': ['warn', 'all'],
'eqeqeq': 'warn',
'no-trailing-spaces': 'warn',
},
},
];