-
Notifications
You must be signed in to change notification settings - Fork 100
web: upgrade ESLint to v9 with flat config #9250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
31ccb24
web/eslint: pin eslint 8.57.1
kevinortiz43 f63fa5a
web/eslint: migrate to flat config (eslint.config.mjs)
kevinortiz43 96edbed
web/eslint: upgrade eslint to 9.0.0
kevinortiz43 ce79871
web/eslint: upgrade eslint to latest 9.x
kevinortiz43 264fafc
Merge branch 'develop' into web/chore/eslint-9-flat-config
kevinortiz43 46e2ced
Merge branch 'develop' into web/chore/eslint-9-flat-config
nabramow f75cde1
Update package.json
kevinortiz43 3e321da
Merge branch 'develop' into web/chore/eslint-9-flat-config
nabramow 48c904b
@eslint/eslintrc to 3.3.6, up to date as of 5 days ago - https://www.…
kevinortiz43 c0987e3
Uploading the updated yarn.lock to match the updated eslintrc and esl…
kevinortiz43 dec6591
Switched reportUnusedDisableDirectives to on and see if there are any…
kevinortiz43 3e0367e
Switching reportUnusedDisableDirectives to "warn" to see what is show…
kevinortiz43 bde9593
Format frontend
couchersbot[bot] e7c8a21
Format frontend
couchersbot[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,102 @@ | ||
| import { FlatCompat } from "@eslint/eslintrc"; | ||
| import js from "@eslint/js"; | ||
| import tsParser from "@typescript-eslint/parser"; | ||
| import prettier from "eslint-config-prettier/flat"; | ||
| import jsonc from "eslint-plugin-jsonc"; | ||
| import simpleImportSort from "eslint-plugin-simple-import-sort"; | ||
| import unusedImports from "eslint-plugin-unused-imports"; | ||
|
|
||
| const compat = new FlatCompat({ | ||
| baseDirectory: import.meta.dirname, | ||
| recommendedConfig: js.configs.recommended, | ||
| allConfig: js.configs.all, | ||
| }); | ||
|
|
||
| const config = [ | ||
| { | ||
| ignores: [ | ||
| "node_modules/**", | ||
| ".next/**", | ||
| "out/**", | ||
| "build/**", | ||
| "coverage/**", | ||
| "package-lock.json", | ||
| "next-env.d.ts", | ||
| "proto/**", | ||
| ], | ||
| }, | ||
| // eslint 9 flipped this default to "warn"; | ||
| { | ||
| linterOptions: { reportUnusedDisableDirectives: "warn" }, | ||
| }, | ||
|
|
||
| // both legacy extends must go through the same FlatCompat instance so the | ||
| // @typescript-eslint plugin resolves to one module object ("Cannot redefine | ||
| // plugin" otherwise) | ||
|
|
||
| // Come back to this after we upgrade next.js https://github.com/Couchers-org/couchers/issues/9280 | ||
| ...compat.extends( | ||
| "plugin:@typescript-eslint/recommended", | ||
| "next/core-web-vitals", | ||
| ), | ||
|
kevinortiz43 marked this conversation as resolved.
|
||
| prettier, | ||
| { | ||
| plugins: { | ||
| "simple-import-sort": simpleImportSort, | ||
| "unused-imports": unusedImports, | ||
| }, | ||
| rules: { | ||
| // ~~~ settings for simple import sort plugin ~~~ | ||
| "simple-import-sort/imports": "warn", | ||
| "simple-import-sort/exports": "warn", | ||
| "sort-imports": "off", | ||
| "import/order": "off", | ||
| "import/first": "warn", | ||
| "import/newline-after-import": "warn", | ||
| "import/no-duplicates": "warn", | ||
|
|
||
| // ~~~ setings for unused imports plugin ~~~ | ||
| "unused-imports/no-unused-imports": "warn", | ||
|
|
||
| // ~~~ custom couchers settings ~~~ | ||
| //allow theme to be unused in makeStyles | ||
| "@typescript-eslint/no-unused-vars": "off", | ||
| "no-unused-vars": "off", | ||
| "unused-imports/no-unused-vars": [ | ||
| "warn", | ||
| { | ||
| argsIgnorePattern: "theme", | ||
| varsIgnorePattern: "classes|useStyles", | ||
| }, | ||
| ], | ||
| //good in theory, but ts isn't perfect and library types can be wrong | ||
| "@typescript-eslint/ban-ts-comment": "off", | ||
| //better avoided but useful for gRPC | ||
| "@typescript-eslint/no-non-null-assertion": "off", | ||
| //used in testing | ||
| "@typescript-eslint/no-empty-function": "off", | ||
| //not using this right now | ||
| "@next/next/no-img-element": "off", | ||
|
|
||
| "react/no-unescaped-entities": "off", | ||
| // Prefer inferred types so that the code is as close to JS as possible | ||
| "@typescript-eslint/explicit-module-boundary-types": "off", | ||
| }, | ||
| }, | ||
| { | ||
| files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], | ||
| languageOptions: { parser: tsParser }, | ||
| }, | ||
| // the jsonc preset is pinned to **/*.json: unpinned it would also grab | ||
| // .json5/.jsonc, and without files globs `eslint .` wouldn't lint json at all | ||
| ...jsonc.configs["flat/recommended-with-json"].map((config) => ({ | ||
| ...config, | ||
| files: ["**/*.json"], | ||
| })), | ||
| { | ||
| files: ["**/*.json"], | ||
| rules: { "jsonc/no-comments": "off" }, | ||
| }, | ||
| ]; | ||
|
|
||
| export default config; | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.