-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
chore: migrate linting to Oxlint #8057
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
Open
Sheraff
wants to merge
1
commit into
main
Choose a base branch
from
chore/migrate-to-oxlint
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,210 @@ | ||
| { | ||
| "$schema": "./node_modules/oxlint/configuration_schema.json", | ||
| "categories": { | ||
| "correctness": "off" | ||
| }, | ||
| "plugins": ["eslint", "typescript", "import", "unicorn", "react"], | ||
| "env": { | ||
| "browser": true, | ||
| "builtin": true, | ||
| "es2020": true | ||
| }, | ||
| "ignorePatterns": [ | ||
| "**/.nx/**", | ||
| "**/.svelte-kit/**", | ||
| "**/build/**", | ||
| "**/coverage/**", | ||
| "**/dist/**", | ||
| "**/snap/**", | ||
| "**/vite.config.*.timestamp-*.*", | ||
| "packages/{react-router,solid-router,vue-router,vue-start}/bin/**" | ||
| ], | ||
| "options": { | ||
| "typeAware": true, | ||
| "respectEslintDisableDirectives": true | ||
| }, | ||
| "rules": { | ||
| "for-direction": "error", | ||
| "no-async-promise-executor": "error", | ||
| "no-case-declarations": "error", | ||
| "no-class-assign": "error", | ||
| "no-compare-neg-zero": "error", | ||
| "no-cond-assign": "error", | ||
| "no-constant-binary-expression": "error", | ||
| "no-constant-condition": "error", | ||
| "no-control-regex": "error", | ||
| "no-debugger": "error", | ||
| "no-delete-var": "error", | ||
| "no-dupe-else-if": "error", | ||
| "no-duplicate-case": "error", | ||
| "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-regex-spaces": "error", | ||
| "no-self-assign": "error", | ||
| "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-unused-vars": [ | ||
| "warn", | ||
| { | ||
| "vars": "all", | ||
| "varsIgnorePattern": "^_", | ||
| "args": "after-used", | ||
| "argsIgnorePattern": "^_", | ||
| "caughtErrors": "all", | ||
| "caughtErrorsIgnorePattern": "^_", | ||
| "reportVarsOnlyUsedAsTypes": true, | ||
| "fix": { | ||
| "imports": "safe-fix", | ||
| "variables": "off" | ||
| } | ||
| } | ||
| ], | ||
| "no-useless-backreference": "error", | ||
| "no-useless-catch": "error", | ||
| "no-useless-escape": "error", | ||
| "no-var": "error", | ||
| "no-with": "error", | ||
| "prefer-const": "error", | ||
| "require-yield": "error", | ||
| "sort-imports": ["error", { "ignoreDeclarationSort": true }], | ||
| "use-isnan": "error", | ||
| "valid-typeof": "error", | ||
| "import/consistent-type-specifier-style": ["error", "prefer-top-level"], | ||
| "import/first": "error", | ||
| "import/newline-after-import": "error", | ||
| "import/no-commonjs": "error", | ||
| "import/no-duplicates": "error", | ||
| "typescript/array-type": [ | ||
| "error", | ||
| { "default": "generic", "readonly": "generic" } | ||
| ], | ||
| "typescript/ban-ts-comment": [ | ||
| "error", | ||
| { "ts-expect-error": false, "ts-ignore": "allow-with-description" } | ||
| ], | ||
| "typescript/consistent-type-imports": [ | ||
| "error", | ||
| { "prefer": "type-imports" } | ||
| ], | ||
| "typescript/method-signature-style": ["error", "property"], | ||
| "typescript/no-duplicate-enum-values": "error", | ||
| "typescript/no-extra-non-null-assertion": "error", | ||
| "typescript/no-for-in-array": "error", | ||
| "typescript/no-inferrable-types": ["error", { "ignoreParameters": true }], | ||
| "typescript/no-misused-new": "error", | ||
| "typescript/no-namespace": "error", | ||
| "typescript/no-non-null-asserted-optional-chain": "error", | ||
| "typescript/no-unnecessary-condition": "error", | ||
| "typescript/no-unnecessary-type-assertion": "error", | ||
| "typescript/no-wrapper-object-types": "error", | ||
| "typescript/prefer-as-const": "error", | ||
| "typescript/prefer-for-of": "warn", | ||
| "typescript/require-await": "warn", | ||
| "typescript/triple-slash-reference": "error", | ||
| "unicorn/prefer-node-protocol": "error" | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": [ | ||
| "packages/{react-router-devtools,react-router-ssr-query,react-start,react-start-client,react-start-rsc,react-start-server,router-devtools,solid-start}/**/*.{ts,tsx}" | ||
| ], | ||
| "rules": { | ||
| "react/forward-ref-uses-ref": "warn", | ||
| "react/jsx-key": "error", | ||
| "react/jsx-no-comment-textnodes": "warn", | ||
| "react/jsx-no-duplicate-props": "warn", | ||
| "react/no-array-index-key": "warn", | ||
| "react/no-clone-element": "warn", | ||
| "react/no-danger": "warn", | ||
| "react/no-danger-with-children": "error", | ||
| "react/no-did-mount-set-state": "warn", | ||
| "react/no-did-update-set-state": "warn", | ||
| "react/no-direct-mutation-state": "error", | ||
| "react/no-find-dom-node": "error", | ||
| "react/no-namespace": "error", | ||
| "react/no-redundant-should-component-update": "error", | ||
| "react/no-render-return-value": "error", | ||
| "react/no-string-refs": "error", | ||
| "react/no-unstable-nested-components": "error", | ||
| "react/no-will-update-set-state": "warn", | ||
| "react/void-dom-elements-no-children": "warn", | ||
| "react/iframe-missing-sandbox": "warn", | ||
| "react/jsx-no-script-url": "warn", | ||
| "react/jsx-no-target-blank": "warn" | ||
| } | ||
| }, | ||
| { | ||
| "files": [ | ||
| "packages/{react-router,react-router-devtools,react-router-ssr-query,react-start,react-start-client,react-start-rsc,react-start-server,router-devtools,solid-start}/**/*.{js,ts,tsx}" | ||
| ], | ||
| "rules": { | ||
| "react/exhaustive-deps": "error", | ||
| "react/rules-of-hooks": "error" | ||
| } | ||
| }, | ||
| { | ||
| "files": [ | ||
| "packages/react-router/src/fileRoute.ts", | ||
| "packages/react-router/src/route.tsx" | ||
| ], | ||
| "rules": { | ||
| "react/rules-of-hooks": "off", | ||
| "typescript/no-unnecessary-type-assertion": "off" | ||
| } | ||
| }, | ||
| { | ||
| "files": [ | ||
| "packages/{eslint-plugin-start,react-router,react-start-rsc,router-core,router-plugin,router-utils,solid-router,solid-start-client,start-plugin-core,vue-router,vue-router-devtools}/**/*" | ||
| ], | ||
| "rules": { | ||
| "typescript/no-unnecessary-type-assertion": "off" | ||
| } | ||
| }, | ||
| { | ||
| "files": ["packages/router-utils/src/ast.ts"], | ||
| "rules": { | ||
| "import/no-duplicates": "off" | ||
| } | ||
| }, | ||
| { | ||
| "files": [ | ||
| "packages/{react-router-devtools,react-router-ssr-query,react-start,react-start-client,react-start-rsc,react-start-server,router-devtools,router-devtools-core,solid-router-devtools,solid-start,solid-start-client,solid-start-server,start-client-core,start-server-core,start-static-server-functions,start-storage-context,vue-router-devtools}/**/__tests__/**", | ||
| "packages/{router-core,router-ssr-query-core,solid-router,vue-router,vue-router-ssr-query,vue-start,vue-start-client,vue-start-server}/{src,tests}/**/*.{ts,tsx}", | ||
| "packages/react-router/**/*" | ||
| ], | ||
| "rules": { | ||
| "typescript/no-unnecessary-condition": "off" | ||
| } | ||
| }, | ||
| { | ||
| "files": ["packages/react-start-rsc/src/**/*.{ts,tsx}"], | ||
| "rules": { | ||
| "no-restricted-imports": [ | ||
| "error", | ||
| { | ||
| "paths": [ | ||
| { | ||
| "name": "@tanstack/start-server-core", | ||
| "message": "Import from a dedicated @tanstack/start-server-core subpath to avoid pulling the full server barrel into the RSC module graph." | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
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 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
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 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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: TanStack/router
Length of output: 21764
🌐 Web query:
Oxlint curly rule support configuration schema💡 Result:
In Oxlint, the curly rule is configured using an array format that accepts up to two elements, mirroring the traditional ESLint configuration style [1][2]. It does not support a single configuration object with named properties [3]. The configuration schema for the curly rule is as follows: 1. The first element (required) is the enforcement type, which must be one of: "all", "multi", "multi-line", or "multi-or-nest" [1][2]. 2. The second element (optional) accepts the string "consistent", which enforces consistent brace usage within if-else chains [1][2]. Example configurations in your.oxlintrc.json or oxlint.config.ts file: // Require braces for multi-statement blocks "rules": { "curly": ["error", "multi"] } // Require braces for multi-line blocks, with consistent usage in if-else chains "rules": { "curly": ["error", "multi-line", "consistent"] } Oxlint maintains its own rule implementations in Rust [4][5], and the curly rule's behavior and accepted configuration options are defined by the underlying native implementation, not by passing a configuration object [2][3]. If you encounter documentation or suggestions indicating that a configuration object (e.g., { "curlyType": "..." }) is supported, please note that this is incorrect and such configurations will not function as expected [3].
Citations:
🏁 Script executed:
Repository: TanStack/router
Length of output: 7918
🌐 Web query:
site:github.com/oxc-project/oxc "oxlint_v1.78.0" "curly"💡 Result:
In oxlint, the curly rule corresponds to the standard ESLint rule of the same name, which enforces consistent use of curly braces for control statements [1][2]. As of oxlint v1.78.0, the rule configuration follows the ESLint-style format, using strings as arguments rather than an object-based configuration [3][4][5]. The rule supports the following configuration options: "all" (default): Requires curly braces for all control statements [1]. "multi": Requires curly braces only when the control statement block contains multiple lines [1]. "multi-line": Requires curly braces if the statement is multiline or if the body spans multiple lines [1]. "multi-or-nest": Requires curly braces for control statements that are multiline or nested [1]. Additionally, the "consistent" option can be added as a separate string argument to ensure consistency across statements (e.g., ["error", "multi-or-nest", "consistent"]) [4][5]. While there was previous confusion in the documentation regarding whether "consistent" should be an object property or a string argument, the project has clarified that it is implemented as a string argument to match ESLint's behavior [3][6][4]. If you are working with JSX, oxlint also provides the react/jsx-curly-brace-presence rule, which manages the presence of curly braces for JSX props and children [7].
Citations:
curlyrule oxc-project/oxc#8123Enable the required
curlyrule.Oxlint
1.78.0supports this rule. Add"curly": ["error", "all"]to enforce braces for all control statements.🤖 Prompt for AI Agents
Source: Coding guidelines