fix: eslint findings
Remove dead code and unused imports, drop useless assignments, and tune rules in eslint.config.js (underscore-prefixed unused names, intentional BOM/NBSP, React Compiler rules from eslint-plugin-react-hooks 7 as warnings).
This commit is contained in:
@@ -10,6 +10,35 @@ export default tseslint.config(
|
||||
js.configs.recommended,
|
||||
tseslint.configs.recommended,
|
||||
reactHooks.configs.flat.recommended,
|
||||
{
|
||||
rules: {
|
||||
// Leading underscore marks an intentionally unused binding (omitting a key via rest, unused
|
||||
// override parameters).
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_", ignoreRestSiblings: true },
|
||||
],
|
||||
// The BOM and NBSP are written literally on purpose in the CSV exporters and the text sanitiser.
|
||||
"no-irregular-whitespace": ["error", { skipStrings: true, skipTemplates: true, skipRegExps: true }],
|
||||
},
|
||||
},
|
||||
{
|
||||
// The React Compiler rules shipped in eslint-plugin-react-hooks 7 flag long-standing patterns
|
||||
// here (load data on mount, "latest value" refs written during render). They are legitimate
|
||||
// design feedback but not bugs, and rewriting them blind risks behaviour changes in an
|
||||
// effect-heavy app, so they stay visible as warnings until each site is reworked.
|
||||
files: ["src/**/*.{ts,tsx}"],
|
||||
rules: {
|
||||
"react-hooks/set-state-in-effect": "warn",
|
||||
"react-hooks/refs": "warn",
|
||||
"react-hooks/immutability": "warn",
|
||||
},
|
||||
},
|
||||
{
|
||||
// Test helper that reads react-pdf's untyped internal layout data.
|
||||
files: ["src/pdf/testing/**/*.ts"],
|
||||
rules: { "@typescript-eslint/no-explicit-any": "warn" },
|
||||
},
|
||||
{
|
||||
files: ["src/**/*.{ts,tsx}"],
|
||||
languageOptions: { globals: globals.browser },
|
||||
|
||||
Reference in New Issue
Block a user