Files
flyer-crawler.projectium.com/eslint.config.js
Torben Sorensen 6ab473f5f0
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 58s
huge linting fixes
2026-01-09 18:50:04 -08:00

70 lines
1.9 KiB
JavaScript

import globals from 'globals';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import pluginReactRefresh from 'eslint-plugin-react-refresh';
import eslintConfigPrettier from 'eslint-config-prettier';
export default tseslint.config(
{
// Global ignores
ignores: ['dist', '.gitea', 'node_modules', '*.cjs'],
},
{
// All files
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
plugins: {
react: pluginReact,
'react-hooks': pluginReactHooks,
'react-refresh': pluginReactRefresh,
},
languageOptions: {
globals: {
...globals.browser,
...globals.es2020,
},
},
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
},
},
// TypeScript files
...tseslint.configs.recommended,
// Allow underscore-prefixed variables to be unused (common convention for intentionally unused params)
{
files: ['**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
},
},
// Relaxed rules for test files and test setup - see ADR-021 for rationale
{
files: [
'**/*.test.ts',
'**/*.test.tsx',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/tests/setup/**/*.ts',
],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
},
},
// Relaxed rules for type definition files - 'any' is often necessary for third-party library types
{
files: ['**/*.d.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
// Prettier compatibility - must be last to override other formatting rules
eslintConfigPrettier,
);