-
Notifications
You must be signed in to change notification settings - Fork 155
chore: configure biome linter #616
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
Thanks for the PR! I'm not familiar w/ biome so I'll defer to @conico974 and @vicb |
I'll defer to @conico974 as he created the linked cleanup issue. I usually agree with "if it ain't broken don't fix it" - especially when it comes to JS "build" tooling. |
commit: |
I kind of agree with that, but biome is so fast and it's a single deps that i think it may be worth it. Unless there is a good reason to not merge this i think we should do it. I'll test that everything is working correctly tomorrow |
@maxmorozoff |
Around 40 seconds. You could consider enabling additional rules in Biome for a closer comparison. As a temporary solution, we could run ESLint after Biome. This would have minimal impact on performance while allowing for a more gradual adoption, as it may require more fixes across the codebase. |
On the other hand, TS update is blocked by the current eslint config:
Switching to biome could fix that so that we can update TS - which would allow some code simplification, as newer TS have improved type inference |
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.
There is some missing stuff here.
And we probably want to either switch to recommended: true
(and probably disable some rules that we don't need) or add more rules.
I don't think using eslint for other missing rule is a good idea, we either fully switch to biome or stick with eslint. There is no point in running multiple linters
biome.json
Outdated
"packages/open-next/src/minimize-js.ts" | ||
] | ||
}, | ||
"formatter": { "enabled": false }, |
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.
We do want to run the formatter, it was done by the prettier eslint plugin before
biome.json
Outdated
"**/pnpm-lock.yaml", | ||
"**/dist/**", | ||
"**/out/**", | ||
"packages/open-next/assets/sharp-node-modules", |
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 needed anymore
biome.json
Outdated
"**/dist/**", | ||
"**/out/**", | ||
"packages/open-next/assets/sharp-node-modules", | ||
"packages/open-next/src/minimize-js.ts" |
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.
Why did you add this file ?
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.
The minimize-js.ts
has an eslint-disable
comment. In Biome to ignore this file, it should be configured in biome.json
(docs)
Other paths could be removed.
biome.json
Outdated
] | ||
}, | ||
"formatter": { "enabled": false }, | ||
"organizeImports": { "enabled": false }, |
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.
We want that enabled as well
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.
Should we configure formatting in biome.json
or within a .editorconfig?
biome.json
Outdated
@@ -0,0 +1,57 @@ | |||
{ | |||
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json", | |||
"vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false }, |
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.
We want this to be enabled and use the ignore files, otherwise it will try to lint a lot of useless files
Biome summary:
After
Which rules would you like to keep? |
|
The current configuration lints the project with no errors but generates 2,091 warnings. Some rules have automated, safe fixes that could be applied to the codebase, while others have unsafe fixes. Steps involvedEnabled all rules{
"linter": {
"enabled": true,
"rules": {
"all": true
}
},
} Saved lint report to json and extracted rule names with a scriptEncountered some issues with the --reporter=json option, as it's experimental. I used yq as a workaround. // $ pnpm lint --diagnostic-level=error --reporter=junit | yq -p=xml -o=json > report.json
import report from "./report.json";
const errors = report.testsuites.testsuite.filter(
(testcase) =>
testcase["+@errors"] &&
testcase.testcase["+@name"].startsWith("org.biome.lint"),
);
const rulesSet = new Set(errors.map((testcase) => testcase.testcase["+@name"]));
const config = {};
rulesSet.forEach((rule) => {
const [, , , pkg, name] = rule.split(".");
config[pkg] = {
all: true,
...config[pkg],
[name]: "warn",
};
});
console.log(JSON.stringify(config, null, 2)); |
@maxmorozoff We don't want to enable all rule, that's for sure.
The rest is probably fine, and we can apply the safe one in this PR. |
a602b93
to
b36196d
Compare
@conico974, the default value for |
Disable them, examples only contains e2e, we don't care that much about having perfect app there
Good idea for both questions, go ahead |
- Added .git-blame-ignore-revs file to exclude commit b36196d from `git blame` to improve readability by ignoring non-functional bulk edits made by Biome formatter and linter.
@conico974, could you please review the latest commits and let me know if they look good to you? Any additional feedback is also welcome! Thank you! |
What do you think of adding I'm playing around w/ biome and it's really fast! |
My advice is that we should fix those warning (or disable them if we feel they're useless) just not in this PR, i just want to avoid a 300 files changed PR where it would be way too easy to miss something that might break something (especially with the eslint plugin we have that can replace code)
Yeah i've tested it a bit and it's so fast, it seems almost unreal 😆. There is a bunch of new javascript tooling around lately that are insane speed wise (like the oxc project) |
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 just have 2 question here, but if everything is fine we should merge this
As for what's need to be done next, we need to either ignore or fix the lint rule, in this order : suspicious, correctness, performance, complexity and lastly style.
When all of this is done we'll need to think if we want to add other rule
}, | ||
"style": { | ||
"noUnusedTemplateLiteral": "warn", | ||
"noInferrableTypes": "warn", // safe 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.
Did you apply these safe fixes ? If so no need to set them as warn, we want to avoid them as much as possible so an error is fine
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've only applied the fixes that were causing formatting or import order errors, which I forgot to mention. Now, running pnpm lint
exits with 0, while pnpm lint:fix
would apply additional linting fixes. It might be better to address these in the next PR, as they are more nuanced and might not be necessary if some rules are disabled.
great work on this PR! I read "like the oxc project" and I'm puzzled by how the JS world like to fuel the confusion... biome use to be rome and oxc is now void0 🤷 |
And biome use oxc under the hood and oxc also have a linter 🤯 |
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.
LGTM Thanks a lot for this
@conico974 Thank you! Would you like me to open the next PR to address the linting warnings, or do you plan to handle it later? Happy to help! |
@maxmorozoff i'd be happy if you open them yeah |
Maybe i spoke too soon, looks like @vicb is already taking care of a bunch of them |
Good job @maxmorozoff and everyone else on this PR |
This PR migrates project’s linting configuration from ESLint to Biome.
See: #538
Changes
Performance improvements:
With Biome, linting the project now takes only 45ms on my machine.
Known Issues
Not all ESLint rules have direct equivalents in Biome as noted in Biome's documentation.