Skip to content

chore: migrate away from eslint to oxlint #1642

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 3 commits into from
Jun 22, 2025

Conversation

xuatz
Copy link
Collaborator

@xuatz xuatz commented Jun 20, 2025

Summary

closes #1614

  • migrate from eslint8 to eslint9 with eslint-configuration-migrator
  • migrate from eslint9 (flat config) to oxlint with oxlint-migrate
  • ran pnpm -r run lint and pnpm -r run format and make some necessary changes

Notes

Oh yeah, you should install the oxc extension if you want the lint error to show up in vs code

References

@xuatz xuatz changed the title deps: switch from eslint to oxlint chore: migrate away from eslint to oxlint Jun 20, 2025
@MohamedBassem
Copy link
Collaborator

@xuatz Yeah, this looks good to me, I think we can proceed with the rest of the packages. Did you have to turn off any rules btw? Or was this all spitted up by the config migration code?

@xuatz
Copy link
Collaborator Author

xuatz commented Jun 21, 2025

@xuatz Yeah, this looks good to me, I think we can proceed with the rest of the packages. Did you have to turn off any rules btw? Or was this all spitted up by the config migration code?

@MohamedBassem
actually the oxlint migration script reported and removed tons of unsupported rules. I saved them on a separate commit.

image

I was gonna write a little report about that, but i got lazy halfway through yesterday, and I've been taking break from it since lol. I'm still not sure what this means for karakeep, if we can give up not having these rules or, attempt to implement some of them by hand as custom oxlint rules 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@MohamedBassem while im here, another annoying thing is that, "reuseable"/extendable configs only supports plugins,rules and overrides for now.

it means that we need duplicate fields like, globals, and ignorePatterns on every subrepo's .oxlintrc.json. a little annoying, but i personally can accept it, but what do you think?

@MohamedBassem
Copy link
Collaborator

@xuatz Regarding the missing rules, it's fine, I'm not too attached to them. I'm fine dropping whatever they're currently not supporting. As for the subrepo problem, I'm ok with what you suggested as well.

@xuatz xuatz force-pushed the feat/switch-to-oxlint branch from ac07658 to aa4373e Compare June 22, 2025 10:30
"typecheck": "turbo --no-daemon typecheck"
},
"devDependencies": {
"@karakeep/prettier-config": "workspace:^0.1.0",
"@tanstack/eslint-plugin-query": "^5.20.1",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was removed without replacement 😭
@tanstack/eslint-plugin-query not supported yet

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's unfortunate, but the speed wins I assume are worth it.

package.json Outdated
Comment on lines 19 to 20
"lint": "turbo --no-daemon oxlint --continue --",
"lint:fix": "turbo --no-daemon oxlint --continue -- --fix",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not super sure if i'm doing it right with turbopack, not that familiar with it. let me know if something needs to be fixed/improved

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's fine to keep the rule name in turbo as lint and revert the change in this line

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

reverted 👍

"es2022": true,
"node": true
},
"globals": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Those to me seem like defaults? Do we need to actually list them here and in other files? I assume if we remove this section it'll just work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed them and there were no output changes 👍
applied the suggestion.

@@ -4,6 +4,7 @@ import { useTranslation } from "@/lib/i18n/server";
import { Paintbrush, Tags } from "lucide-react";

export default async function Cleanups() {
// oxlint-disable-next-line rules-of-hooks
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not clear to me how this is violating the rules of hooks?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah the code works, but oxlint seem to (maybe mistakenly) flag this as a violation of rules-of-hooks.

but I don't think we want to turn it off just because of this incident, hence I went with inline skip instead.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah I think the issue is that it's technically not a hook because this is a server component. It's fine, we can keep it for now.

package.json Outdated
Comment on lines 19 to 20
"lint": "turbo --no-daemon oxlint --continue --",
"lint:fix": "turbo --no-daemon oxlint --continue -- --fix",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's fine to keep the rule name in turbo as lint and revert the change in this line

"typecheck": "turbo --no-daemon typecheck"
},
"devDependencies": {
"@karakeep/prettier-config": "workspace:^0.1.0",
"@tanstack/eslint-plugin-query": "^5.20.1",
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's unfortunate, but the speed wins I assume are worth it.

@@ -11,8 +11,10 @@
"license": "MIT",
"scripts": {
"clean": "rm -rf .turbo node_modules",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint .",
"format": "prettier .",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the change of removing the gitignore here intended?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

without removing it, it seems to ignore the root .prettierignore.
i saw that most other "format" were a lot more simpler so i assumed this was an old pattern that can be updated.

if this was very intentional, i can revert this and see if there is any additional follow up required.

turbo.json Outdated
@@ -32,12 +32,9 @@
],
"outputLogs": "new-only"
},
"lint": {
"oxlint": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

As I mentioned above, I don't think you need to change this.

@xuatz xuatz marked this pull request as ready for review June 22, 2025 11:04
@MohamedBassem MohamedBassem merged commit d5e2973 into karakeep-app:main Jun 22, 2025
5 checks passed
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.

[Chore] Migrate away from eslint to oxlint or biome
2 participants