-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
5 changed files
with
227 additions
and
281 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}, | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.