forked from goauthentik/authentik
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web: update to ESLint 9 (goauthentik#10812)
* web: update to ESLint 9 ESLint 9 has been out for awhile now, and all of the plug-ins that we use have caught up, so it is time to bite the bullet and upgrade. This commit: - upgrades to ESLint 9, and upgrades all associated plugins - Replaces the `.eslintrc` and `.eslintignore` files with the new, "flat" configuration file, "eslint.config.mjs". - Places the previous "precommit" and "nightmare" rules in `./scripts/eslint.precommit.mjs` and `./scripts/eslint.nightmare.mjs`, respectively - Replaces the scripted wrappers for eslint (`eslint`, `eslint-precommit`) with a single executable that takes the arguments `--precommit`, which applies a stricter set of rules, and `--nightmare`, which applies an even more terrifyingly strict set of rules. - Provides the scripted wrapper `./scripts/eslint.mjs` so that eslint can be run from `bun`, if one so chooses. - Fixes *all* of the lint `eslint.config.mjs` now finds, including removing all of the `eslint` styling rules and overrides because Eslint now proudly leaves that entirely up to Prettier. To shut Dependabot up about ESLint. * Added explanation for no-console removal. * web: did not need the old and unmaintained nightmare mode; it can be configured directly.
- Loading branch information
1 parent
322ae4c
commit 79c01ca
Showing
34 changed files
with
6,080 additions
and
5,498 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,80 @@ | ||
import eslint from "@eslint/js"; | ||
import tsparser from "@typescript-eslint/parser"; | ||
import litconf from "eslint-plugin-lit"; | ||
import wcconf from "eslint-plugin-wc"; | ||
import globals from "globals"; | ||
import tseslint from "typescript-eslint"; | ||
|
||
export default [ | ||
// You would not believe how much this change has frustrated users: ["if an ignores key is used | ||
// without any other keys in the configuration object, then the patterns act as global | ||
// ignores"](https://eslint.org/docs/latest/use/configure/ignore) | ||
{ | ||
ignores: [ | ||
"dist/", | ||
// don't ever lint node_modules | ||
"node_modules/", | ||
".storybook/*", | ||
// don't lint build output (make sure it's set to your correct build folder name) | ||
// don't lint nyc coverage output | ||
"coverage/", | ||
"src/locale-codes.ts", | ||
"storybook-static/", | ||
"src/locales/", | ||
], | ||
}, | ||
eslint.configs.recommended, | ||
wcconf.configs["flat/recommended"], | ||
litconf.configs["flat/recommended"], | ||
...tseslint.configs.recommended, | ||
{ | ||
languageOptions: { | ||
parser: tsparser, | ||
parserOptions: { | ||
ecmaVersion: 12, | ||
sourceType: "module", | ||
}, | ||
}, | ||
files: ["src/**"], | ||
rules: { | ||
"no-unused-vars": "off", | ||
"no-console": ["error", { allow: ["debug", "warn", "error"] }], | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
argsIgnorePattern: "^_", | ||
varsIgnorePattern: "^_", | ||
caughtErrorsIgnorePattern: "^_", | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
languageOptions: { | ||
parser: tsparser, | ||
parserOptions: { | ||
ecmaVersion: 12, | ||
sourceType: "module", | ||
}, | ||
globals: { | ||
...globals.nodeBuiltin, | ||
}, | ||
}, | ||
files: ["scripts/*.mjs", "*.ts", "*.mjs"], | ||
rules: { | ||
"no-unused-vars": "off", | ||
// We WANT our scripts to output to the console! | ||
"no-console": "off", | ||
"@typescript-eslint/ban-ts-comment": "off", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ | ||
argsIgnorePattern: "^_", | ||
varsIgnorePattern: "^_", | ||
caughtErrorsIgnorePattern: "^_", | ||
}, | ||
], | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.