-
-
Notifications
You must be signed in to change notification settings - Fork 823
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
Conversation
|
@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 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 🤔 |
tooling/oxlint/oxlint-base.json
Outdated
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.
@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?
|
@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. |
ac07658 to
aa4373e
Compare
| "typecheck": "turbo --no-daemon typecheck" | ||
| }, | ||
| "devDependencies": { | ||
| "@karakeep/prettier-config": "workspace:^0.1.0", | ||
| "@tanstack/eslint-plugin-query": "^5.20.1", |
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.
This was removed without replacement 😭
@tanstack/eslint-plugin-query not supported yet
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.
It's unfortunate, but the speed wins I assume are worth it.
package.json
Outdated
| "lint": "turbo --no-daemon oxlint --continue --", | ||
| "lint:fix": "turbo --no-daemon oxlint --continue -- --fix", |
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.
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
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.
I think it's fine to keep the rule name in turbo as lint and revert the change in this line
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.
reverted 👍
| "es2022": true, | ||
| "node": true | ||
| }, | ||
| "globals": { |
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.
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?
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.
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 | |||
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.
It's not clear to me how this is violating the rules of hooks?
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.
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.
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.
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
| "lint": "turbo --no-daemon oxlint --continue --", | ||
| "lint:fix": "turbo --no-daemon oxlint --continue -- --fix", |
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.
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", |
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.
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 .", | |||
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.
Is the change of removing the gitignore here intended?
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.
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": { | |||
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.
As I mentioned above, I don't think you need to change this.
Summary
closes #1614
eslint-configuration-migratoroxlint-migratepnpm -r run lintandpnpm -r run formatand make some necessary changesNotes
Oh yeah, you should install the oxc extension if you want the lint error to show up in vs code
References