Skip to content

Commit

Permalink
Switch from ESLint 8.x to 9.x
Browse files Browse the repository at this point in the history
With ESLint 8.x being deprecated next month, and with the automatic
migration tool not having changed its output much in the 3 months it's
been available, I think it's time to finish out this effort that I
started back in June (and rebased onto main with just a few fixups).

I'm still not convinced that I prefer the flat config to the original
config, but I think I've put it into a state I can be happy with.
  • Loading branch information
ahamlinman committed Sep 1, 2024
2 parents dd64597 + 5c8d0ca commit e376300
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 281 deletions.
43 changes: 0 additions & 43 deletions client/.eslintrc.cjs

This file was deleted.

65 changes: 65 additions & 0 deletions client/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// @ts-check

import path from "node:path";
import { fileURLToPath } from "node:url";

import confusingBrowserGlobals from "confusing-browser-globals";

import js from "@eslint/js";
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import { FlatCompat } from "@eslint/eslintrc";

import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import jsxA11Y from "eslint-plugin-jsx-a11y";
import tseslint from "typescript-eslint";

const compat = new FlatCompat({
baseDirectory: path.dirname(fileURLToPath(import.meta.url)),
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default tseslint.config(
{
ignores: ["dist/**/*"],
},

// @ts-ignore
...fixupConfigRules(
compat.extends(
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
),
),
{
plugins: {
// @ts-ignore
react: fixupPluginRules(react),
// @ts-ignore
"react-hooks": fixupPluginRules(reactHooks),
"jsx-a11y": fixupPluginRules(jsxA11Y),
},
settings: {
react: {
version: "detect",
},
},
rules: {
"no-restricted-globals": ["error", ...confusingBrowserGlobals],
},
},

...tseslint.configs.recommended.map((config) => ({
files: ["**/*.ts?(x)"],
...config,
})),
{
files: ["**/*.ts?(x)"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
},
},
);
8 changes: 5 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
"private": true,
"type": "module",
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.9.1",
"@types/node": "^22.1.0",
"@types/react": "^18.0.10",
"@types/react-dom": "^18.0.5",
"@types/react-helmet": "^6.1.0",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@vitejs/plugin-react": "^4.0.0",
"confusing-browser-globals": "^1.0.11",
"eslint": "^8.36.0",
"eslint": "^9.9.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand All @@ -23,6 +24,7 @@
"react-helmet": "^6.1.0",
"sass": "^1.30.0",
"typescript": "^5.0.2",
"typescript-eslint": "^8.3.0",
"vite": "^5.0.0"
},
"scripts": {
Expand Down
4 changes: 0 additions & 4 deletions client/src/WebRTC/Backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export type ConnectionState =

type Message = { SDP: any };

/* eslint-disable @typescript-eslint/adjacent-overload-signatures */
// I find it clearer and more maintainable to keep the signatures for a single
// event next to each other.

/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */
// TODO: I need to figure out what's up with this one.

Expand Down
Loading

0 comments on commit e376300

Please sign in to comment.