-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
78 lines (72 loc) · 2.18 KB
/
Copy patheslint.config.mjs
File metadata and controls
78 lines (72 loc) · 2.18 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
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import prettier from 'eslint-config-prettier'
import globals from 'globals'
export default [
{ ignores: ['build/**', 'dist/**', 'node_modules/**'] },
js.configs.recommended,
...pluginVue.configs['flat/recommended'],
prettier,
{
rules: {
'prefer-const': 'error',
'no-var': 'error',
eqeqeq: ['error', 'smart'],
// Security: these must never appear anywhere in this codebase.
'no-eval': 'error',
'no-implied-eval': 'error',
'no-new-func': 'error',
'vue/no-v-html': 'error',
// Prettier owns formatting; keep vue templates out of fights with it.
'vue/max-attributes-per-line': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/html-self-closing': 'off'
}
},
// Main + preload: Node process, Electron allowed.
{
files: ['src/main/**', 'src/preload/**', 'electron.vite.config.mjs', 'scripts/**'],
languageOptions: { globals: { ...globals.node } }
},
// Renderer: browser only. It must never touch Node or Electron directly —
// everything goes through the window.api preload surface.
{
files: ['src/renderer/**'],
languageOptions: { globals: { ...globals.browser } },
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'electron',
message: 'Renderer code must use window.api (preload), never electron directly.'
}
],
patterns: [
{
group: [
'node:*',
'fs',
'fs/*',
'path',
'crypto',
'child_process',
'os',
'net',
'http',
'https'
],
message: 'Node built-ins are main-process only. Add an IPC handler instead.'
}
]
}
]
}
},
// Tests: Node + browser globals (jsdom), vitest's are imported explicitly.
{
files: ['tests/**', 'vitest.config.mjs', 'eslint.config.mjs'],
languageOptions: { globals: { ...globals.node, ...globals.browser } }
}
]