47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
import js from '@eslint/js'
|
|
import tseslint from 'typescript-eslint'
|
|
import reactHooks from 'eslint-plugin-react-hooks'
|
|
import prettier from 'eslint-config-prettier'
|
|
import globals from 'globals'
|
|
|
|
export default tseslint.config(
|
|
{ ignores: ['out/**', 'dist/**', 'node_modules/**', 'coverage/**', 'design_handoff_helder_workbench/**'] },
|
|
js.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
files: ['src/renderer/**/*.{ts,tsx}'],
|
|
languageOptions: { globals: { ...globals.browser } },
|
|
plugins: { 'react-hooks': reactHooks },
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
// These newer rules fire on the canonical "load async then setState in a
|
|
// mount effect" / "read a stable bridge in an effect" patterns we use
|
|
// deliberately. Keep the useful exhaustive-deps warnings; drop these.
|
|
'react-hooks/set-state-in-effect': 'off',
|
|
'react-hooks/refs': 'off',
|
|
},
|
|
},
|
|
{
|
|
files: ['src/main/**/*.ts', 'src/preload/**/*.ts', 'electron.vite.config.ts', 'vitest.config.ts', 'eslint.config.js'],
|
|
languageOptions: { globals: { ...globals.node } },
|
|
},
|
|
{
|
|
files: ['test/**/*.{ts,tsx}'],
|
|
languageOptions: { globals: { ...globals.node, ...globals.browser } },
|
|
},
|
|
{
|
|
// electron-builder hooks: plain CommonJS, run by node outside the app.
|
|
files: ['build/**/*.cjs'],
|
|
languageOptions: { globals: { ...globals.node }, sourceType: 'commonjs' },
|
|
rules: { '@typescript-eslint/no-require-imports': 'off' },
|
|
},
|
|
{
|
|
rules: {
|
|
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
},
|
|
},
|
|
prettier,
|
|
)
|