Repository navigation
ci: Migrate from eslint to oxlint #3731
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
2 commits
Select commit
Hold shift + click to select a range
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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Only here so that oxlint run from the repo root (editors, lint-staged) | ||
| // accepts the options below, which oxlint reads from the top-level config | ||
| // only. Packages get their rules, and the same options, from their own | ||
| // .oxlintrc.json via oxlint/base.jsonc. Files outside a package are not linted. | ||
| { | ||
| "$schema": "./node_modules/oxlint/configuration_schema.json", | ||
| "options": { "typeAware": true, "reportUnusedDisableDirectives": "warn" }, | ||
| "plugins": [], | ||
| "categories": { | ||
| "correctness": "off", | ||
| "suspicious": "off", | ||
| "pedantic": "off", | ||
| "perf": "off", | ||
| "style": "off", | ||
| "restriction": "off", | ||
| "nursery": "off" | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ COPY .yarnrc.yml yarn.lock package.json nx.json .prettierrc .prettierignore ./ts | |
| # full source is copied in the build stages that need it. | ||
| COPY ./packages/common-utils/package.json ./packages/common-utils/package.json | ||
| COPY ./packages/api/jest.config.js ./packages/api/tsconfig.json ./packages/api/tsconfig.build.json ./packages/api/package.json ./packages/api/ | ||
| COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.build.json ./packages/app/package.json ./packages/app/next.config.mjs ./packages/app/mdx.d.ts ./packages/app/css.d.ts ./packages/app/eslint.config.mjs ./packages/app/ | ||
| COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.build.json ./packages/app/package.json ./packages/app/next.config.mjs ./packages/app/mdx.d.ts ./packages/app/css.d.ts ./packages/app/ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eslint didn't need to be in the Docker image anyway |
||
|
|
||
| # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
| RUN apk add --no-cache libc6-compat | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| // Rules every package shares. Mirrors what ESLint got from | ||
| // `@eslint/js` recommended + `typescript-eslint` recommended (as applied to | ||
| // .ts/.tsx files, i.e. after typescript-eslint's `eslint-recommended` | ||
| // disables the checks tsc already does) minus the formatting rules | ||
| // `eslint-config-prettier` turned off, plus the overrides every package set. | ||
| // Packages extend this and add their own plugins and rules. | ||
| { | ||
| "$schema": "../node_modules/oxlint/configuration_schema.json", | ||
| // Start from nothing so the enabled set is exactly the list below. | ||
| // Also set in the repo-root .oxlintrc.json: oxlint reads options only from | ||
| // the top-level config, which is this file (via extends) when run from a | ||
| // package and the root one when run from the repo root. | ||
| "options": { "typeAware": true, "reportUnusedDisableDirectives": "warn" }, | ||
| "plugins": ["eslint", "typescript"], | ||
| "categories": { | ||
| "correctness": "off", | ||
| "suspicious": "off", | ||
| "pedantic": "off", | ||
| "perf": "off", | ||
| "style": "off", | ||
| "restriction": "off", | ||
| "nursery": "off", | ||
| }, | ||
| "rules": { | ||
| // @eslint/js recommended | ||
| "for-direction": "error", | ||
| "no-async-promise-executor": "error", | ||
| "no-case-declarations": "error", | ||
| "no-compare-neg-zero": "error", | ||
| "no-cond-assign": ["error", "except-parens"], | ||
| "no-constant-binary-expression": "error", | ||
| "no-constant-condition": ["error", { "checkLoops": "allExceptWhileTrue" }], | ||
| "no-control-regex": "error", | ||
| "no-debugger": "error", | ||
| "no-delete-var": "error", | ||
| "no-dupe-else-if": "error", | ||
| "no-duplicate-case": "error", | ||
| "no-empty": ["error", { "allowEmptyCatch": false }], | ||
| "no-empty-character-class": "error", | ||
| "no-empty-pattern": "error", | ||
| "no-empty-static-block": "error", | ||
| "no-ex-assign": "error", | ||
| "no-extra-boolean-cast": "error", | ||
| "no-fallthrough": "error", | ||
| "no-global-assign": "error", | ||
| "no-invalid-regexp": "error", | ||
| "no-irregular-whitespace": "error", | ||
| "no-loss-of-precision": "error", | ||
| "no-misleading-character-class": "error", | ||
| "no-nonoctal-decimal-escape": "error", | ||
| "no-prototype-builtins": "error", | ||
| "no-regex-spaces": "error", | ||
| "no-self-assign": ["error", { "props": true }], | ||
| "no-shadow-restricted-names": "error", | ||
| "no-sparse-arrays": "error", | ||
| "no-unsafe-finally": "error", | ||
| "no-unsafe-optional-chaining": "error", | ||
| "no-unused-labels": "error", | ||
| "no-unused-private-class-members": "error", | ||
| "no-useless-backreference": "error", | ||
| "no-useless-catch": "error", | ||
| "no-useless-escape": "error", | ||
| "require-yield": "error", | ||
| "use-isnan": "error", | ||
| "valid-typeof": "error", | ||
| // typescript-eslint eslint-recommended (turned on for .ts files) | ||
| "no-var": "error", | ||
| "prefer-const": ["error", { "destructuring": "any" }], | ||
| "prefer-rest-params": "error", | ||
| "prefer-spread": "error", | ||
| // typescript-eslint recommended | ||
| "typescript/ban-ts-comment": "error", | ||
| "no-array-constructor": "error", | ||
| "typescript/no-duplicate-enum-values": "error", | ||
| "typescript/no-empty-object-type": "error", | ||
| "typescript/no-extra-non-null-assertion": "error", | ||
| "typescript/no-misused-new": "error", | ||
| "typescript/no-namespace": "error", | ||
| "typescript/no-non-null-asserted-optional-chain": "error", | ||
| "typescript/no-require-imports": "error", | ||
| "typescript/no-this-alias": "error", | ||
| "typescript/no-unnecessary-type-constraint": "error", | ||
| "typescript/no-unsafe-declaration-merging": "error", | ||
| "typescript/no-unsafe-function-type": "error", | ||
| "no-unused-expressions": "error", | ||
| "typescript/no-wrapper-object-types": "error", | ||
| "typescript/prefer-as-const": "error", | ||
| "typescript/prefer-namespace-keyword": "error", | ||
| "typescript/triple-slash-reference": "error", | ||
| // Shared overrides | ||
| "no-unused-vars": [ | ||
| "error", | ||
| { | ||
| "argsIgnorePattern": "^_", | ||
| "varsIgnorePattern": "^_", | ||
| // typescript-eslint reports a value only referenced in `typeof`. | ||
| "reportVarsOnlyUsedAsTypes": true, | ||
| }, | ||
| ], | ||
| "no-restricted-imports": [ | ||
| "error", | ||
| { | ||
| "patterns": [ | ||
| { | ||
| "regex": "^\\.\\.(/|$)", | ||
| "message": "Use the @/ path alias instead of parent-relative imports (../).", | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| // typescript-eslint's `eslint-recommended` turns these off for TS files | ||
| // because tsc reports them, and turns no-var/prefer-* on. Plain JS files | ||
| // keep the @eslint/js defaults. | ||
| "files": ["**/*.{js,jsx,mjs,cjs}"], | ||
| "rules": { | ||
| "constructor-super": "error", | ||
| "getter-return": "error", | ||
| "no-class-assign": "error", | ||
| "no-const-assign": "error", | ||
| "no-dupe-class-members": "error", | ||
| "no-dupe-keys": "error", | ||
| "no-func-assign": "error", | ||
| "no-import-assign": "error", | ||
| "no-new-native-nonconstructor": "error", | ||
| "no-obj-calls": "error", | ||
| "no-redeclare": ["error", { "builtinGlobals": true }], | ||
| "no-setter-return": "error", | ||
| "no-this-before-super": "error", | ||
| "no-undef": "error", | ||
| "no-unreachable": "error", | ||
| "no-unsafe-negation": "error", | ||
| "no-with": "error", | ||
| "no-var": "off", | ||
| "prefer-const": "off", | ||
| "prefer-rest-params": "off", | ||
| "prefer-spread": "off", | ||
| }, | ||
| }, | ||
| ], | ||
| } |
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,8 @@ | ||
| /** | ||
| * eslint-plugin-react-hook-form still calls the ESLint 8 `context.getScope()`, | ||
| * which neither ESLint 9 nor oxlint provides. `fixupPluginRules` adds it back. | ||
| */ | ||
| import { fixupPluginRules } from '@eslint/compat'; | ||
| import reactHookForm from 'eslint-plugin-react-hook-form'; | ||
|
|
||
| export default fixupPluginRules(reactHookForm); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Invalid / deprecated options that were previously ignored now throw because we call prettier directly