80 lines
2.0 KiB
JavaScript
80 lines
2.0 KiB
JavaScript
// @ts-check
|
|
|
|
import eslint from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import react from 'eslint-plugin-react';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import globals from 'globals';
|
|
|
|
export default tseslint.config(
|
|
eslint.configs.recommended,
|
|
...tseslint.configs.recommended,
|
|
{
|
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node
|
|
}
|
|
},
|
|
plugins: {
|
|
react: react,
|
|
'react-hooks': reactHooks
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: 'detect'
|
|
}
|
|
},
|
|
rules: {
|
|
// TypeScript
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' }],
|
|
'@typescript-eslint/no-empty-object-type': 'off',
|
|
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
|
|
// React
|
|
...react.configs.recommended.rules,
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react/prop-types': 'off',
|
|
'react/display-name': 'off',
|
|
'react/no-unescaped-entities': 'off',
|
|
|
|
// React Hooks - only classic rules, no compiler rules
|
|
'react-hooks/rules-of-hooks': 'error',
|
|
'react-hooks/exhaustive-deps': 'warn',
|
|
|
|
// General
|
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
'prefer-const': 'warn',
|
|
'no-unused-expressions': 'warn',
|
|
'@typescript-eslint/no-require-imports': 'warn'
|
|
}
|
|
},
|
|
{
|
|
files: ['src/main/**/*.ts'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node
|
|
}
|
|
},
|
|
rules: {
|
|
'@typescript-eslint/no-require-imports': 'off'
|
|
}
|
|
},
|
|
{
|
|
files: ['src/preload/**/*.ts'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
...globals.node
|
|
}
|
|
}
|
|
},
|
|
{
|
|
ignores: ['out/**', 'dist/**', '.eslintrc.cjs', 'eslint.config.mjs', 'node_modules/**']
|
|
}
|
|
);
|