clipwright/dashboard/eslint.config.js
juancarlos.cavero 08e0eca92d chore(dashboard): make npm run lint work again
eslint.config.js was written for ESLint 9's flat config but package.json
pinned ESLint 8 and the script still passed --ext, so lint had not run in
months. Upgrade to ESLint 9 with @eslint/js and globals, keep
eslint-plugin-react-hooks on v5 (v7 ships the React Compiler rules, which
flag 21 places that would be a refactor, not a lint fix), drop the unused
eslint-plugin-react, and tune the rules to the house style: ignored catch
bindings, constant exports next to components, node globals for the build
scripts, and the entry point exempt from fast-refresh checks.

The findings that remained were fixed at the source: two unused Icon
destructures, an unused footer argument, two dead state pairs, one
useCallback dependency memoised, and six run-once effects marked as such.
2026-08-25 19:24:46 +02:00

44 lines
1.4 KiB
JavaScript

import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import { defineConfig, globalIgnores } from 'eslint/config'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{js,jsx}'],
extends: [
js.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
rules: {
// `catch (e)` / `catch (_)` with the error deliberately ignored is the
// house style for best-effort localStorage and fetch calls.
'no-unused-vars': ['error', {
varsIgnorePattern: '^[A-Z_]', argsIgnorePattern: '^_', caughtErrors: 'none',
}],
// Contexts and modals export a hook or a constant next to the component.
'react-refresh/only-export-components': ['error', { allowConstantExport: true }],
},
},
{
// The entry point mounts a few one-off components; nothing here hot-reloads.
files: ['src/main.jsx'],
rules: { 'react-refresh/only-export-components': 'off' },
},
{
files: ['vite.config.js', 'vite-plugin-seo.js', 'seo/**/*.js'],
languageOptions: { globals: { ...globals.node } },
},
])