Skip to content

Commit 5e8cba4

Browse files
authored
ESLint 9 (#489)
* upgrades eslint to v9, with plugins * make eslint work and builds * small adjustments to fix tests and such * mmmmmm... js
1 parent fd438ba commit 5e8cba4

11 files changed

+630
-486
lines changed

.eslintignore

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

.eslintrc.js

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

eslint.config.mjs

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import eslint from "@eslint/js";
2+
import eslintConfigGoogle from "eslint-config-google";
3+
import eslintConfigPrettier from "eslint-config-prettier";
4+
import eslintConfigJSDoc from "eslint-plugin-jsdoc";
5+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
6+
import tseslint from "typescript-eslint";
7+
import globals from "globals";
8+
9+
export default [
10+
eslint.configs.recommended,
11+
...tseslint.configs.recommendedTypeChecked,
12+
...tseslint.configs.stylisticTypeChecked,
13+
eslintConfigJSDoc.configs["flat/recommended"],
14+
eslintConfigGoogle,
15+
eslintConfigPrettier,
16+
eslintPluginPrettierRecommended,
17+
{
18+
ignores: ["eslint.config.mjs", "lib/**/*", "coverage/**/*"],
19+
},
20+
{
21+
rules: {
22+
"jsdoc/newline-after-description": "off",
23+
"jsdoc/require-jsdoc": ["warn", { publicOnly: true }],
24+
"jsdoc/require-param-type": "off",
25+
"jsdoc/require-returns-type": "off",
26+
27+
"@typescript-eslint/no-require-imports": "warn", // TODO(bkendall): remove allow to error.
28+
"@typescript-eslint/no-unused-expressions": "warn", // TODO(bkendall): remove allow to error.
29+
"@typescript-eslint/no-unused-vars": "warn", // TODO(bkendall): remove allow to error.
30+
"@typescript-eslint/prefer-includes": "warn", // TODO(bkendall): remove allow to error.
31+
"@typescript-eslint/prefer-optional-chain": "warn", // TODO(bkendall): remove allow to error.
32+
"@typescript-eslint/prefer-promise-reject-errors": "warn", // TODO(bkendall): remove allow to error.
33+
34+
"no-unused-vars": "off", // Turned off in favor of @typescript-eslint/no-unused-vars.
35+
"require-atomic-updates": "off", // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899
36+
"require-jsdoc": "off", // This rule is deprecated and superseded by jsdoc/require-jsdoc.
37+
"valid-jsdoc": "off", // This is deprecated but included in recommended configs.
38+
},
39+
languageOptions: {
40+
ecmaVersion: 2020,
41+
globals: {
42+
...globals.node,
43+
...globals.mocha,
44+
},
45+
parserOptions: {
46+
ecmaVersion: "es2020",
47+
projectService: {
48+
project: "./tsconfig.json",
49+
allowDefaultProject: ["eslint.config.js"],
50+
},
51+
tsconfigRootDir: import.meta.dirname,
52+
},
53+
},
54+
},
55+
{
56+
files: ["**/*.ts"],
57+
rules: {
58+
"@typescript-eslint/no-explicit-any": "warn", // TODO(bkendall): remove allow to error.
59+
"@typescript-eslint/no-unsafe-argument": "warn", // TODO(bkendall): remove allow to error.
60+
"@typescript-eslint/no-unsafe-assignment": "warn", // TODO(bkendall): remove allow to error.
61+
"@typescript-eslint/no-unsafe-call": "warn", // TODO(bkendall): remove allow to error.
62+
"@typescript-eslint/no-unsafe-member-access": "warn", // TODO(bkendall): remove allow to error.
63+
},
64+
},
65+
{
66+
files: ["**/*.js"],
67+
rules: {
68+
"@typescript-eslint/no-this-alias": "warn", // TODO(bkendall): remove allow to error.
69+
"@typescript-eslint/no-unsafe-argument": "warn", // TODO(bkendall): remove allow to error.
70+
"@typescript-eslint/no-unsafe-assignment": "warn", // TODO(bkendall): remove allow to error.
71+
"@typescript-eslint/no-unsafe-call": "warn", // TODO(bkendall): remove allow to error.
72+
"@typescript-eslint/no-unsafe-member-access": "warn", // TODO(bkendall): remove allow to error.
73+
"@typescript-eslint/no-unsafe-return": "warn", // TODO(bkendall): remove allow to error.
74+
"@typescript-eslint/no-var-requires": "warn", // TODO(bkendall): remove allow to error.
75+
"@typescript-eslint/unbound-method": "warn", // TODO(bkendall): remove allow to error.
76+
},
77+
},
78+
];

0 commit comments

Comments
 (0)