-
-
Notifications
You must be signed in to change notification settings - Fork 972
chore: biome v2.4 #8275
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
chore: biome v2.4 #8275
Changes from all commits
a04c8df
96e2888
e90b14f
1c59333
7f5bcf4
5901d79
1d25856
e0b3f62
4291ff3
4186b83
ce40337
a248e88
da85e3c
7207eff
4f7909d
e2e6e66
789b0e7
4460388
c6afa4a
50c3513
bc0e8b4
1538985
36d3764
54682aa
6c5f368
1a9334c
c61892d
8eb3f19
bf02ba6
ab88099
73f4f53
8aa5f5b
c4bbc7d
6ada22a
cf81b4d
36d4165
857d450
3fc8cc5
fe3d424
4d8f19d
4c7c06f
1dc8dc2
a9025d4
b36ff03
683f50d
adcce82
7733f90
46f33a7
3dfea16
ae8ac8e
d8f0309
01bccc8
e06e5d1
0f5a05b
a215408
fe2c642
c594a36
6340ce6
d0358b0
47a79f1
3c8ea6e
62dc6d7
cb112ce
883ea1d
375792e
4d9c676
fe81000
5701ead
0e8e623
730fb06
3d427b8
39e7fd9
1469968
361350e
fda74af
79b38aa
6bf1b09
bdd3b6e
7e48bd4
c409d2a
f953815
7e5e098
d11130b
0353fa0
b5dd9ce
38c3fd7
dc1f94e
821c417
839c160
1b37c60
0a147f1
63a4abe
426de98
1da1356
7e33fd5
b8c1cc8
5483570
c047e86
0e47f5a
66ef5ba
e014336
4804acf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Added e18e ESLint plugin as a recognized rule source. Six Biome rules now reference their e18e equivalents: `useAtIndex`, `useExponentiationOperator`, `noPrototypeBuiltins`, `useDateNow`, `useSpread`, and `useObjectSpread`. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added `ignore` option to the [`useHookAtTopLevel`](https://biomejs.dev/linter/rules/use-hook-at-top-level/) rule. | ||
|
|
||
| You can now specify function names that should not be treated as hooks, even if they follow the `use*` naming convention. | ||
|
|
||
| Example configuration: | ||
|
|
||
| ```json | ||
| { | ||
| "linter": { | ||
| "rules": { | ||
| "correctness": { | ||
| "useHookAtTopLevel": { | ||
| "options": { | ||
| "ignore": ["useDebounce", "useCustomUtility"] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added the rule [`useAnchorContent`](https://biomejs.dev/linter/rules/use-anchor-content/) for HTML to enforce that anchor elements have accessible content for screen readers. The rule flags empty anchors, anchors with only whitespace, and anchors where all content is hidden with `aria-hidden`. Anchors with `aria-label` or `title` attributes providing a non-empty accessible name are considered valid. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added the rule [`useMediaCaption`](https://biomejs.dev/linter/rules/use-media-caption/) to the HTML language. Enforces that `audio` and `video` elements have a `track` element with `kind="captions"` for accessibility. Muted videos are allowed without captions. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added support for multiple reporters, and the ability to save reporters on arbitrary files. | ||
|
|
||
| #### Combine two reporters in CI | ||
|
|
||
| If you run Biome on GitHub, take advantage of the reporter and still see the errors in console, you can now use both reporters: | ||
|
|
||
| ```shell | ||
| biome ci --reporter=default --reporter=github | ||
| ``` | ||
|
|
||
| #### Save reporter output to a file | ||
|
|
||
| With the new `--reporter-file` CLI option, it's now possible to save the output of all reporters to a file. The file is a path, | ||
| so you can pass a relative or an absolute path: | ||
|
|
||
| ```shell | ||
| biome ci --reporter=rdjson --reporter-file=/etc/tmp/report.json | ||
| biome ci --reporter=summary --reporter-file=./reports/file.txt | ||
| ``` | ||
|
|
||
| You can combine these two features. For example, have the `default` reporter written on terminal, and the `rdjson` reporter written on file: | ||
|
|
||
| ```shell | ||
| biome ci --reporter=default --reporter=rdjson --reporter-file=/etc/tmp/report.json | ||
| ``` | ||
|
|
||
| **The `--reporter` and `--reporter-file` flags must appear next to each other, otherwise an error is thrown.** |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,7 @@ | ||||||||||||||
| --- | ||||||||||||||
| "@biomejs/biome": minor | ||||||||||||||
| --- | ||||||||||||||
|
Comment on lines
+1
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change type should be This changeset is marked 🔧 Suggested front matter update "@biomejs/biome": minor
+"@biomejs/biome": patch📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| The Biome CSS parser is now able to parse Vue SFC syntax such as `:slotted` and `:deep`. These pseudo functions are only correctly parsed when the CSS is defined inside `.vue` components. Otherwise, Biome will a emit a parse error. | ||||||||||||||
|
|
||||||||||||||
| This capability is only available when `experimentalFullHtmlSupportedEnabled` is set to `true`. | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added support for Cursor files. When Biome sees a Cursor JSON file, it will parse it with comments enabled and trailing commas enabled: | ||
| - `$PROJECT/.cursor/` | ||
| - `%APPDATA%\Cursor\User\` on Windows | ||
| - `~/Library/Application Support/Cursor/User/` on macOS | ||
| - `~/.config/Cursor/User/` on Linux |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
Comment on lines
+1
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a patch changeset on The front matter marks this as 🤖 Prompt for AI Agents |
||
|
|
||
| Added JSON as a target language for GritQL pattern matching. You can now write Grit plugins for JSON files. | ||
|
|
||
| This enables users to write GritQL patterns that match against JSON files, useful for: | ||
| - Searching and transforming JSON configuration files | ||
| - Enforcing patterns in `package.json` and other JSON configs | ||
| - Writing custom lint rules for JSON using GritQL | ||
|
|
||
| **Example patterns:** | ||
|
|
||
| Match all key-value pairs: | ||
| ```grit | ||
| language json | ||
|
|
||
| pair(key = $k, value = $v) | ||
| ``` | ||
|
|
||
| Match objects with specific structure: | ||
| ```grit | ||
| language json | ||
|
|
||
| JsonObjectValue() | ||
| ``` | ||
|
|
||
| Supports both native Biome AST names (`JsonMember`, `JsonObjectValue`) and TreeSitter-compatible names (`pair`, `object`, `array`) for compatibility with existing Grit patterns. | ||
|
|
||
| For more details, see the [GritQL documentation](https://biomejs.dev/reference/gritql/). | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added `ignore` option to [`noUnknownProperty`](https://biomejs.dev/linter/rules/no-unknown-property). If an unknown property name matches any of the items provided in `ignore`, a diagnostic won't be emitted. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Add a new reporter `--reporter=sarif`, that emits diagnostics using the [SARIF](https://sarifweb.azurewebsites.net/) format. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added the `useIframeTitle` lint rule for HTML. The rule enforces the usage of the `title` attribute for the `iframe` element. | ||
|
|
||
| Invalid: | ||
|
|
||
| ```html | ||
| <iframe></iframe> | ||
| <iframe title=""></iframe> | ||
| ``` | ||
|
|
||
| Valid: | ||
|
|
||
| ```html | ||
| <iframe title="title"></iframe> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added a new assist action `useSortedInterfaceMembers` that sorts TypeScript interface members, for readability. | ||
|
|
||
| It includes an autofix. | ||
|
|
||
| Invalid example. | ||
|
|
||
| ```ts,expect_diagnostic | ||
| interface MixedMembers { | ||
| z: string; | ||
| a: number; | ||
| (): void; | ||
| y: boolean; | ||
| } | ||
| ``` | ||
|
|
||
| Valid example (after using the assist). | ||
|
|
||
| ```ts | ||
| interface MixedMembers { | ||
| a: number; | ||
| y: boolean; | ||
| z: string; | ||
| (): void; | ||
| } | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| It's now possible to provide the stacktrace for a fatal error. The stacktrace is only available when the environment variable `RUST_BACKTRACE=1` is set, either via the CLI or exported `$PATH`. This is useful when providing detailed information for debugging purposes: | ||
|
|
||
| ```shell | ||
| RUST_BACKTRACE=1 biome lint | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| The Biome Language Server now reports progress while scanning files and dependencies in the project. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Added proper parsing and formatting for Svelte directives when the `html.experimentalFullSupportEnabled` is set to `true`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Revamped the logging options for all Biome commands. Now the commands `format`, `lint`, `check`, `ci`, `search`, `lsp-proxy` and `start` accept the following CLI options. | ||
|
|
||
| Some options might have been present before, but they were inconsistent. Plus, all new options have an environment variable as aliases. | ||
|
|
||
| #### `--log-file` | ||
|
|
||
| Optional path/file to redirect log messages to. This option is applicable only to the CLI. If omitted, logs are printed to stdout. | ||
|
|
||
| Environment variable alias: `BIOME_LOG_FILE` | ||
|
|
||
| #### `--log-prefix-name` | ||
|
|
||
| Allows changing the prefix applied to the file name of the logs. This option is applicable only to the daemon. | ||
|
|
||
| Environment variable alias: `BIOME_LOG_PREFIX_NAME` | ||
|
|
||
| #### `--log-path` | ||
|
|
||
| Allows changing the folder where logs are stored. This option is applicable only to the daemon. | ||
|
|
||
| Environment variable alias: `BIOME_LOG_PATH` | ||
|
|
||
| #### `--log-level` | ||
|
|
||
| The level of logging. In order, from the most verbose to the least verbose: `debug`, `info`, `warn`, `error` | ||
|
|
||
| The value `none` won't show any logging. | ||
|
|
||
| Environment variable alias: `BIOME_LOG_LEVEL` | ||
|
|
||
| #### `--log-kind` | ||
|
|
||
| What the log should look like. | ||
|
|
||
| Environment variable alias: `BIOME_LOG_KIND` | ||
|
|
||
| #### Reduce dumping of LSP logs | ||
|
|
||
| When you use a Biome editor extension, Biome's Daemon dumps its logs using the `debug` level. If you want to reduce | ||
| the quantity of these logs, you can now customize it: | ||
|
|
||
| ```shell | ||
| BIOME_LOG_LEVEL=info biome lsp-proxy | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Fixed [#8024](https://github.com/biomejs/biome/issues/8024). The rule [`useIterableCallbackReturn`](https://biomejs.dev/linter/rules/use-iterable-callback-return/) now supports a `checkForEach` option. When set to `false`, the rule will skip checking for `forEach()` callbacks for returning values. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added the rule [`useValidLang`](https://biomejs.dev/linter/rules/use-valid-lang) to the HTML language. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||
| --- | ||||||
| "@biomejs/biome": minor | ||||||
| --- | ||||||
|
|
||||||
| Added support for `jsxFactory` and `jsxFragmentFactory`.Biome now respects `jsxFactory` and `jsxFragmentFactory` settings from `tsconfig.json` when using the classic JSX runtime, preventing false positive [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports/) errors for custom JSX libraries like Preact. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix spacing in description text. Line 5 has a missing space after the closing backtick. Should be: -Added support for `jsxFactory` and `jsxFragmentFactory`.Biome now respects...
+Added support for `jsxFactory` and `jsxFragmentFactory`. Biome now respects...Otherwise, the changeset is well-structured with good examples and a helpful rule link. Nice work! ✓ 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| ```json5 | ||||||
| // tsconfig.json | ||||||
| { | ||||||
| "compilerOptions": { | ||||||
| "jsx": "react", | ||||||
| "jsxFactory": "h", | ||||||
| "jsxFragmentFactory": "Fragment" | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ```jsx | ||||||
| // Component.jsx | ||||||
| import { h, Fragment } from 'preact'; | ||||||
|
|
||||||
| function App() { | ||||||
| return <div>Hello</div>; | ||||||
| } | ||||||
| ``` | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added new CLI options to the commands `lsp-proxy` and `start` that allow to control the Biome file watcher. | ||
|
|
||
| #### `--watcher-kind` | ||
|
|
||
| Controls how the Biome file watcher should behave. By default, Biome chooses the best watcher strategy for the | ||
| current OS, however sometimes this could result in some issues, such as folders locked. | ||
|
|
||
| The option accepts the current values: | ||
| - `recommended`: the default option, which chooses the best watcher for the current platform. | ||
| - `polling`: uses the polling strategy. | ||
| - `none`: it doesn't enable the watcher. When the watcher is disabled, changes to files aren't recorded anymore by Biome. This might have | ||
| repercussions on some lint rules that might rely on updated types or updated paths. | ||
|
|
||
| The environment variable `BIOME_WATCHER_KIND` can be used as alias. | ||
|
|
||
| #### `--watcher-polling-interval` | ||
|
|
||
| The polling interval in milliseconds. This is only applicable when using the `polling` watcher. It defaults to `2000` milliseconds. | ||
|
|
||
| The environment variable `BIOME_WATCHER_POLLING_INTERVAL` can be used as alias. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Fixed [#901](https://github.com/biomejs/biome-vscode/issues/901). Biome now allows trailing commas in inside Zed `settings.json` and VSCode `settings.json`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| "@biomejs/biome": minor | ||
| --- | ||
|
|
||
| Added the `useHtmlLang` lint rule for HTML. The rule enforces that the `html` element has a `lang` attribute. | ||
|
|
||
| Invalid: | ||
|
|
||
| ```html | ||
| <html></html> | ||
| <html lang></html> | ||
| <html lang=""></html> | ||
| ``` | ||
|
|
||
| Valid: | ||
|
|
||
| ```html | ||
| <html lang="en"></html> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Fixed [#8628](https://github.com/biomejs/biome/issues/8628): [`useComponentExportOnlyModules`](https://biomejs.dev/linter/rules/use-component-export-only-modules/) now allows components referenced as object property values in exported expressions. This fixes false positives for TanStack Router patterns. | ||
|
|
||
| ```jsx | ||
| export const Route = createFileRoute('/')({ | ||
| component: HomeComponent, | ||
| }) | ||
|
|
||
| function HomeComponent() { ... } // no longer reported as "should be exported" | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Fixed [#9057](https://github.com/biomejs/biome/issues/9057): Incorrect diagnostic spans for suppression comments and other raw diagnostics in HTML-ish files (Vue, Svelte, Astro). Previously, diagnostics like "unused suppression" pointed to the wrong location in the document due to the diagnostic offset not being applied. |
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.
🛠️ Refactor suggestion | 🟠 Major
Add documentation links for the rules.
The six rules should include links to their documentation pages. As per coding guidelines, reference rules with links to the website documentation.
📚 Suggested improvement
📝 Committable suggestion
🤖 Prompt for AI Agents