Skip to content
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

Add ESLint 9 to support oxlint #834

Merged
merged 15 commits into from
Feb 19, 2025
Merged

Add ESLint 9 to support oxlint #834

merged 15 commits into from
Feb 19, 2025

Conversation

uday-rana
Copy link
Member

@uday-rana uday-rana commented Feb 13, 2025

Fixes #803

Changes

  • Added ESLint 9, which is to be run after oxlint as a fallback for linting rules that aren't covered by oxlint. Rules that oxlint does cover won't be linted again by ESLint. This is the approach recommended by oxc:

    We recommend running oxlint before ESLint in your lint-staged or CI setup for a quicker feedback loop, considering it only takes a few seconds to run on large codebases.

  • Added two oxc plugins not enabled by default: jsx-a11y and import

  • Removed some settings from .oxlintrc.json that didn't do anything or were just re-defining the defaults.

  • Fixed lint errors detected after ESLint was added.

@uday-rana
Copy link
Member Author

uday-rana commented Feb 13, 2025

When saving a file, the VSCode ESLint extension removes eslint-disable comments for rules that are overridden by oxlint, making it impossible to disable rules for oxlint when using the ESLint extension. Need to find a fix.

@uday-rana
Copy link
Member Author

uday-rana commented Feb 14, 2025

When saving a file, the VSCode ESLint extension removes eslint-disable comments for rules that are overridden by oxlint, making it impossible to disable rules for oxlint when using the ESLint extension. Need to find a fix.

Set ESLint up to ignore unused disable directives.

@uday-rana uday-rana marked this pull request as ready for review February 14, 2025 00:14
@uday-rana uday-rana changed the title Configure oxlint to work together with ESLint Add ESLint 9 to support oxlint Feb 14, 2025
theoforger
theoforger previously approved these changes Feb 18, 2025
Copy link
Contributor

@theoforger theoforger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@uday-rana Great job 👍. Since ESLint 9 dropped support for .eslintignore file, I wonder if it's still possible to have a single source for ignored files?

@uday-rana
Copy link
Member Author

@uday-rana Great job 👍. Since ESLint 9 dropped support for .eslintignore file, I wonder if it's still possible to have a single source for ignored files?

We can import the ignore list from gitignore into eslint: https://eslint.org/docs/latest/use/configure/ignore#including-gitignore-files

@theoforger
Copy link
Contributor

@uday-rana There's also a command line option --ignore-path form oxlint. Although it's not available as an config file option, we can include it in the npm script. What do you think?

To avoid confusion maybe we can include a comment in .oxlintrc.json explaining this situation

@uday-rana
Copy link
Member Author

uday-rana commented Feb 18, 2025

@uday-rana There's also a command line option --ignore-path form oxlint. Although it's not available as an config file option, we can include it in the npm script. What do you think?

To avoid confusion maybe we can include a comment in .oxlintrc.json explaining this situation

That could lead to inconsistent behaviour if oxlint is run with npx vs through the npm script. If it's not supported in the config file we could just keep things simple for now. We also don't know if using --ignore-path to point to .gitignore will let us keep overrides in the config file for directories we want in Git but don't want to format.

@theoforger
Copy link
Contributor

@uday-rana Makes sense! Let's stick with what we have so far.

@uday-rana uday-rana merged commit c01d923 into main Feb 19, 2025
8 checks passed
@uday-rana uday-rana deleted the issue-803 branch February 19, 2025 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ESLint back
2 participants