Skip to content

Commit 88121f3

Browse files
committed
Update eslint to 9 and add jsdoc plugin
- Update eslint from 8 to 9. - Migrate the old config to the new eslint flat configs - Add eslint-plugin-jsdoc to check jsdoc validity and prevent false positives of "no-unused-vars" when importing a type only for jsdoc. - Fix all new errors and warnings - Fix "ComponentScope.test.tsx" that didn't check for React strict mode
1 parent 4389760 commit 88121f3

28 files changed

Lines changed: 852 additions & 595 deletions

.eslintrc.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { defineConfig } from "eslint/config";
2+
import tseslint from "typescript-eslint";
3+
import globals from "globals";
4+
import jsdoc from "eslint-plugin-jsdoc";
5+
6+
export default defineConfig(
7+
{
8+
// Global ignores - files/directories to ignore
9+
ignores: [
10+
"**/examples/**",
11+
"**/dist/**",
12+
"**/node_modules/**",
13+
"**/website/**",
14+
"**/coverage/**",
15+
],
16+
},
17+
// Apply recommended configs
18+
tseslint.configs.recommended,
19+
jsdoc.configs["flat/recommended"],
20+
jsdoc.configs["flat/recommended-typescript"],
21+
{
22+
// Configuration for all files
23+
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
24+
plugins: { jsdoc },
25+
languageOptions: {
26+
ecmaVersion: "latest",
27+
sourceType: "module",
28+
globals: {
29+
...globals.browser,
30+
...globals.node,
31+
},
32+
},
33+
rules: {
34+
// Disable overly strict JSDoc rules
35+
"jsdoc/require-jsdoc": "off",
36+
"jsdoc/require-param": "off",
37+
"jsdoc/require-returns": "off",
38+
"jsdoc/tag-lines": "off",
39+
// Checks that types in jsdoc comments are defined.
40+
"jsdoc/no-undefined-types": "error",
41+
// Add @typeParam tag support
42+
"jsdoc/check-tag-names": ["warn", { definedTags: ["typeParam"] }],
43+
// TypeScript unused vars - allow underscore prefix
44+
"@typescript-eslint/no-unused-vars": [
45+
"error",
46+
{
47+
argsIgnorePattern: "^_",
48+
varsIgnorePattern: "^_",
49+
caughtErrorsIgnorePattern: "^_",
50+
},
51+
],
52+
},
53+
},
54+
{
55+
// Configuration for test files
56+
files: ["src/**/*.test.{ts,tsx}", "src/**/testing/**/*.{ts,tsx}"],
57+
rules: {
58+
"@typescript-eslint/no-explicit-any": "off",
59+
"@typescript-eslint/no-non-null-assertion": "off",
60+
},
61+
},
62+
{
63+
// Configuration for benchmark files
64+
files: ["src/**/*.bench.{ts,tsx}"],
65+
rules: {
66+
"@typescript-eslint/no-unused-vars": "off",
67+
},
68+
},
69+
);

0 commit comments

Comments
 (0)