73 lines
2.3 KiB
JavaScript
73 lines
2.3 KiB
JavaScript
import js from '@eslint/js';
|
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
import globals from 'globals';
|
|
import tseslint from 'typescript-eslint';
|
|
|
|
export default tseslint.config(
|
|
{ ignores: ['dist', 'src-tauri', 'e2e-native', 'e2e'] },
|
|
{
|
|
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
files: ['**/*.{ts,tsx}'],
|
|
languageOptions: {
|
|
ecmaVersion: 2020,
|
|
globals: globals.browser,
|
|
parserOptions: {
|
|
project: ['./tsconfig.app.json', './tsconfig.node.json'],
|
|
},
|
|
},
|
|
plugins: {
|
|
'react-hooks': reactHooks,
|
|
'react-refresh': reactRefresh,
|
|
},
|
|
rules: {
|
|
...reactHooks.configs.recommended.rules,
|
|
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
|
|
|
|
// Strict type safety rules
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
|
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
|
'@typescript-eslint/no-unsafe-call': 'warn',
|
|
'@typescript-eslint/no-unsafe-return': 'warn',
|
|
'@typescript-eslint/no-unsafe-argument': 'warn',
|
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
|
|
// Prevent type ignores and assertions
|
|
'@typescript-eslint/ban-ts-comment': [
|
|
'error',
|
|
{
|
|
'ts-expect-error': 'allow-with-description',
|
|
'ts-ignore': true,
|
|
'ts-nocheck': true,
|
|
'ts-check': false,
|
|
minimumDescriptionLength: 10,
|
|
},
|
|
],
|
|
'@typescript-eslint/consistent-type-assertions': [
|
|
'error',
|
|
{
|
|
assertionStyle: 'as',
|
|
objectLiteralTypeAssertions: 'never',
|
|
},
|
|
],
|
|
|
|
// Null safety
|
|
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
|
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
|
|
// Unused vars - allow underscore prefix for intentionally unused
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'warn',
|
|
{
|
|
argsIgnorePattern: '^_',
|
|
varsIgnorePattern: '^_',
|
|
caughtErrorsIgnorePattern: '^_',
|
|
},
|
|
],
|
|
},
|
|
}
|
|
);
|