chore: add ESLint v9 config with typescript-eslint
- 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
This commit is contained in:
102
eslint.config.mjs
Normal file
102
eslint.config.mjs
Normal file
@@ -0,0 +1,102 @@
|
||||
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,
|
||||
},
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user