-
-
Notifications
You must be signed in to change notification settings - Fork 579
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 basic ESLint config, lint script and lint CI job #1640
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
How about biome? |
Good question! To be honest, I didn't try Biome yet, but I've heard good things about it. I was simply sticking with ESLint as it's part of my default setup I use for all projects and as it's also used in other Astro repos. Personally, I'm open for adopting Biome if it provides an experience for contributors that is on par with ESLint and finds at least the same issues. |
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.
Did not have time yet to deep dive in the reported errors individually so it's mostly a general review of the approach and the config but I thought I would still share it to get the discussion started.
One last question, I see the "Unchanged files with check annotations" in GitHub:
- How does it work?
- Why is it only reporting so few errors?
Thank you for the great suggestions! I commented on all of them and applied most of them.
To my knowledge, this is a beta GitHub feature that's using an error matcher to automatically create annotations from the errors contained in the ESLint CLI output. I don't know why it's only reporting a subset of errors. Maybe the output is limited by default, or the error matcher doesn't recognize some of the ESLint output yet. I wanted to use a different approach with a JSON output file and a separate annotation step at first, but this doesn't work on PRs coming in from forks due to security reasons, so I had to remove this again and not GitHub only applies its default matching logic. |
I see, thanks for the explanation. I was wondering if you had something special in place for this or not.
I actually just did a test right now, I'm still amazed how crazy fast it is and how much easier the configuration is. By turning off only I think configuration and setup wise, we are pretty much close to the minimum of what we would need. What do you think could be a good next step Hippo? Maybe making a list of all errors reported and figuring out a smaller list of obvious rules we want enabled as they are very valuable? And later on discuss the remaining ones? |
Coincidentally I also just did an exploration into Biome! :) I was able to configure it in a way that reports the errors we were looking for. I created #1649 as an alternative to this PR so we can compare.
My preference would be to decide about the linter to use (ESLint vs Biome), and then go through the errors and actually fix them instead of turning off any further rules. :) In my experience this doesn't take long. Most fixes are straightforward, and there may just be a bit of discussion about how to fix cases in which we have multiple options that all seem to make sense. |
Ah maybe we are not exactly talking about the exact same error. For me, test("validates something", async () => {
expect(async () => await doSomething()).rejects.toThrowError(/invalid/);
}); The big difference for me between test("validates something", async () => {
await expect(async () => await doSomething1()).rejects.toThrowError(/invalid 1/);
expect(async () => await doSomething2()).rejects.toThrowError(/invalid 2/);
}); My test does contain an |
Good catch! Yeah, the We could just start with ESLint and maybe migrate to Biome once these were fixed? |
I think that's a good approach.
I personally did not have the time yet to review all the reported errors to make sure they all are real issues in their context as Chris mentioned, make sense for us and would not be too annoying on the long run so if you prefer fixing them all first and we can decide in a later review if we want to disable some rules because the changes are too annoying/not relevant, I'm fine with that 👍 |
I still did not get a chance to give this a thorough review but I'd like to point the following recent news:
Considering all this, we should consider if it may be wise to switch to the new format before landing this PR to avoid having to do it again later and having to introduce in this PR changes to use the now deprecated format (the CLI would need env vars to opt-out of the new format, the VSCode extension would need to be configured to use the old format, etc.) We may need to wait a bit for the VSCode ESLint extension to release its new major, in the meantime some plugins will release new versions with minor fixes for v9 unrelated changes, but except for that, this should be a pretty easy change (and something I can help if needed, done it already in a few projects including my shareable config that I use in all my projects). |
Just a small update to mention that I did not forget about this PR. I still have a local copy of this branch that I update regularly. All the tasks from my previous message are completed, all the remaining errors are fixed and the last remaning task is waiting for the next major version of |
Description
pnpm lint
from the repo root.