Repository navigation
Expand file tree
/
Copy patheslint.config.mjs
More file actions
120 lines (112 loc) · 3.29 KB
/
Copy patheslint.config.mjs
File metadata and controls
120 lines (112 loc) · 3.29 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import js from "@eslint/js";
import globals from "globals";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
/**
* Flat ESLint config. Pragmatic baseline for a codebase that was previously
* unlinted: correctness rules are errors, stylistic noise is relaxed. Tighten
* over time (e.g. promote unused-vars and exhaustive-deps to errors).
*/
export default [
{
ignores: [
"dist/**",
"build/**",
"release/**",
".artifacts/**",
"node_modules/**",
".notes-app/**",
".versions/**",
"docs-site-dist/**",
"docs-site/**",
"docs-site/.vitepress/theme/tokens.css"
]
},
js.configs.recommended,
// Harmless pre-existing escape style across the (previously unlinted) codebase.
// Keep as a warning rather than blocking CI; clean up opportunistically.
{
rules: { "no-useless-escape": "warn" }
},
// Renderer (React) source — browser environment, ESM modules.
{
files: ["src/**/*.{js,jsx}"],
languageOptions: {
ecmaVersion: 2023,
sourceType: "module",
parserOptions: { ecmaFeatures: { jsx: true } },
globals: { ...globals.browser, ...globals.worker }
},
plugins: { react, "react-hooks": reactHooks },
settings: { react: { version: "detect" } },
rules: {
...react.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"no-unused-vars": ["warn", { argsIgnorePattern: "^_" }]
}
},
// AI subsystem — CommonJS, runs in the Electron main (Node) process.
{
files: ["ai/**/*.js", "src/ai/**/*.js"],
languageOptions: {
ecmaVersion: 2023,
sourceType: "commonjs",
globals: { ...globals.node }
},
rules: {
"no-unused-vars": ["warn", { argsIgnorePattern: "^_" }]
}
},
// Electron main/preload and build scripts — CommonJS, Node environment.
{
files: ["electron/**/*.{js,cjs}", "scripts/**/*.{js,cjs}", "*.cjs"],
languageOptions: {
ecmaVersion: 2023,
sourceType: "commonjs",
globals: { ...globals.node }
},
rules: {
"no-unused-vars": ["warn", { argsIgnorePattern: "^_" }]
}
},
// ESM config files (vite, eslint) — Node environment, module syntax.
{
files: ["*.config.js", "*.config.mjs", "vite.config.js"],
languageOptions: {
ecmaVersion: 2023,
sourceType: "module",
globals: { ...globals.node }
}
},
// Test files — Vitest globals plus jsdom browser environment.
{
files: ["**/*.test.{js,jsx,cjs}", "**/*.spec.{js,jsx,cjs}"],
languageOptions: {
ecmaVersion: 2023,
sourceType: "module",
parserOptions: { ecmaFeatures: { jsx: true } },
globals: {
...globals.browser,
...globals.node,
vi: "readonly",
describe: "readonly",
it: "readonly",
test: "readonly",
expect: "readonly",
beforeEach: "readonly",
afterEach: "readonly",
beforeAll: "readonly",
afterAll: "readonly"
}
},
plugins: { react, "react-hooks": reactHooks },
settings: { react: { version: "detect" } },
rules: {
"no-unused-vars": "off"
}
}
];