-
Notifications
You must be signed in to change notification settings - Fork 0
/
eslint.config.js
78 lines (77 loc) · 2.08 KB
/
eslint.config.js
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
import { fileURLToPath } from 'node:url'
import react from '@eslint-react/eslint-plugin'
import { includeIgnoreFile } from '@eslint/compat'
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
export default tseslint.config(
js.configs.recommended,
{
extends: tseslint.configs.recommended,
rules: {
'@typescript-eslint/array-type': ['warn', { default: 'generic' }],
// Allow unused vars if prefixed with `_` (https://typescript-eslint.io/rules/no-unused-vars/)
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
},
// Preload environment
{
files: ['src/preload/**/*'],
languageOptions: {
globals: {
// https://www.electronjs.org/docs/latest/tutorial/tutorial-preload#augmenting-the-renderer-with-a-preload-script
...globals.node,
...globals.browser,
Buffer: globals.nodeBuiltin.Buffer,
process: globals.nodeBuiltin.process,
clearImmediate: globals.nodeBuiltin.clearImmediate,
setImmediate: globals.nodeBuiltin.setImmediate,
},
},
rules: {
// Preload scripts may use `require()` for accessing Electron APIs
// https://www.electronjs.org/docs/latest/tutorial/esm#sandboxed-preload-scripts-cant-use-esm-imports
'@typescript-eslint/no-require-imports': 'off',
},
},
// Renderer process
{
files: ['src/renderer/**/*'],
...react.configs.recommended,
languageOptions: {
globals: { ...globals.browser },
parser: tseslint.parser,
},
},
// Node or Node-like processes
{
files: ['**/*.config.js', 'src/main/**/*', 'src/services/**/*'],
languageOptions: {
globals: {
...globals.node,
...globals.nodeBuiltin,
...globals.worker,
},
},
},
// Applies to all contexts
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},
// Global ignores
includeIgnoreFile(fileURLToPath(new URL('.gitignore', import.meta.url))),
)