- Add eslint.config.mjs with typescript-eslint integration - Install typescript-eslint, @typescript-eslint/eslint-plugin, @typescript-eslint/parser - Fix unused params warning in ipc-handlers.ts
103 lines
2.3 KiB
JavaScript
103 lines
2.3 KiB
JavaScript
import react from "eslint-plugin-react";
|
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
import tseslint from "typescript-eslint";
|
|
|
|
export default tseslint.config(
|
|
// Ignore patterns
|
|
{
|
|
ignores: ["out/**", "node_modules/**", "dist/**", "*.min.js"],
|
|
},
|
|
|
|
// Main process & Preload (Node.js)
|
|
{
|
|
files: ["src/main/**/*.ts", "src/preload/**/*.ts"],
|
|
languageOptions: {
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
ecmaVersion: "latest",
|
|
sourceType: "module",
|
|
},
|
|
globals: {
|
|
console: "readonly",
|
|
process: "readonly",
|
|
require: "readonly",
|
|
module: "readonly",
|
|
__dirname: "readonly",
|
|
Buffer: "readonly",
|
|
setTimeout: "readonly",
|
|
setInterval: "readonly",
|
|
clearTimeout: "readonly",
|
|
clearInterval: "readonly",
|
|
},
|
|
},
|
|
plugins: {
|
|
"@typescript-eslint": tseslint.plugin,
|
|
},
|
|
rules: {
|
|
...tseslint.configs.recommended.rules,
|
|
"no-console": "off",
|
|
},
|
|
},
|
|
|
|
// Renderer process (React)
|
|
{
|
|
files: ["src/renderer/**/*.ts", "src/renderer/**/*.tsx"],
|
|
languageOptions: {
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
ecmaVersion: "latest",
|
|
sourceType: "module",
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
globals: {
|
|
console: "readonly",
|
|
window: "readonly",
|
|
document: "readonly",
|
|
localStorage: "readonly",
|
|
fetch: "readonly",
|
|
FormData: "readonly",
|
|
Blob: "readonly",
|
|
URL: "readonly",
|
|
requestAnimationFrame: "readonly",
|
|
cancelAnimationFrame: "readonly",
|
|
},
|
|
},
|
|
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",
|
|
"no-console": "off",
|
|
},
|
|
},
|
|
|
|
// Shared types (TypeScript only, no React)
|
|
{
|
|
files: ["src/shared/**/*.ts"],
|
|
languageOptions: {
|
|
parser: tseslint.parser,
|
|
parserOptions: {
|
|
ecmaVersion: "latest",
|
|
sourceType: "module",
|
|
},
|
|
},
|
|
plugins: {
|
|
"@typescript-eslint": tseslint.plugin,
|
|
},
|
|
rules: {
|
|
...tseslint.configs.recommended.rules,
|
|
},
|
|
},
|
|
);
|