Zum Inhalt springen
verdict:

Biome 2.0.0

featured

note: die Zusammenfassung und die Release Notes sind auf Englisch

warning: Eingriff nötig

6 Breaking Changes5 Kernpunkte

Biome 2.0 has many breaking config and CLI changes, so run biome migrate and review the list before upgrading.

Zusammenfassung · nur aus den Release Notes · claude-haiku-5-5 · prompt v7

breaking changesalle zitiert, jeder mit einer Lösung

breaking[1]: The include and ignore fields in the configuration are removed and replaced by includes.

You can run biome migrate to convert include and ignore into includes automatically.

help: Run biome migrate to convert include and ignore into includes automatically.

breaking[2]: The CLI options --apply and --apply-unsafe are no longer accepted.

The CLI options --apply and --apply-unasfe aren't accepted anymore. Use --write and --write --unafe instead:

help: Use --write instead of --apply, and --write --unsafe instead of --apply-unsafe.

breaking[3]: The --config-path argument is removed from the biome lsp-proxy and biome start commands.

Removed the --config-path argument from the biome lsp-proxy and biome start commands.

help: Update your editor plugin to the latest version, and have plugins use the workspace/configuration response instead of the argument.

breaking[4]: Support for rome.json is removed.

Removed support for rome.json.

help: Use biome.json or biome.jsonc instead.

breaking[5]: Support for rome-ignore suppression comments is removed.

Removed support for rome-ignore suppression comments.

help: Use biome-ignore suppression comments instead.

breaking[6]: The noUndeclaredVariables rule no longer reports TypeScript types by default.

This option is now set to false by default.

help: Set the checkTypes option to true to get the previous behavior.

Kernpunkte

release-notesgithub.com/biomejs/biome · 2607 Zeilen
  1. ### Major Changes
  2. - Biome now resolves globs and paths from the configuration. Before, paths and globs were resolved from the working directory.
  3. - Biome now raises a **warning** diagnostic for suppression comments that have `<explanation>` as reason.
  4. `<explanation>` is provided as a placeholder when applying the suppression code fix from LSP editors.
  5. - Removed the `--config-path` argument from the `biome lsp-proxy` and `biome start` commands.
  6. The option was overriding the configuration path for all workspaces opened in the Biome daemon, which led to a configuration mismatch problem when multiple projects are opened in some editors or IDEs.
  7. If you are using one of our official plugins for IDEs or editors, it is recommended to update it to the latest version of the plugin, or you will get unexpected behavior.
  8. If you are a developer of a plugin, please update your plugin to use the `workspace/configuration` response instead of using the `--config-path` argument. Biome's LSP will resolve a configuration in the workspace automatically, so it is recommended to keep it empty unless you are using a custom configuration path.
  9. - Downgraded some code fixes to unsafe which were previously safe.
  10. The following rules have now a unsafe fix:
  11. - [`noFlatMapIdentity`](https://biomejs.dev/linter/rules/no-flat-map-identity)
  12. - [`noUnusedImports`](https://biomejs.dev/linter/rules/no-unused-imports)
  13. If you want to keep applying these fixes automatically, [configure the rule fix](https://next.biomejs.dev/linter/#configure-the-code-fix) as safe:
  14. ```json
  15. {
  16. "linter": {
  17. "rules": {
  18. "correctness": {
  19. "noFlatMapIdentity": {
  20. "level": "error",
  21. "fix": "safe"
  22. },
  23. "noUnusedImports": {
  24. "level": "error",
  25. "fix": "safe"
  26. }
  27. }
  28. }
  29. }
  30. }
  31. ```
  32. - Previously the lint rules `noControlCharactersInRegex` and `noMisleadingCharacterClass` checked both regular expression literals like `/regex/` and dynamically built regular expressions like `new RegExp("regex")`.
  33. Checking dynamically built regular expressions has many limitations, edge cases, and complexities.
  34. In addition, other rules that lint regular expressions don't check dynamically built regular expressions.
  35. Rather than add support for other rules and have half-baked checking, we decided to remove support for dynamically built regular expressions.
  36. Now the lint rules `noControlCharactersInRegex` and `noMisleadingCharacterClass` only check literals of regular expressions.
  37. - The lint rule [`noRestrictedGlobals`](https://biomejs.dev/linter/rules/no-restricted-globals/) now supports customizing message for each global name.
  38. For example, the following configuration:
  39. ```json
  40. {
  41. "options": {
  42. "deniedGlobals": {
  43. "$": "jQuery is not allowed. Use native DOM manipulation instead."
  44. }
  45. }
  46. }
  47. ```
  48. emits a diagnostic:
  49. ```
  50. index.js:1:13 lint/style/noRestrictedGlobals ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  51. ⚠ Do not use the global variable $.
  52. > 1 │ console.log($)
  53. │ ^
  54. 2 │
  55. ℹ jQuery is not allowed. Use native DOM manipulation instead.
  56. ```
  57. Breaking Change: The option `deniedGlobals` is now a record instead of an array. Run `biome migrate` to migrate the configuration automatically.
  58. - Removed `include` and `ignore` fields in favor of the new field `includes`.
  59. The Biome configuration file allows users to specify which files should be processed using [glob patterns](<https://en.wikipedia.org/wiki/Glob_(programming)>).
  60. Prior to Biome 2.0, this was done using the `include` and `ignore` fields.
  61. In Biome 2.0, `include` and `ignore` are removed and replaced by `includes`.
  62. You can run `biome migrate` to convert `include` and `ignore` into `includes` automatically.
  63. `includes` uses a different glob pattern format that fixes [many](https://github.com/biomejs/biome/issues/2421) [issues](https://github.com/biomejs/biome/issues/3345) and many other limitations that Biome users reported.
  64. `includes` accepts an array of glob patterns.
  65. A glob pattern starting with a `!` is a negated pattern also called exception.
  66. This replaces `ignore` patterns and allows users to create chains of include and ignore patterns.
  67. Thus, it is now possible to include again a file previously ignored.
  68. This was not possible with `include` and `ignore`, because `ignore` has priority over `include`.
  69. The semantics of `*` and `**/*` have changed too.
  70. Before, with `include` and `ignore`, the glob `*` was interpreted as `**/*`.
  71. Now, with `includes`, the globs `*` and `**/*` are interpreted differently.
  72. The first pattern matches all files that are inside a folder.
  73. The second pattern recursively matches all files **and sub-folders** inside a folder.
  74. Let's take an example.
  75. Given the following file hierarchy of a project...
  76. ```
  77. ├── biome.json
  78. ├── src
  79. │   ├── file.js
  80. │   ├── file.ts
  81. │   ├── out.gen.js
  82. │   ├── file.test.js
  83. │ └── test
  84. │ └── special.test.js
  85. └── test ...
  86. ```
  87. ...we want:
  88. 1. Ignore all files ending with `.test.js`, except `special.test.ts`.
  89. 2. Ignore all files of the `test` directory.
  90. The `test` directory is located at the root of the project.
  91. 3. Execute the linter on files in the `src` directory, that don't end with `.gen.js`.
  92. The `src` directory is located at the root of the project.
  93. 4. Enable the `noDefaultExport` lint rule on files ending with `.ts`.
  94. Prior to Biome 2.0, the configuration might look like:
  95. ```json
  96. {
  97. "files": {
  98. "ignore": ["*.test.js", "test"]
  99. },
  100. "linter": {
  101. "include": ["src/**"],
  102. "ignore": ["*.gen.js"],
  103. "enabled": true
  104. },
  105. "overrides": [
  106. {
  107. "include": ["*.ts"],
  108. "linter": { "rules": { "style": { "noDefaultExport": "on" } } }
  109. }
  110. ]
  111. }
  112. ```
  113. Unfortunately, the configuration doesn't quite fit what we want:
  114. 1. There is no way to ignore files and unignore one of them.
  115. Thus, we ignore all files ending with `.test.js`, including `special.test.ts`.
  116. 2. The configuration ignores all directories named `test`, including `src/test`.
  117. 3. The linter is executed on all files of all directories named `src`
  118. All these issues and limitations are fixed with `includes`.
  119. Here the migrated configuration:
  120. ```json
  121. {
  122. "files": {
  123. "includes": ["**", "!**/*.test.js", "**/special.test.ts", "!test"]
  124. },
  125. "linter": {
  126. "includes": ["src/**", "!**/*.gen.js"],
  127. "enabled": true
  128. },
  129. "overrides": [
  130. {
  131. "includes": ["**/*.ts"],
  132. "linter": { "rules": { "style": { "noDefaultExport": "on" } } }
  133. }
  134. ]
  135. }
  136. ```
  137. 1. All files named `special.test.ts` are unignored because the pattern appear after the pattern that ignore files ending with `.test.js`.
  138. 2. Only the `test` directory at the project's root is ignored because the pattern doesn't start with `**/`.
  139. 3. The linter is executed on the `src` directory at the project's root only.
  140. Because `includes` pattern have a different pattern format than `include` and `ignore` we made some adjustments:
  141. - We added the pattern `**` in `files.includes` to ensure that all files are included before ignoring some of them.
  142. - We added the prefix `**/` for patterns that must match at any level of the file hierarchy.
  143. - `noUndeclaredVariables` no longer reports TypeScript types.
  144. In TypeScript projects, developers often use global declaration files to declare global types.
  145. Biome is currently unable to detect these global types.
  146. This creates many false positives for `noUndeclaredVariables`.
  147. TypeScript is better suited to perform this kind of check.
  148. As proof of this, TypeScript ESLint doesn't provide any rule that extends the `no-undef` ESLint rule.
  149. This is why Biome 1.9 introduced a new option `checkTypes` which, when it is set to false, ignores undeclared type references.
  150. The option was set to `true` by default.
  151. This option is now set to `false` by default.
  152. To get the previous behavior, you have to set `checkTypes` to `true`:
  153. ```json
  154. {
  155. "linter": {
  156. "rules": {
  157. "correctness": {
  158. "noUndeclaredVariables": {
  159. "level": "on",
  160. "options": { "checkTypes": true }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. ```
  167. - The rule `noUnusedVariables` no longer reports unused function parameters. Use [`noUnusedFunctionParameters`](https://biomejs.dev/linter/rules/no-unused-function-parameters/).
  168. - Fixed [#5564](https://github.com/biomejs/biome/issues/5564). `noTypeOnlyImportAttributes` now ignores files ending with the extension `.ts` when the type field of `package.json` is set to `commonjs`.
  169. - The Biome formatter no longer adds a trailing comma in `.json` files, even when `json.formatter.trailingCommas` is set to `true`.
  170. - [Prettier 3.4](https://prettier.io/blog/2024/11/26/3.4.0.html) introduced a change in their normalization process of string literals: it no longer unescapes useless escape sequences.
  171. Biome now matches the new behavior of Prettier when formatting code.
  172. This affects the JSON and JavaScript formatters.
  173. - Reduced accepted values for formatter options:
  174. - The option `--quote-style` doesn't accept `Single` and `Double` anymore.
  175. - The option `--quote-properties` doesn't accept `AsNeeded` and `Preserve` anymore.
  176. - The option `--semicolons` doesn't accept `AsNeeded` and `Always` anymore.
  177. - The option `--arrow-parenthesis` doesn't accept `AsNeeded` and `Always` anymore.
  178. - The option `--trailing-commas` doesn't accept `ES5`, `All` and `None` anymore.
  179. - The option `--attribute-position` doesn't accept `Single` and `Multiline` anymore.
  180. - Removed the option `enumMemberCase` from the lint rule `useNamingConvention`.
  181. `enumMemberCase` is an option that allows to customize the enforced case for TypeScript's enum members.
  182. The option was introduced prior to the `conventions` option that allows to do the same thing.
  183. The following configuration...
  184. ```json
  185. {
  186. "linter": {
  187. "rules": {
  188. "style": {
  189. "useNamingConvention": {
  190. "level": "on",
  191. "options": {
  192. "enumMemberCase": "PascalCase"
  193. }
  194. }
  195. }
  196. }
  197. }
  198. }
  199. ```
  200. ...must be rewritten as:
  201. ```json
  202. {
  203. "linter": {
  204. "rules": {
  205. "style": {
  206. "useNamingConvention": {
  207. "level": "on",
  208. "options": {
  209. "conventions": [
  210. {
  211. "selector": { "kind": "enumMember" },
  212. "formats": ["PascalCase"]
  213. }
  214. ]
  215. }
  216. }
  217. }
  218. }
  219. }
  220. }
  221. ```
  222. Run `biome migrate --write` to turn `enumMemberCase` into `conventions` automatically.
  223. - Removed support for `BIOME_LOG_DIR`.
  224. The environment variable `BIOME_LOG_DIR` isn't supported anymore.
  225. Use `BIOME_LOG_PATH` instead.
  226. - Remove deprecated rules.
  227. The following _deprecated_ rules have been deleted:
  228. - `noInvalidNewBuiltin`
  229. - `noNewSymbol`
  230. - `useShorthandArrayType`
  231. - `useSingleCaseStatement`
  232. - `noConsoleLog`
  233. Run the command `biome migrate --write` to update the configuration.
  234. - Removed the deprecated `indentSize` option.
  235. The deprecated option `indentSize`, and its relative CLI options, has been removed:
  236. - Configuration file: `formatter.indentSize`
  237. - Configuration file: `javascript.formatter.indentSize`
  238. - Configuration file: `json.formatter.indentSize`
  239. - CLI option `--indent-size`
  240. - CLI option `--javascript-formatter-indent-size`
  241. - CLI option `--json-formatter-indent-size`
  242. Use `indentWidth` and its relative CLI options instead.
  243. - Removed `ROME_BINARY`. Use `BIOME_BINARY` instead.
  244. - Removed support for legacy suppressions.
  245. Biome used to support "legacy suppressions" that looked like this:
  246. ```js
  247. // biome-ignore lint(complexity/useWhile): reason
  248. ```
  249. This format is no longer supported.
  250. - Removed support for `max_line_length` from `.editorconfig`, as it isn't part of the official spec anymore.
  251. - Removed support for `rome-ignore` suppression comments.
  252. Use `biome-ignore` suppression comments instead.
  253. - Removed support for `rome.json`.
  254. Use `biome.json` or `biome.jsonc` instead.
  255. - Removed the option `all` from the linter.
  256. The options `linter.rules.all` and `linter.rules.<group>.all` has been removed.
  257. The number of rules in Biome have increased in scope and use cases, and sometimes some of them can conflict with each other.
  258. The option was useful at the beginning, but now it's deemed harmful, because it can unexpected behaviours in users projects.
  259. To automatically remove it, run the following command:
  260. ```shell
  261. biome migrate --write
  262. ```
  263. - Removed the option `trailingComma` from the configuration and the CLI. Use the option `trailingCommas` instead:
  264. ```diff
  265. {
  266. "javascript": {
  267. "formatter": {
  268. - "trailingComma": "es5"
  269. + "trailingCommas": "es5"
  270. }
  271. }
  272. }
  273. ```
  274. ```diff
  275. -biome format --trailing-comma=es5
  276. +biome format --trailing-commas=es5
  277. ```
  278. - Removed `--apply` and `--apply-unsafe`.
  279. The CLI options `--apply` and `--apply-unasfe` aren't accepted anymore. Use `--write` and `--write --unafe` instead:
  280. ```diff
  281. -biome check --apply-unsafe
  282. +biome check --write --unsafe
  283. ```
  284. ```diff
  285. -biome check --apply
  286. +biome check --write
  287. ```
  288. - Removed support for `assert` syntax.
  289. Biome now longer supports the `assert` syntax, use the new `with` syntax instead
  290. ```diff
  291. -import {test} from "foo.json" assert { for: "for" }
  292. -export * from "mod" assert { type: "json" }
  293. +import {test} from "foo.json" with { for: "for" }
  294. +export * from "mod" with { type: "json" }
  295. ```
  296. - Fixed [#5495](https://github.com/biomejs/biome/issues/5495): The rule
  297. [`noBlankTarget`](https://biomejs.dev/linter/rules/no-blank-target/) has been
  298. updated to accept the `rel="noopener"` in addition to `rel="noreferrer"`.
  299. In addition, an option has been added that allows `rel="noreferrer"` to be
  300. disabled.
  301. The rule has been moved from the `a11y` group to the `security` group.
  302. - The rule `useImportRestrictions` has been renamed to [`noPrivateImports`](https://biomejs.dev/linter/rules/no-private-imports), and its
  303. functionality has been significantly upgraded.
  304. Previously, the rule would assume that any direct imports from modules inside
  305. other directories should be forbidden due to their _package private_ visibility.
  306. The updated rule allows configuring the default visibility of exports, and
  307. recognises JSDoc comments to override this visibility. The default visibility
  308. is now `**public**`, but can be set to `**package**`, or even `**private**`.
  309. Refer to the [documentation of the rule](https://biomejs.dev/linter/rules/no-private-imports) to understand how to leverage the JSDoc comments.
  310. `noPrivateImports` is now recommended by default.
  311. - The Biome daemon now reuses its workspace across connections. This allows multiple clients to
  312. reuse the same documents and other cached data that we extract from them.
  313. This primarily affects our IDE extensions: If you open multiple IDEs/windows for the same project,
  314. they'll connect to the same daemon and reuse each other's workspace.
  315. The Biome CLI is unaffected unless you opt in with the `--use-server` argument.
  316. - Biome no longer treats too large files as errors.
  317. Previously, files that exceed the configured size limit would throw an error, and the CLI would exit with an error code.
  318. Now, the CLI ignores the file, emits an _information_ diagnostic and doesn't exit with an error code.
  319. - Change the group of some rules, promote nursery rules and update the recommended rule set.
  320. The following rules have been moved to a new group:
  321. - [complexity/noArguments](https://biomejs.dev/linter/rules/no-arguments)
  322. - [complexity/noCommaOperator](https://biomejs.dev/linter/rules/no-comma-operator)
  323. - [complexity/noFlatMapIdentity](https://biomejs.dev/linter/rules/no-flat-map-identity)
  324. - [complexity/noUselessContinue](https://biomejs.dev/linter/rules/no-useless-continue)
  325. - [complexity/useNumericLiterals](https://biomejs.dev/linter/rules/use-numeric-literals)
  326. - [correctness/useValidTypeof](https://biomejs.dev/linter/rules/use-valid-typeof)
  327. - [performance/noNamespaceImport](https://biomejs.dev/linter/rules/no-namespace-import/)
  328. - [style/useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals)
  329. - [suspicious/noWith](https://biomejs.dev/linter/rules/no-with)
  330. New rules are incubated in the nursery group.
  331. Once stable, we promote them to a stable group.
  332. Use the `biome migrate` command to automatically migrate nursery rules that have been promoted.
  333. The following CSS rules have been promoted:
  334. - [correctness/noMissingVarFunction](https://biomejs.dev/linter/rules/no-missing-var-function)
  335. - [correctness/noUnknownPseudoClass](https://biomejs.dev/linter/rules/no-unknown-pseudo-class)
  336. - [correctness/noUnknownPseudoElement](https://biomejs.dev/linter/rules/no-unknown-pseudo-element)
  337. - [correctness/noUnknownTypeSelector](https://biomejs.dev/linter/rules/no-unknown-type-selector)
  338. - [style/noDescendingSpecificity](https://biomejs.dev/linter/rules/no-descending-specificity)
  339. - [style/noValueAtRule](https://biomejs.dev/linter/rules/no-value-at-rule)
  340. - [suspcious/noDuplicateCustomProperties](https://biomejs.dev/linter/rules/no-duplicate-custom-properties)
  341. - [suspcious/noDuplicateProperties](https://biomejs.dev/linter/rules/no-duplicate-properties)
  342. The following GraphQL rules have been promoted:
  343. - [style/useDeprecatedReason](https://biomejs.dev/linter/rules/use-deprecated-reason)
  344. - [suspicious/noDuplicatedFields](https://biomejs.dev/linter/rules/no-duplicated-fields)
  345. The following JavaScript rules have been promoted:
  346. - [a11y/noStaticElementInteractions](https://biomejs.dev/linter/rules/no-static-element-interactions)
  347. - [a11y/useAriaPropsSupportedByRole](https://biomejs.dev/linter/rules/use-aria-props-supported-by-role)(recommended)
  348. - [a11y/useValidAutocomplete](https://biomejs.dev/linter/rules/use-valid-autocomplete)
  349. - [complexity/noUselessEscapeInRegex](https://biomejs.dev/linter/rules/no-useless-escape-in-regex)
  350. - [complexity/noUselessStringRaw](https://biomejs.dev/linter/rules/no-useless-string-raw)
  351. - [performance/noDynamicNamespaceImportAccess](https://biomejs.dev/linter/rules/no-dynamic-namespace-import-access)
  352. - [performance/noImgElement](https://biomejs.dev/linter/rules/no-img-element)
  353. - [style/noCommonJs](https://biomejs.dev/linter/rules/no-common-js)
  354. - [style/noEnum](https://biomejs.dev/linter/rules/no-enum)
  355. - [style/noExportedImports](https://biomejs.dev/linter/rules/no-exported-imports)
  356. - [style/noHeadElement](https://biomejs.dev/linter/rules/no-head-element)
  357. - [style/noNestedTernary](https://biomejs.dev/linter/rules/no-nested-ternary)
  358. - [style/noProcessEnv](https://biomejs.dev/linter/rules/no-process-env)
  359. - [style/noRestrictedImports](https://biomejs.dev/linter/rules/no-restricted-imports)
  360. - [style/noRestrictedTypes](https://biomejs.dev/linter/rules/no-restricted-types)
  361. - [style/noSubstr](https://biomejs.dev/linter/rules/no-substr)
  362. - [style/useAtIndex](https://biomejs.dev/linter/rules/use-at-index)
  363. - [style/useCollapsedIf](https://biomejs.dev/linter/rules/use-collapsed-if)
  364. - [style/useComponentExportOnlyModules](https://biomejs.dev/linter/rules/use-component-export-only-modules)
  365. - [style/useConsistentCurlyBraces](https://biomejs.dev/linter/rules/use-consistent-curly-braces)
  366. - [style/useConsistentMemberAccessibility](https://biomejs.dev/linter/rules/use-consistent-member-accessibility)
  367. - [style/useTrimStartEnd](https://biomejs.dev/linter/rules/use-trim-start-end)
  368. - [suspicious/noDocumentCookie](https://biomejs.dev/linter/rules/no-document-cookie)
  369. - [suspicious/noDocumentImportInPage](https://biomejs.dev/linter/rules/no-document-import-in-page)
  370. - [suspicious/noDuplicateElseIf](https://biomejs.dev/linter/rules/no-duplicate-else-if)
  371. - [suspicious/noHeadImportInDocument](https://biomejs.dev/linter/rules/no-head-import-in-document)
  372. - [suspicious/noIrregularWhitespace](https://biomejs.dev/linter/rules/no-irregular-whitespace)
  373. - [suspicious/noOctalEscape](https://biomejs.dev/linter/rules/no-octal-escape)
  374. - [suspicious/noTemplateCurlyInString](https://biomejs.dev/linter/rules/no-template-curly-in-string)
  375. - [suspicious/useAdjacentOverloadSignatures](https://biomejs.dev/linter/rules/use-adjacent-overload-signatures)
  376. - [suspicious/useGoogleFontDisplay](https://biomejs.dev/linter/rules/use-google-font-display)
  377. - [suspicious/useGuardForIn](https://biomejs.dev/linter/rules/use-guard-for-in)
  378. - [suspicious/useStrictMode](https://biomejs.dev/linter/rules/use-strict-mode)
  379. Moreover, the following JavaScript rules are now recommended:
  380. - [complexity/noUselessUndefinedInitialization](https://biomejs.dev/linter/rules/no-useless-undefined-initialization)
  381. - [complexity/useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals)
  382. - [correctness/noConstantMathMinMaxClamp](https://biomejs.dev/linter/rules/no-constant-math-min-max-clamp)
  383. - [correctness/noUnusedFunctionParameters](https://biomejs.dev/linter/rules/no-unused-function-parameters) (recommended by ESLint)
  384. - [correctness/noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports)
  385. - [correctness/noUnusedPrivateClassMembers](https://biomejs.dev/linter/rules/no-unused-private-class-members) (recommended by ESLint)
  386. - [correctness/noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables) (recommended by ESLint)
  387. - [complexity/useDateNow](https://biomejs.dev/linter/rules/use-date-now)
  388. And the following style rules are no longer recommended:
  389. - [style/useNumberNamespace](https://biomejs.dev/linter/rules/use-number-namespace)
  390. - [style/useAsConstAssertion](https://biomejs.dev/linter/rules/use-as-const-assertion)
  391. - [style/noParameterAssign](https://biomejs.dev/linter/rules/no-parameter-assign)
  392. - [style/noInferrableTypes](https://biomejs.dev/linter/rules/no-inferrable-types)
  393. - [style/useDefaultParameterLast](https://biomejs.dev/linter/rules/use-default-parameter-last)
  394. - [style/noUnusedTemplateLiteral](https://biomejs.dev/linter/rules/no-unused-template-literal)
  395. - [style/useEnumInitializers](https://biomejs.dev/linter/rules/use-enum-initializers)
  396. - [style/noUselessElse](https://biomejs.dev/linter/rules/no-useless-else)
  397. - [style/useSelfClosingElements](https://biomejs.dev/linter/rules/use-self-closing-elements)
  398. - [style/useSingleVarDeclarator](https://biomejs.dev/linter/rules/use-single-var-declarator)
  399. - Update the default severity level of lint rules.
  400. Every diagnostic emitted by Biome has a severity level set to `error`, `warn`, or `info`.
  401. Previously, all recommended lint rules had a default severity level set to `error`.
  402. All other lint rules had a default severity level set to `warn`.
  403. We have adjusted the default severity level of every rule, whether recommended or not, to better communicate the _severity_ that a diagnostic highlights.
  404. - Rules that report hard errors, likely erroneous code, dangerous code, or accessibility issues now have a default severity level of `error`.
  405. - Rules that report possibly erroneous codes, or code that could be cleaner if rewritten in another way now have a default severity level of `warn`.
  406. - Rules that reports stylistic suggestions now have a default severity level of `info`.
  407. You can use the CLI option `--diagnostic-level=error` to display only errors, or `--diagnostic-level=warning` to display both errors and warnings.
  408. By default, all diagnostics are shown.
  409. You can also use the CLI option `--error-on-warnings` to make the command fail when warnings are emitted.
  410. - Reworked some recommended rules recommended to be less pedantic and blocking. This is a **breaking change** if your project relied on those rules to block the CI in case of violations; if that's the case, you should raise their severity level to **error**.
  411. Some rules aren't recommended anymore, and some others return a different severity.
  412. The following rules return a **warning** diagnostic:
  413. - `noDelete`
  414. - `noForEach`
  415. - `noSuspiciousSemicolonInJsx`
  416. - `noThisInStatic`
  417. - `noUnusedLabels`
  418. The following rules return an **information** diagnostic:
  419. - `noUselessCatch`
  420. - `noUselessConstructor`
  421. - `noUselessEmptyExport`
  422. - `noUselessFragments`
  423. - `noUselessLabel`
  424. - `noUselessLoneBlockStatements`
  425. - `noUselessSwitchCase`
  426. - `noUselessTernary`
  427. - `noUselessThisAlias`
  428. - `noUselessTypeConstraint`
  429. - `noFlatMapIdentity`
  430. The following rules aren't recommended anymore:
  431. - `noDelete`
  432. - `noForEach`
  433. The rule `noRenderReturnValue` and `useExhaustiveDependencies` are only recommended when the `react` domain is enabled.
  434. - Renamed the global option `--skip-errors` to `--skip-parse-errors`.
  435. - Remove the code action `quickfix.suppressRule`.
  436. The code action `quickfix.suppressRule` was removed in favour of two new code actions:
  437. - `quickfix.suppressRule.inline.biome`: a code action that adds a suppression comment for each violation.
  438. - `quickfix.suppressRule.topLevel.biome`: a code action that adds a suppression comment at the top of the file which suppresses a rule for the whole file.
  439. Given the following code
  440. ```js
  441. let foo = "one";
  442. debugger;
  443. ```
  444. The code action `quickfix.suppressRule.inline.biome` will result in the following code:
  445. ```js
  446. // biome-ignore lint/style/useConst: <explanation>
  447. let foo = "one";
  448. // biome-ignore lint/suspicious/noDebugger: <explanation>
  449. debugger;
  450. ```
  451. The code action `quickfix.suppressRule.topLevel.biome`, instead, will result in the following code:
  452. ```js
  453. /** biome-ignore lint/suspicious/noDebugger: <explanation> */
  454. /** biome-ignore lint/style/useConst: <explanation> */
  455. let foo = "one";
  456. debugger;
  457. ```
  458. - Changed default formatting of `package.json`.
  459. When Biome encounters a file called `package.json`, by default it will format the file with all objects and arrays expanded.
  460. ```diff
  461. - { "name": "project", "dependencies": { "foo": "latest" } }
  462. + {
  463. + "projectName": "project",
  464. + "dependencies": {
  465. + "foo": "^1.0.0"
  466. + }
  467. + }
  468. ```
  469. - The `organizeImports` is now part of Biome Assist.
  470. - The rule [`noVar`](https://biomejs.dev/linter/rules/no-var/) now belongs to the `suspicious` group
  471. - The rule [`useWhile`](https://biomejs.dev/linter/rules/use-while/) now belongs to the `complexity` group.
  472. - The rule [`useImportExtensions`](https://biomejs.dev/linter/rules/use-import-extensions/) has been updated to suggest actual file extensions instead of guesses based on hueristics.
  473. As part of this, the `suggestedExtensions` option has been removed. A simpler,
  474. new option called `forceJsExtensions` has been introduced for those who use
  475. `tsc`'s `"module": "node16"` setting.
  476. The rule also no longer reports diagnostics to add an extension when the path
  477. doesn't exist at all, with or without extension.
  478. - Fixed [#4545](https://github.com/biomejs/biome/issues/4545): [`useNamingConvention`](https://biomejs.dev/linter/rules/use-naming-convention/) now correctly ignores declarations inside TypeScript's external modules.
  479. The following interface name is no longer reported by the rule:
  480. ```ts
  481. declare module "myExternalModule" {
  482. export interface my_INTERFACE {}
  483. }
  484. ```
  485. - The rule [`useAltText`](https://biomejs.dev/linter/rules/use-alt-text/) no longer checks the element's attributes containing object spread.
  486. The following code doesn't trigger the rule anymore:
  487. ```jsx
  488. <img src="test.png" alt={alt} {...restProps}></img>
  489. ```
  490. - The rule [`useNamingConvention`](https://biomejs.dev/linter/rules/use-naming-convention/) no longer accepts non-ASCII characters by default.
  491. Prior to Biome 2.0, non-ASCII names were accepted by default. They are now rejected.
  492. For example, the following code is now reported as invalid by the `useNamingConvention` rule.
  493. ```js
  494. let johnCafé;
  495. ```
  496. If you want to allow non ASCII filenames and non-ASCII identifiers, you need to set the `requireAscii` options in your Biome configuration file to `false`:
  497. ```json
  498. {
  499. "linter": {
  500. "rules": {
  501. "style": {
  502. "useFilenamingConvention": {
  503. "level": "on",
  504. "options": {
  505. "requireAscii": false
  506. }
  507. }
  508. "useFilenamingConvention": {
  509. "level": "on",
  510. "options": {
  511. "requireAscii": false
  512. }
  513. }
  514. }
  515. }
  516. }
  517. }
  518. ```
  519. - Renamed the rule `noUnnecessaryContinue` to `noUselessContinue`. Run the command `biome migrate` to update your configuration.
  520. - Renamed the rule `noMultipleSpacesInRegularExpressionLiterals` to `noAdjacentSpacesInRegex`. Run the command `biome migrate` to update your configuration.
  521. ### Minor Changes
  522. - An option called `allowNoReferrer` has been added to the
  523. [`noBlankTarget`](https://biomejs.dev/linter/rules/no-blank-target/) rule.
  524. By default, `noBlankTarget` accepts both `rel="noopener"` and `rel="noreferrer"`
  525. with links that have `target="_blank"`. This is because the latter _implies_ the
  526. former, so either one is sufficient to mitigate the security risk.
  527. However, allowing `rel="noreferrer"` may still be undesirable, because it can
  528. break tracking, which may be an undesirable side-effect. As such, you can set
  529. `allowNoReferrer: false` to _only_ accept `rel="noopener"`.
  530. - Added new option `javascript.parser.jsxEverywhere`. This new option allows to control whether Biome should expect JSX syntax in `.js`/`.mjs`/`.cjs` files.
  531. When `jsxEverywhere` is set to `false`, having JSX syntax like `<div></div>` inside `.js`/`.mjs`/`.cjs` files will result in a **parsing error**.
  532. Despite the name of the option, JSX is never supported inside `.ts` files. This is because TypeScript generics syntax may conflict with JSX in such files.
  533. This option defaults to `true`.
  534. - Add a new JS assist rule - `useSortedKeys` which enforces ordering of a JS object properties.
  535. This rule will consider spread/calculated keys e.g `[k]: 1` as non-sortable.
  536. Instead, whenever it encounters a non-sortable key, it will sort all the
  537. previous sortable keys up until the nearest non-sortable key, if one exist.
  538. This prevents breaking the override of certain keys using spread keys.
  539. Source: https://perfectionist.dev/rules/sort-objects
  540. ```js
  541. // Base
  542. // from
  543. const obj = {
  544. b: 1,
  545. a: 1,
  546. ...g,
  547. ba: 2,
  548. ab: 1,
  549. set aab(v) {
  550. this._aab = v;
  551. },
  552. [getProp()]: 2,
  553. aba: 2,
  554. abc: 3,
  555. abb: 3,
  556. get aaa() {
  557. return "";
  558. },
  559. };
  560. // to
  561. const obj = {
  562. a: 1,
  563. b: 1,
  564. ...g,
  565. set aab(v) {
  566. this._aab = v;
  567. },
  568. ab: 1,
  569. ba: 2,
  570. [getProp()]: 2,
  571. get aaa() {
  572. return "";
  573. },
  574. aba: 2,
  575. abb: 3,
  576. abc: 3,
  577. };
  578. ```
  579. - Added the new rule [`noFloatingPromises`](https://biomejs.dev/linter/rules/no-floating-promises).
  580. - Added the new rule [`noImportCycles`](https://biomejs.dev/linter/rules/no-import-cycles).
  581. - Added the new rule [`noTsIgnore`](https://biomejs.dev/linter/rules/no-ts-ignore).
  582. - Added the new rule [`noUnwantedPolyfillio`](https://biomejs.dev/linter/rules/no-unwanted-polyfillio).
  583. - Added a format option `expand` for Javascript and JSON formatters.
  584. The option allows to enforce the formatting of arrays and objects on multiple lines, regardless of their length.
  585. It has three options:
  586. When set to `auto` (default), objects are expanded if the first property has a leading newline.
  587. Arrays are collapsed when they fit to a single line.
  588. For example, both styles below are considered as already formatted:
  589. ```js
  590. const obj = {
  591. foo: "bar",
  592. };
  593. ```
  594. ```js
  595. const obj = { foo: "bar" };
  596. ```
  597. When set to `always`, objects and arrays are always expanded.
  598. When set to `never`, objects and arrays are never expanded when they fit in a single line.
  599. It is equivalent to Prettier's [Object Wrap](https://prettier.io/docs/options#object-wrap) option with `collapse`.
  600. - The nursery rule [`noUnresolvedImports`](https://biomejs.dev/linter/rules/no-unresolved-imports/) has been added.
  601. Importing a non-existing export is an error at runtime or build time. With this
  602. rule, Biome can detect such incorrect imports and report errors for them.
  603. Note that if you use TypeScript, you probably don't want to use this rule, since
  604. TypeScript already performs such checks for you.
  605. - The rule [`noFocusedTests`](https://biomejs.dev/linter/rules/no-focused-tests/) can now detect the usage of focused tests inside loops.
  606. ```js
  607. // invalid
  608. describe.only.each([["a"], ["b"]])("%s", (a) => {});
  609. it.only.each([["a"], ["b"]])("%s", (a) => {});
  610. test.only.each([["a"], ["b"]])("%s", (a) => {});
  611. // valid
  612. describe.each([["a"], ["b"]])("%s", (a) => {});
  613. it.each([["a"], ["b"]])("%s", (a) => {});
  614. test.each([["a"], ["b"]])("%s", (a) => {});
  615. ```
  616. - Linter groups now accept new options to enable/disable all rules that belong to a group, and control the severity
  617. of the rules that belong to those groups.
  618. For example, you can downgrade the severity of rules that belong to `"style"` to emit `"info"` diagnostics:
  619. ```json
  620. {
  621. "linter": {
  622. "rules": {
  623. "style": "info"
  624. }
  625. }
  626. }
  627. ```
  628. You can also enable all rules that belong to a group using the default severity of the rule using the `"on"` option:
  629. ```json
  630. {
  631. "linter": {
  632. "rules": {
  633. "complexity": "on"
  634. }
  635. }
  636. }
  637. ```
  638. - Biome assist is a new feature of the Biome analyzer. The assist is meant to provide **actions**. Actions differ from linter rules in that they aren't meant to signal errors.
  639. The assist will provide code actions that users can opt into via configuration or via IDEs/editors, using the Language Server Protocol.
  640. The assist **is enabled by default**. However, you can turn if off via configuration:
  641. ```json
  642. {
  643. "assist": {
  644. "enabled": false
  645. }
  646. }
  647. ```
  648. You can turn on the actions that you want to use in your configuration. For example, you can enable the `useSortedKeys` action like this:
  649. ```json
  650. {
  651. "assist": {
  652. "actions": {
  653. "source": {
  654. "useSortedKeys": "on"
  655. }
  656. }
  657. }
  658. }
  659. ```
  660. Alternatively, IDE/editor users can decide which action to apply on save _directly from the editor settings_, as long as the assist is enabled.
  661. For example, in VS Code you can apply the `useSortedKeys` action when saving a file by adding the following snippet in `settings.json`:
  662. ```json
  663. {
  664. "editor.codeActionsOnSave": {
  665. "source.biome.useSortedKeys": "explicit"
  666. }
  667. }
  668. ```
  669. In Zed, you can achieve the same by adding the following snippet in `~/.config/zed/settings.json`:
  670. ```json
  671. {
  672. "code_actions_on_format": {
  673. "source.biome.useSortedKeys": true
  674. }
  675. }
  676. ```
  677. - Biome migrate eslint outputs a better overriding behavior.
  678. A Biome rule can have multiple ESLint equivalent rules.
  679. For example, [useLiteralKeys](https://biomejs.dev/linter/rules/use-literal-keys/) has two ESLint equivalent rules: [dot-notation](https://eslint.org/docs/latest/rules/dot-notation) and [@typescript-eslint/dot-notation](https://typescript-eslint.io/rules/dot-notation/).
  680. Previously, Biome wouldn't always enable a Biome rule even if one of its equivalent rules was enabled.
  681. Now Biome uses the higher severity level of all the equivalent ESLint rules to set the severity level of the Biome rule.
  682. The following ESLint configuration...
  683. ```json
  684. {
  685. "rules": {
  686. "@typescript-eslint/dot-notation": "error",
  687. "dot-notation": "off"
  688. }
  689. }
  690. ```
  691. ...is now migrated to...
  692. ```json
  693. {
  694. "linter": {
  695. "rules": {
  696. "complexity": {
  697. "useLiteralKeys": "error"
  698. }
  699. }
  700. }
  701. }
  702. ```
  703. ...because `error` is higher than `off`.
  704. - Add [useSymbolDescription](https://biomejs.dev/linter/rules/use-symbol-description/).
  705. - Enhanced the command `migrate eslint`. Now the command shows which ESLint rules were migrated,
  706. and which rules aren't supported yet.
  707. ```
  708. ./eslint.config.js migrate ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  709. ℹ 42% (3/7) of the rules have been migrated.
  710. ℹ Migrated rules:
  711. - getter-return
  712. - prefer-const
  713. - @typescript-eslint/require-await
  714. ℹ Rules that can be migrated to an inspired rule using --include-inspired:
  715. - @typescript-eslint/parameter-properties
  716. ℹ Rules that can be migrated to a nursery rule using --include-nursery:
  717. - @typescript-eslint/switch-exhaustiveness-check
  718. ℹ Stylistic rules that the formatter may support (manual migration required):
  719. - semi
  720. ℹ Unsupported rules:
  721. - block-scoped-var
  722. configuration ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  723. ℹ Migration results:
  724. - ./biome.json: configuration successfully migrated.
  725. ```
  726. - Suppression of syntax rules
  727. Added support for suppressing syntax rules. Syntax rules are particular rules meant **to complement the parser**, hence they can't be configured.
  728. Biome now allows to suppress those rules. This can, for example, be useful in case the rule is affected by a bug. However, this is more an escape hatch, so if a syntax rule requires a suppression, please file an issue.
  729. Example:
  730. ```typescript
  731. // biome-ignore syntax/correctness/noTypeOnlyImportAttributes: bug
  732. import type { MyType } from "my-esm-pkg" with { "resolution-mode": "import" };
  733. ```
  734. Biome now requires all `biome-ignore-start` suppressions to have an equivalent `biome-ignore-end` comment.
  735. - Add a new lint rule `noConstantBinaryExpression`.
  736. This rule is inspired from ESLint's [no-constant-binary-expression](https://eslint.org/docs/latest/rules/no-constant-binary-expression) rule.
  737. - The CLI options `--only` and `--skip` now accept rule and action names without prefixing the group name.
  738. Previously `--only=noDebugger` was rejected.
  739. You had to add the group name: `--only=suspicious/noDebugger`.
  740. - Fixed [#3574](https://github.com/biomejs/biome/issues/3574): `noUnusedImports` now reports empty named imports and suggests their removal.
  741. The rule now suggests the removal of empty named imports such as:
  742. ```diff
  743. - import {} from "mod";
  744. ```
  745. - Added the new rule [`useAdjacentGetterSetter`](https://biomejs.dev/linter/rules/use-adjacent-getter-setter), which enforces getters and setters for the same property
  746. to be adjacent in class and object definitions.
  747. **Example (Invalid): Name getter and setter are not adjacent:**
  748. ```js
  749. class User {
  750. get name() {
  751. return this._name;
  752. }
  753. constructor() {}
  754. set name(value) {
  755. this._name = value;
  756. }
  757. }
  758. ```
  759. \*\*Example (Invalid): Getter should go before the setter.
  760. ```js
  761. const user = {
  762. set name(value) {
  763. this._name = value;
  764. },
  765. get name() {
  766. return this._name;
  767. },
  768. };
  769. ```
  770. **Example (Valid): Name getter and setter are adjacent:**
  771. ```js
  772. class User {
  773. get name() {
  774. return this._name;
  775. }
  776. set name(value) {
  777. this._name = value;
  778. }
  779. get age() {
  780. return this._age;
  781. }
  782. set age(age) {
  783. this._age = age;
  784. }
  785. }
  786. ```
  787. - Added new rule [useConsistentResponse](https://biomejs.dev/linter/rules/use-consistent-response) which suggests to use static [Response.json()](https://developer.mozilla.org/en-US/docs/Web/API/Response/json) and [Response.redirect()](https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect_static) methods instead of `new Response` when possible.
  788. Example:
  789. ```js
  790. new Response(JSON.stringify({ value: 1 }));
  791. Response.json({ value: 1 });
  792. ```
  793. - Biome users can now configure code actions from linter rules as well as assist actions directly in the settings of their IDE/editor.
  794. For example, let's consider the lint rule [`noSwitchDeclarations`](https://biomejs.dev/linter/rules/no-switch-declarations/), which has an unsafe fix.
  795. Previously, if you wanted to use this rule, you were "forced" to enable it via configuration, and if you wanted to apply its fix when you saved a file, you were forced to mark the fix as safe:
  796. ```json
  797. {
  798. "linter": {
  799. "rules": {
  800. "correctness": {
  801. "noSwitchDeclarations": {
  802. "level": "error",
  803. "fix": "safe"
  804. }
  805. }
  806. }
  807. }
  808. }
  809. ```
  810. Now, you can benefit from the code action without making the fix safe for the entire project. IDEs and editors that are LSP compatible allow to list a series of "filters" or code actions that can be applied on save. In the case of VS Code, you will need to add the following snippet in the `settings.json`:
  811. ```json
  812. {
  813. "editor.codeActionsOnSave": {
  814. "quickfix.biome.correctness.noSwitchDeclarations": "explicit"
  815. }
  816. }
  817. ```
  818. Upon save, Biome will inform the editor the apply the code action of the rule `noSwitchDeclarations`.
  819. - Fixed [#3401](https://github.com/biomejs/biome/issues/3401): `noUnusedImports` now keeps comments separated from the import with a blank line.
  820. For example:
  821. ```diff
  822. // Orphan comment
  823. - // Header comment
  824. - import {} from "mod";
  825. ```
  826. - Added a new `propertyAssignment` option to the `noParameterAssign` rule.
  827. This option allows to configure whether property assignments on function parameters are permitted.
  828. By default, `propertyAssignment` is set to `allow`.
  829. Setting it to `deny` enforces stricter immutability by disallowing property mutations on function parameters.
  830. - The formatter option `bracketSpacing` is now also supported in JSON files.
  831. - `useValidTypeof` now accepts comparisons with variables.
  832. Previously, the rule required to compare a `typeof` expression against another `typeof` expression or a valid string literal. We now accept more cases, notably comparison against a variable:
  833. ```js
  834. if (typeof foo === bar) {
  835. // ...
  836. }
  837. ```
  838. - Added the new rule [`noNestedComponentDefinitions`](https://biomejs.dev/linter/rules/no-nested-component-definitions),
  839. which disallows nested component definitions in React components.
  840. This rule is useful for preventing potential performance issues and improving code readability by ensuring that components are defined at the top level.
  841. **Example (Invalid):**
  842. ```jsx
  843. function ParentComponent() {
  844. function ChildComponent() {
  845. return <div>Hello</div>;
  846. }
  847. return <ChildComponent />;
  848. }
  849. ```
  850. **Example (Valid):**
  851. ```jsx
  852. function ChildComponent() {
  853. return <div>Hello</div>;
  854. }
  855. function ParentComponent() {
  856. return <ChildComponent />;
  857. }
  858. ```
  859. - Added the new rule [`noDestructuredProps`](https://biomejs.dev/linter/rules/no-destructured-props/), which disallow the use of destructured props in Solid projects.
  860. - You can now enable lint rules using the default severity suggested by Biome using the new variant `"on"`, when enabling a rule.
  861. For example, the default severity of the rule `style.noVar` is `error`, so you would use `"on"`, and then linting a code that uses `var`, will result in an error:
  862. ```json
  863. {
  864. "linter": {
  865. "recommended": false,
  866. "rules": {
  867. "style": {
  868. "noVar": "on"
  869. }
  870. }
  871. }
  872. }
  873. ```
  874. ```js
  875. // main.js
  876. var name = "tobias";
  877. ```
  878. The command `biome lint main.js` will result in an error due to the default severity assigned to `noVar`.
  879. Refer to the documentation page of each rule to know their suggested diagnostic severity, or use the command `biome explain <RULE_NAME>`:
  880. ```shell
  881. biome explain noVar
  882. ```
  883. - Biome VCS integration now supports nested ignore files.
  884. For `git`, if a `.gitignore` is found in a nested folder `root/packages/foo/`, and it contains the pattern `dist/`, only files and directories inside `root/packages/foo/dist` are matched.
  885. - Added the rule [useUniqueElementIds](https://biomejs.dev/linter/rules/use-unique-element-ids/).
  886. This rule disallows the use of static IDs in React components. It encourages to generate unique IDs for accessibility purposes using [`useId`](https://react.dev/reference/react/useId).
  887. The following code is now reported as invalid:
  888. ```jsx
  889. function App() {
  890. return <div id="static-id" />;
  891. }
  892. ```
  893. The following code is now reported as valid:
  894. ```jsx
  895. import { useId } from "react";
  896. function App() {
  897. const id = useId();
  898. return <div id={id} />;
  899. }
  900. ```
  901. - Added the new JavaScript rule [`useConsistentObjectDefinition`](https://biomejs.dev/linter/rules/use-consistent-object-definition/) rule. The rule enforces a consistent style for the definition of objects:
  902. By default, the rule enforces a shorthand style:
  903. ```js
  904. const validShorthand = {
  905. // Property shorthand
  906. foo,
  907. // Method shorthand
  908. method() {
  909. return "method";
  910. },
  911. };
  912. ```
  913. Alternatively, the rule can be configured to enforce an explicit style:
  914. ```js
  915. const invalidExplicit = {
  916. // Basic property shorthand violations
  917. foo: foo,
  918. // Method shorthand violations
  919. method: function () {
  920. return "method";
  921. },
  922. };
  923. ```
  924. - Introduced more advanced logging capabilities:
  925. Every Biome CLI command can now be passed a `--log-file=<path>` argument, which
  926. will write all log messages for that invocation to the given path instead of
  927. `stdout`.
  928. In addition, the `--log-level` parameter now also accepts a `tracing` value.
  929. When `--log-level=tracing` is used, Biome also prints timing information from
  930. tracing spans to the log.
  931. Combined with Biome's ability to print logs in JSON format, and the `jq` command
  932. line utility, this allows you to perform advanced analysis on Biome's internal
  933. performance.
  934. For example, if you want to figure out which paths take the longest when
  935. building the module graph, you can use the following commands:
  936. ```sh
  937. biome lint --log-level=tracing --log-kind=json --log-file=tracing.json
  938. cat tracing.json | jq '. | select(.span.name == "update_module_graph") | { path: .span.path, time_busy: .["time.busy"], time_idle: .["time.idle"] }' > filtered.json
  939. ```
  940. Now you will have a file called `filtered.json` with all the relevant timings,
  941. together with the paths used during the invocations.
  942. - Added options to `suspicious/noConfusingLabels` to allow specific labels.
  943. - Fixed [#4549](https://github.com/biomejs/biome/issues/4549): [noUnknownProperty](https://biomejs.dev/linter/rules/no-unknown-property/) now accepts more known CSS properties.
  944. ```diff
  945. - ['anchor-default', 'anchor-scroll', 'inset-area', 'position-animation', 'position-fallback', 'position-fallback-bounds', 'position-try-options']
  946. + ['anchor-scope', 'interpolate-size', 'line-fit-edge', 'masonry', 'masonry-auto-tracks', 'masonry-direction', 'masonry-fill', 'masonry-flow', 'masonry-slack', 'masonry-template-areas', 'masonry-template-tracks', 'position-anchor', 'position-area', 'position-try-fallbacks', 'position-visibility', 'scroll-start-target', 'text-box', 'view-transition-class', 'view-transition-group']
  947. ```
  948. This change replaces deprecated properties, improving CSS validation.
  949. - LSP clients can now override the configuration path for each workspace, by responding to
  950. `workspace/configuration` requests.
  951. - Added the new CSS rule [`noImportantStyles`](https://biomejs.dev/linter/rules/no-important-styles), which prevents the use of `!important` inside CSS declarations.
  952. - Biome now emits a warning diagnostic if the configuration contains an out-of-sync schema URL.
  953. - Introduced a new configuration setting `files.experimentalScannerIgnores`.
  954. This setting may be used to configure a set of file and folder names that should
  955. be unconditionally ignored by Biome's scanner.
  956. Biome maintains an internal list of default ignore entries, which is based on
  957. user feedback and which may change in any release. This setting allows
  958. overriding this internal list completely.
  959. This is considered an advanced feature that users _should_ not need to tweak
  960. themselves, but they can as a last resort. This setting can only be configured
  961. in root configurations, and is ignored in nested configs.
  962. Entries must be file or folder _names_. Specific paths and globs are not
  963. supported.
  964. Examples where this may be useful:
  965. ```jsonc
  966. {
  967. "files": {
  968. "experimentalScannerIgnores": [
  969. // You almost certainly don't want to scan your `.git` folder, which
  970. // is why it's already ignored by default:
  971. ".git",
  972. // But the scanner does scan `node_modules` by default. If you
  973. // *really* don't want this, you can ignore it like this:
  974. "node_modules",
  975. // But it's probably better to ignore a specific dependency.
  976. // For instance, one that happens to be particularly slow to scan:
  977. "RedisCommander.d.ts",
  978. ],
  979. },
  980. }
  981. ```
  982. Please be aware that rules relying on the module graph or type inference
  983. information may be negatively affected if dependencies of your project aren't
  984. (fully) scanned.
  985. - Added the new rule [useSingleJsDocAsterisk](https://biomejs.dev/linter/rules/use-single-js-doc-asterisk/) which enforces JSDoc comment lines to start with a single asterisk.
  986. ```js
  987. // Invalid
  988. /**
  989. ** Description
  990. */
  991. // Valid
  992. /**
  993. * Description
  994. */
  995. ```
  996. - The CLI flag `--javascript-attribute-position` was renamed to `--javascript-formatter-attribute-position` for consistency.
  997. - Introduced the `domains` linter feature. The Biome linter now has a new way to opt-in rules, with a concept called `domains`.
  998. Domains can be seen as concepts shared by different rules.
  999. You can enable and disable multiple rules that belong to a domain. When you assign `"all"`, Biome will enable all the rules, when you assign `"none"`, Biome will disable the rules, when you assign "recommended", Biome will enable all rules of the domain that are recommended.
  1000. ```json5
  1001. // biome.jsonc
  1002. {
  1003. linter: {
  1004. domains: {
  1005. test: "all", // all rules that belong to this domain are enabled
  1006. react: "recommended", // only the recommended rules from this domain are enabled
  1007. solid: "none", // rules related to Solid are disabled
  1008. },
  1009. },
  1010. }
  1011. ```
  1012. New domains introduced:
  1013. - `test`: it will enable rules:
  1014. - `noExportsInTest`
  1015. - `noExcessiveNestedTestSuites`
  1016. - `noDuplicateTestHooks`
  1017. - `noFocusedTests`
  1018. And it will inject the following globals:
  1019. - `after`
  1020. - `afterAll`
  1021. - `afterEach`
  1022. - `before`
  1023. - `beforeEach`
  1024. - `beforeAll`
  1025. - `describe`
  1026. - `it`
  1027. - `expect`
  1028. - `test`
  1029. - `next`: it will enable rules for Next.js projects:
  1030. - `useExhaustiveDependencies`
  1031. - `useHookAtTopLevel`
  1032. - `noImgElement`
  1033. - `noHeadImportInDocument`
  1034. - `noHeadImportInDocument`
  1035. - `react`: it will enable rules for React projects:
  1036. - `useExhaustiveDependencies`
  1037. - `useHookAtTopLevel`
  1038. - `solid`: it will enable rules for Solid projects:
  1039. - `noReactSpecificProps`
  1040. For more information regarding how Biome enables rules via domains, please refer to the documentation page of each rule.
  1041. - Biome now prints diagnostics sorted by their severity. The order is the following:
  1042. 1. information
  1043. 2. warning
  1044. 3. error
  1045. This means that _error_ diagnostics are printed **last**, so users can see them first.
  1046. - Added the new rule [`useIterableCallbackReturn`](https://biomejs.dev/linter/rules/use-iterable-callback-return), which enforces consistent return values in iterable callbacks.
  1047. The following methods require a return value in their callback:
  1048. - `every`
  1049. - `filter`
  1050. - `find`
  1051. - `findIndex`
  1052. - `findLast`
  1053. - `findLastIndex`
  1054. - `flatMap`
  1055. - `map`
  1056. - `reduce`
  1057. - `reduceRight`
  1058. - `some`
  1059. - `sort`
  1060. - `toSorted`
  1061. — `from` (when called on `Array`)
  1062. The rule disallows a return value inside the callback of the method `forEach`.
  1063. Examples:
  1064. ```js
  1065. [].map(() => {
  1066. // Missing return value
  1067. });
  1068. ```
  1069. ```js
  1070. [].forEach(() => {
  1071. return 1; // Disallowed
  1072. });
  1073. ```
  1074. - Added the new rule [`noReactPropAssign`](https://biomejs.dev/linter/rules/no_react_prop_assign), based on the react-hooks rule [react-hooks/react-compiler](https://www.npmjs.com/package/eslint-plugin-react-hooks)
  1075. The following code is now reported as invalid:
  1076. ```jsx
  1077. function Foo(props) {
  1078. props.bar = `Hello ${props.bar}`;
  1079. return <div>{props.bar}</div>;
  1080. }
  1081. ```
  1082. The following code is now reported as valid:
  1083. ```jsx
  1084. function Foo({ bar }) {
  1085. bar = `Hello ${bar}`;
  1086. return <div>{bar}</div>;
  1087. }
  1088. ```
  1089. - Added new rule [`noBitwiseOperators`](https://biomejs.dev/linter/rules/no-bitwise-operators/), which disallows bitwise operators.
  1090. - The Biome analyzer now supports a new top-level suppression. These suppression have to be placed at the top of the file, and they must be followed by two newlines (`\n\n\`).
  1091. The analyzer rules specified inside the block comment will be suppressed for the whole file.
  1092. In the example, we suppress the rules `lint/style/useConst` and `lint/suspicious/noDebugger` for the whole file:
  1093. ```js
  1094. // main.js
  1095. /**
  1096. * biome-ignore-all lint/style/useConst: i like let
  1097. * biome-ignore-all lint/suspicious/noDebugger: needed now
  1098. */
  1099. let path = "/path";
  1100. let _tmp = undefined;
  1101. debugger;
  1102. ```
  1103. In this other example, we suppress `lint/suspicious/noEmptyBlock` for a whole CSS file:
  1104. ```css
  1105. /**
  1106. /* biome-ignore-all lint/suspicious/noEmptyBlock: it's fine to have empty blocks
  1107. */
  1108. a {
  1109. }
  1110. span {
  1111. }
  1112. ```
  1113. A new diagnostic is emitted if `biome-ignore-all` suppression isn't placed at the top of the file:
  1114. ```block
  1115. file.js:3:1 suppressions/incorrect ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  1116. ! Top level suppressions can only be used at the beginning of the file.
  1117. 2 │ let foo = 2;
  1118. > 3 │ /**
  1119. │ ^^^
  1120. > 4 │ * biome-ignore-all lint/style/useConst: reason
  1121. > 5 │ */
  1122. │ ^^
  1123. 6 │ let bar = 33;
  1124. i Rename this to biome-ignore
  1125. 2 │ let foo = 2;
  1126. 3 │ /**
  1127. > 4 │ * biome-ignore-all lint/style/useConst: reason
  1128. │ ^^^^^^^^^^^^^^^^
  1129. 5 │ */
  1130. 6 │ let bar = 33;
  1131. ```
  1132. - Added the new rule [`useNumericSeparators`](https://biomejs.dev/linter/rules/use-numeric-separators), which encourages the use of numeric separators to improve readability.
  1133. - [useImportExtensions](https://biomejs.dev/linter/rules/use-import-extensions/) now checks imports with sub extensions.
  1134. ```js
  1135. - import 'styles.css'
  1136. + import 'styles.css.ts'
  1137. ```
  1138. - It's possible to override the option `files.maxSize`. This option is helpful if you need to process specific files that exceed the default `maxSize`:
  1139. ```json
  1140. {
  1141. "overrides": [{
  1142. "includes": ["dist/**"]
  1143. "files": {
  1144. "maxSize": 20000
  1145. }
  1146. }]
  1147. }
  1148. ```
  1149. - Added the new CLI option called `--threads` to the `ci` command. It allows to control the numbers of threads that can be used when using the Biome CLI.
  1150. It's possible to use the environment variable `BIOME_THREADS` as an alternatives.
  1151. This feature is useful when running the CLI in environments that have limited resources, for example CI/CD.
  1152. ```shell
  1153. biome ci --threads=1
  1154. BIOME_THREADS=1 biome ci
  1155. ```
  1156. - Added the new rule [`useObjectSpread`](https://biomejs.dev/linter/rules/use-object-spread), which prefers object spread syntax over `Object.assign()` when constructing new objects.
  1157. **Example (Invalid): Using Object.assign with an empty object:**
  1158. ```js
  1159. Object.assign({}, foo);
  1160. Object.assign({}, { foo: "bar" });
  1161. ```
  1162. **Example (Invalid): Using Object.assign with object literal as first argument:**
  1163. ```js
  1164. Object.assign({ foo: "bar" }, baz);
  1165. Object.assign({}, baz, { foo: "bar" });
  1166. ```
  1167. **Example (Valid): Using object spread syntax:**
  1168. ```js
  1169. ({ ...foo });
  1170. ({ ...baz, foo: "bar" });
  1171. ```
  1172. **Example (Valid): Modifying existing objects is allowed:**
  1173. ```js
  1174. Object.assign(foo, { bar: baz });
  1175. Object.assign(foo, bar, baz);
  1176. ```
  1177. - Added an option to the `lint` command called `--suppress`. The new option suppresses a violation instead of applying a rule fix. The option accepts a string that is used as _reason_ of the suppression comment.
  1178. When running the following command, it will add the suppression comment:
  1179. ```shell
  1180. biome lint --write --suppress="Migration to Biome"
  1181. ```
  1182. ```js
  1183. debugger;
  1184. foo == bar;
  1185. ```
  1186. ```diff
  1187. + // biome-ignore lint/suspicious/noDebugger: Migration to Biome
  1188. debugger;
  1189. + // biome-ignore lint/suspicious/noDoubleEquals: Migration to Biome
  1190. foo == bar;
  1191. ```
  1192. - Add an `ignoreRestSiblings` option into [`noUnusedVariables`](https://biomejs.dev/linter/rules/no-unused-variables).
  1193. When this option is set to `false`, the rule will **not** ignore variables that created using the rest pattern:
  1194. ```json
  1195. {
  1196. "linter": {
  1197. "rules": {
  1198. "correctness": {
  1199. "noUnusedVariables": {
  1200. "level": "error",
  1201. "options": {
  1202. "ignoreRestSiblings": false
  1203. }
  1204. }
  1205. }
  1206. }
  1207. }
  1208. }
  1209. ```
  1210. ```js
  1211. const { lorem, ...test } = bar; // the variable "test" will trigger the rule
  1212. console.log(lorem);
  1213. ```
  1214. - Upgraded some unsafe fixes to safe fixes.
  1215. The following rules have now a safe fix:
  1216. - [noExtraBooleanCast](https://biomejs.dev/linter/rules/no-extra-boolean-cast)
  1217. - [noNonoctalDecimalEscape](https://biomejs.dev/linter/rules/no-nonoctal-decimal-escape)
  1218. - [noSwitchDeclarations](https://biomejs.dev/linter/rules/no-switch-declarations)
  1219. - [noThisInStatic](https://biomejs.dev/linter/rules/no-this-in-static)
  1220. - [noUnusedTemplateLiteral](https://biomejs.dev/linter/rules/no-unused-template-literal)
  1221. - [noUselessContinue](https://biomejs.dev/linter/rules/no-useless-continue)
  1222. - [noUselessElse](https://biomejs.dev/linter/rules/no-useless-else)
  1223. - [noUselessStringConcat](https://biomejs.dev/linter/rules/no-useless-string-concat)
  1224. - [useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals)
  1225. - [useExponentiationOperator](https://biomejs.dev/linter/rules/use-exponentiation-operator)
  1226. - [useNumberToFixedDigitsArgument](https://biomejs.dev/linter/rules/use-number-to-fixed-digits-argument)
  1227. - [useNumericLiterals](https://biomejs.dev/linter/rules/use-numeric-literals)
  1228. - [useSimplifiedLogicExpression](https://biomejs.dev/linter/rules/use-simplified-logic-expression)
  1229. - Added support for monorepos. The feature will work _out of the box_ for the majority of the users. If your project
  1230. has **nested configuration** files, use the command `biome migrate` from the _root of the project_.
  1231. Monorepo support in Biome is done in a single way. Create a `biome.json` at the root of the project. This configuration
  1232. file is now called the root configuration. Then, each nested configuration file must specify the new field `"root": false`.
  1233. We also introduced a new microsyntax for _extending a nested configuration from the root configuration_, which is `"extends": "//"`. This new syntax means “this config _extends_ from the root config”. When using this microsyntax, you **may omit** the `"root": false` field as it is implied.
  1234. Note that nested configs are not required to extend from the root config, and you can still have independent nested configs, as well as nested configs that extend from other files. In those cases, `"root": false` must be specified explicitly.
  1235. - Added support for formatting `.html` files. The formatting is considered **experimental,** and it's only opt-in via configuration:
  1236. ```json
  1237. {
  1238. "html": {
  1239. "formatter": {
  1240. "enabled": true
  1241. }
  1242. }
  1243. }
  1244. ```
  1245. Biome formatter attempts to format as Prettier, however some default options might differ.
  1246. An option `html.formatter.selfCloseVoidElements` allows to control whether the trailing `/` of [void elements](https://html.spec.whatwg.org/#void-elements) should be printed.
  1247. **By default**, Biome formatter will _remove_ the `/`:
  1248. ```diff
  1249. - <input />
  1250. + <input>
  1251. ```
  1252. If you come from Prettier and you want to keep the same formatting behaviour, you should set the option to `"always"`:
  1253. ```json
  1254. {
  1255. "html": {
  1256. "formatter": {
  1257. "selfCloseVoidElements": "always"
  1258. }
  1259. }
  1260. }
  1261. ```
  1262. ```diff
  1263. - <input>
  1264. + <input />
  1265. ```
  1266. Use to the command `biome migrate prettier` to apply this change automatically.
  1267. - Added an **unsafe** fix to the rule [`useExhaustiveDependencies`](https://biomejs.dev/linter/rules/use-exhaustive-dependencies).
  1268. For example, this violation will provide the following code fix:
  1269. ```js
  1270. import { useEffect } from "react";
  1271. function MyComponent() {
  1272. let a = 1;
  1273. useEffect(() => {}, [a]);
  1274. }
  1275. ```
  1276. ```
  1277. × This hook specifies more dependencies than necessary: a
  1278. 3 │ function MyComponent() {
  1279. 4 │ let a = 1;
  1280. > 5 │ useEffect(() => {}, [a]);
  1281. │ ^^^^^^^^^
  1282. 6 │ }
  1283. 7 │
  1284. i This dependency can be removed from the list.
  1285. 3 │ function MyComponent() {
  1286. 4 │ let a = 1;
  1287. > 5 │ useEffect(() => {}, [a]);
  1288. │ ^
  1289. 6 │ }
  1290. 7 │
  1291. i Unsafe fix: Remove the extra dependencies from the list.
  1292. 5 │ ··useEffect(()·=>·{},·[a]);
  1293. │ -
  1294. ```
  1295. - The rule `useExhaustiveDependencies` now reports a diagnostic when the dependency list is not an array literal.
  1296. - Added the new rule [`useIndexOf`](https://biomejs.dev/linter/rules/use-index-of), based on the unicorn rule [prefer-array-index-of](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-array-index-of.md)
  1297. - Added a new rule [`useExhaustiveSwitchCases`](https://biomejs.dev/linter/rules/use-exhaustive-switch-cases/), which detects any missing cases for switch statements.
  1298. Currently, it supports only literal union types.
  1299. For example:
  1300. ```ts
  1301. type Day =
  1302. | "Monday"
  1303. | "Tuesday"
  1304. | "Wednesday"
  1305. | "Thursday"
  1306. | "Friday"
  1307. | "Saturday"
  1308. | "Sunday";
  1309. const day: Day = "Monday";
  1310. let result = 0;
  1311. switch (day) {
  1312. case "Monday": {
  1313. result = 1;
  1314. break;
  1315. }
  1316. }
  1317. ```
  1318. The switch statement is missing other cases than `'Monday'`, which will cause a runtime error.
  1319. To fix this issue, add missing cases or a default case to the statement.
  1320. - Fixed [#4416](https://github.com/biomejs/biome/pull/4416): The rules [`useExportType`](https://biomejs.dev/linter/rules/use-export-type/) and [`useImportType`](https://biomejs.dev/linter/rules/use-import-type/) now ignore TypeScript declaration files.
  1321. - Added the new rule [`useForComponent`](https://biomejs.dev/linter/rules/use-for-component/).
  1322. This rule enforces usage of Solid's `<For />` component for mapping an array to JSX elements.
  1323. - Added new lint rule [`noShadow`](http://biome.dev/linter/rules/no-shadow), a port of eslint's `no-shadow`.
  1324. This rule disallows variable declarations from shadowing variables declared in an outer scope. For example:
  1325. ```js
  1326. const foo = 1;
  1327. function bar() {
  1328. const foo = 2; // This variable shadows the outer foo
  1329. }
  1330. ```
  1331. - Add `style` option for the [useImportType](https://biomejs.dev/linter/rules/use-import-type/) rule.
  1332. The rule now allows enforcing an import style for importing types.
  1333. See the rule documentation for more details.
  1334. - Added the new rule [`useJsonImportAttribute`](https://biomejs.dev/linter/rules/use-json-import-attribute) to enforce the use of import attributes for JSON modules.
  1335. This rule ensures that all imports of `.json` files include the `with { type: "json" }` assertion, which is required to inform the JavaScript runtime that the imported file should be parsed as JSON.
  1336. ```diff
  1337. - import jsonData from './data.json';
  1338. + import jsonData from './data.json' with { type: "json" };
  1339. ```
  1340. ```diff
  1341. - import jsonData from './data.json' with { someOtherAttribute: "value" };
  1342. + import jsonData from './data.json' with { type: "json", someOtherAttribute: "value" };
  1343. ```
  1344. This rule is based on the proposal in issue [#6043](https://github.com/biomejs/biome/issues/6043).
  1345. - [useLiteralKeys](https://biomejs.dev/linter/rules/use-literal-keys/) now handles numeric keys and is declared as being the same rule as the ESLint [no-useless-computed-key](https://eslint.org/docs/latest/rules/no-useless-computed-key) rule.
  1346. - `useNamingConmvention` now ignores unused variables prefixed with an underscore `_`.
  1347. This avoids conflicts with the unsafe fix of `noUnusedVariables`.
  1348. The following code is now accepted because the variable is unused and prefixed with an underscore.
  1349. ```js
  1350. const _Unknown_Style = 0;
  1351. ```
  1352. - The package now requires `v2` of the WebAssembly packages. The internal APIs of Workspace are now `camelCase`.
  1353. - The rule [useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals/) now provides a code fix.
  1354. ```diff
  1355. - const xs = new Array();
  1356. + const xs = [];
  1357. ```
  1358. The code fix is currently marked as unsafe.
  1359. We plan to make it safe in a future release of Biome.
  1360. - The command `migrate` is now able to migrate nested configuration files.
  1361. - Added the new rule [`noRestrictedElements`](https://biomejs.dev/linter/rules/no-restricted-elements), which prevents use of the specified HTML elements and components.
  1362. - Added the new lint rule [`noAwaitInLoop`](https://biomejs.dev/linter/rules/no-await-in-loop).
  1363. ### Patch Changes
  1364. - Fix [#5001](https://github.com/biomejs/biome/issues/5001), where the CSS formatter removes whitespace from selector preceded by a comment
  1365. - Fixed [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) rule to suggest unsafe fix for unused function declarations.
  1366. - Fixed a false positive of `noUselessEscapeInRegex` where `\k` was reported as useless in non-Unicode regular expressions.
  1367. - Fixed an issue where the ordering of the diagnostics wasn't predictable.
  1368. - Fixed a bug where the environment variable `BIOME_CONFIG_PATH` wasn't correctly picked up.
  1369. - Biome logs a warning in case a folder contains `biome.json` and `biome.jsonc`, and it will use `biome.json` by default.
  1370. - [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/) is now able to bind read of value to a type-only import in ambient contexts ([#4526](https://github.com/biomejs/biome/issues/4526)).
  1371. In the following code, `A` is now correctly bound to the type-only import.
  1372. Previously, `A` was reported as an undeclared variable.
  1373. ```ts
  1374. import type { A } from "mod";
  1375. declare class B extends A {}
  1376. ```
  1377. - Fix [#4317](https://github.com/biomejs/biome/issues/4317), setter parameter can contain a trailing comma, the following example will now parsed correctly:
  1378. ```ts
  1379. export class DummyClass {
  1380. set input(value: string) {}
  1381. }
  1382. ```
  1383. - Fix [#4575](https://github.com/biomejs/biome/issues/4575), don't wrap selector indentation after css comments.
  1384. - Fix [#4258](https://github.com/biomejs/biome/issues/4258), where fixed css parse error with @-moz-document url-prefix().
  1385. - Fixed [#4391](https://github.com/biomejs/biome/issues/4391): Some files from the `.vscode` directory are no longer incorrectly parsed as JSON.
  1386. - The `biome format` command now correctly handles the `--skip-errors` option, allowing it to skip files with syntax errors and continue formatting the remaining valid files.
  1387. When this option is used, skipped syntax errors are reported as information, since the user is already aware of them.
  1388. - `biome migrate eslint` now correctly resolves the scoped package named `eslint-config`.
  1389. - Fixed [#3836](https://github.com/biomejs/biome/issues/3836): The CSS parser will now correctly parse the following:
  1390. ```css
  1391. .foo {
  1392. color: red;
  1393. }
  1394. ```
  1395. - Fixed a bug where the related diagnostics attached to the main diagnostics didn't have a correct message.
  1396. - Fixed `noAccumulatingSpread` not reporting calls to `Object.assign`. The following code will now be reported:
  1397. ```js
  1398. let a = [{ a: 1 }, { b: 2 }];
  1399. a.reduce((acc, val) => Object.assign(acc, val), []);
  1400. ```
  1401. - The `summary` reporter doesn't take `--max-diagnostics` into account anymore.
  1402. - Fixed [#4553](https://github.com/biomejs/biome/issues/4553): `noUselessFragments` will now correctly fix JSX attributes:
  1403. ```jsx
  1404. <Suspense
  1405. fallback={
  1406. <>
  1407. <span>Loading...</span>
  1408. </>
  1409. }
  1410. >
  1411. {children}
  1412. </Suspense>
  1413. ```
  1414. becomes:
  1415. ```jsx
  1416. <Suspense fallback={<span>Loading...</span>}>{children}</Suspense>
  1417. ```
  1418. - Fixed [#4528](https://github.com/biomejs/biome/issues/4528): `biome migrate eslint` now correctly handles shared ESLint configuration that don't follow the ESLint naming convention.
  1419. ESLint recommends that a package that exports a shared configuration be prefixed with `eslint-config-` or simply named `eslint-config`.
  1420. This is only a recommendation.
  1421. Packages that export shared configurations can have arbitrary names.
  1422. Biome is now able to load any package.
  1423. - Fixed [#4993](https://github.com/biomejs/biome/issues/4993): [`useAwait`](https://biomejs.dev/linter/rules/use-await/) now correctly warn on functions with decorator with callback argument.
  1424. - Fixed [#4756](https://github.com/biomejs/biome/issues/4756): `noDuplicateProperties` now throws lint errors properly when we use `@supports`.
  1425. - Fixed [#5981](https://github.com/biomejs/biome/issues/5981), where `noUnknownPseudoClass` didn't take `:global` into consideration when `cssModules` is enabled.
  1426. - Fixed [#2406](https://github.com/biomejs/biome/issues/2406): Biome longer expands properties of object type annotations in the only function parameter to align with Prettier.
  1427. - Fixed [#4740](https://github.com/biomejs/biome/issues/4740): `biome migrate eslint` now correctly handles ESLint configuration with `null` values in file lists.
  1428. - Fixed [#4202](https://github.com/biomejs/biome/issues/4202): Align with Prettier in formatting test functions.
  1429. - Fixed [#342](https://github.com/biomejs/biome/issues/342): The JavaScript parser now properly handles unterminated string literals, such as:
  1430. ```jsx
  1431. function Comp() {
  1432. return (
  1433. <a rel="
  1434. ```
  1435. - Fixed a bug where syntax rules didn't provide an automatic way to suppress the rule. Now the LSP will show supression actions if a syntax rule is violated.
  1436. - Fixed a CSS parser error: `@-moz-document url-prefix(https://example.com)` and `@-moz-document domain(example.com)` are now valid.
  1437. - Fixed [#4967](https://github.com/biomejs/biome/issues/4967): The fix for `useArrowFunction` no longer breaks function bodies starting with `{`.
  1438. - Fixed [#5998](https://github.com/biomejs/biome/issues/5998). The rule `noUnknownPseudoElement` now correctly cheks names
  1439. of pseudo-element functions.
  1440. - Fixed [#5024](https://github.com/biomejs/biome/issues/5024): Added `useJsxKeyInIterable` rule to React domain.
  1441. - Fixed [#5410](https://github.com/biomejs/biome/issues/5410). Biome now correctly parse an `.editorconfig` that includes character classes in glob patterns.
  1442. - Fixed [#2260](https://github.com/biomejs/biome/2260): The LSP server now returns correct text edits for the specified range in `textDocument/rangeFormatting` and `textDocument/onTypeFormatting` requests.
  1443. - [noUnusedVariables](https://biomejs.dev/linter/rules/no-unused-variables/) no longer reports top-level variables in a global declaration file as unused.
  1444. - Type exports now support renaming types to `default`.
  1445. The following code is now parsed successfully:
  1446. ```ts
  1447. export { type A as default } from "./b.ts";
  1448. ```
  1449. - Added proper support for arrow functions in the lint rule https://biomejs.dev/linter/rules/use-explicit-type/
  1450. - The rule [`useNamingConvention`](https://biomejs.dev/linter/rules/use-naming-convention/) no longer suggests renaming top-level variables in a global declaration file.
  1451. - Improved context in error messages when migrating Prettier configurations
  1452. - Allowed single spaces in `useConsistentCurlyBraces` rule.
  1453. - Fixed [#4413](https://github.com/biomejs/biome/issues/4413): The GraphQL formatter no longer adds a new line at the start of block comments on Windows.
  1454. - Fixed [#5407](https://github.com/biomejs/biome/issues/5407). Now the `noUnusedImports` code fix correctly keeps top-level comments that were attached to lone imports.
  1455. - Fixed [#3859](https://github.com/biomejs/biome/issues/3859): the `--skip-parse-errors` option is now applied to commands: `lint`, `check`, and `ci`.
  1456. - The `rage` command now prints the configuration path relative to the working directory, if applicable.
  1457. - Fixed [#5606](https://github.com/biomejs/biome/issues/5606): We now correctly
  1458. handle `.mjs` extensions in Node.js packages with `"type": "commonjs"`.
  1459. - Fixed [#1597](https://github.com/biomejs/biome/issues/1597): `useExhaustiveDependencies` no longer gets confused about the stability of dependencies by parentheses or type assertions.
  1460. - Fixed [#4751](https://github.com/biomejs/biome/issues/4751) by checking fragments inside `JSXElement` and conditional expressions.
  1461. For example, the following two cases will now be reported:
  1462. ```jsx
  1463. <section>
  1464. <>
  1465. <div />
  1466. <div />
  1467. </>
  1468. </section>
  1469. ```
  1470. ```jsx
  1471. showFullName ? <>{fullName}</> : <>{firstName}</>;
  1472. ```
  1473. - The rule `noFallthroughSwitchCase` no longer panics on some incomplete code snippets.
  1474. - Fixed [#5007](https://github.com/biomejs/biome/issues/5007): Resolved false positives in `noMissingVarFunction` for `container-name`.
  1475. - Fixed [#4841](https://github.com/biomejs/biome/issues/4841): Shebang and top leading comments in `.cjs` files are now handled correctly
  1476. **Example: shebang only (keep it as is)**
  1477. ```
  1478. #!/usr/bin/env node
  1479. ```
  1480. **Example: comments only (keep it as is)**
  1481. ```
  1482. // comment
  1483. ```
  1484. **Example: with shebang**
  1485. ```diff
  1486. - #!/usr/bin/env node"use strict";
  1487. + #!/usr/bin/env node
  1488. + "use strict";
  1489. let some_variable = "some value";
  1490. ```
  1491. **Example: with comment**
  1492. ```diff
  1493. - // comment
  1494. - "use strict"; // comment
  1495. + "use strict";
  1496. + // comment
  1497. let some_variable = "some value";
  1498. ```
  1499. **Example: with shebang and comment**
  1500. ```diff
  1501. - #!/usr/bin/env node"use strict";
  1502. - // comment
  1503. + #!/usr/bin/env node
  1504. + "use strict";
  1505. + // comment
  1506. let some_variable = "some value";
  1507. ```
  1508. - Fixes [`useExhaustiveDependencies`](https://biomejs.dev/linter/rules/use-exhaustive-dependencies/) missing dependencies being defined after the hook itself failure.
  1509. Example:
  1510. ```jsx
  1511. import { useState, useEffect } from "react";
  1512. function MyComponent() {
  1513. useEffect(() => {
  1514. console.log(a);
  1515. }, []);
  1516. let a = 1;
  1517. }
  1518. ```
  1519. - Fixed [#4714](https://github.com/biomejs/biome/pull/4714): Suppression comments no longer fail on functions that themselves contain suppression comments.
  1520. This now works correctly:
  1521. ```ts
  1522. // biome-ignore lint/complexity/useArrowFunction: this suppression now works
  1523. const foo0 = function (bar: string) {
  1524. // biome-ignore lint/style/noParameterAssign: even if there are other suppressions inside
  1525. bar = "baz";
  1526. };
  1527. ```
  1528. - Add @vitest/eslint-plugin to list of Biome rule sources
  1529. - Fixed `useHookAtTopLevel` rule to properly detect React components wrapped in `memo` and `forwardRef`, and correctly handle property accessors in control flow analysis.
  1530. The rule now correctly identifies hooks in components like:
  1531. ```js
  1532. const TestMemo = memo(
  1533. forwardRef((props, ref) => {
  1534. useEffect(() => {
  1535. const [test, setTest] = useState(1); // now properly flagged
  1536. }, []);
  1537. return <div ref={ref}>test</div>;
  1538. }),
  1539. );
  1540. ```
  1541. And properly handles property accessors:
  1542. ```js
  1543. function ReactComponent() {
  1544. const testObj = {
  1545. get print() {
  1546. return "hello"; // no longer considered component return
  1547. },
  1548. };
  1549. const callback = useCallback(() => {}, []);
  1550. return <></>;
  1551. }
  1552. ```
  1553. - [noMisleadingCharacterClass](https://biomejs.dev/linter/rules/no-misleading-character-class/) no longer panics on malformed escape sequences that end with a multi-byte character ([#4587](https://github.com/biomejs/biome/issues/4587)).
  1554. - Fixed the flag `--bracket-spacing` that was duplicated between the global configuration and the language-specific override for JavaScript.
  1555. - Fixed [#4715](https://github.com/biomejs/biome/issues/4715): The `useJsxKeyInIterable` rule now reports missing keys inside `switch` and `if` statements.
  1556. ```jsx
  1557. const data = [
  1558. { value: "a", type: "string" },
  1559. { value: 9, type: "number" },
  1560. { value: "c", type: "string" },
  1561. ];
  1562. const MyComponent = () => {
  1563. return (
  1564. <>
  1565. {/* if statements */}
  1566. {data.map((x) => {
  1567. if (x.type === "string") {
  1568. return <div>{x.value}</div>; // no key, emits diagnostic
  1569. } else {
  1570. return <div>{x.value}</div>; // no key, emits diagnostic
  1571. }
  1572. })}
  1573. {/* switch statements */}
  1574. {data.map((x) => {
  1575. switch (x.type) {
  1576. case "string":
  1577. return <div>{x.value}</div>; // no key, emits diagnostic
  1578. case "number":
  1579. return <div>{x.value}</div>; // no key, emits diagnostic
  1580. default:
  1581. return <div key={x.value}>{x.value}</div>;
  1582. }
  1583. })}
  1584. </>
  1585. );
  1586. };
  1587. ```
  1588. - Fixed [#4121](https://github.com/biomejs/biome/issues/4326): The CSS formatter no longer indents a selector when it has leading comments.
  1589. - Fixed an issue where react lint rules could panic Biome when some incorrect code was analyzed.
  1590. - Fixed [#4982](https://github.com/biomejs/biome/issues/4982): the JavaScript parser now throws a syntax error for the following code:
  1591. ```ts
  1592. type T = import;
  1593. type U = typeof import;
  1594. ```
  1595. - Fixed a bug with the `--verbose` CLI flag. Now the printed paths are **relative** to the working directory.
  1596. - Fixed [`noNoninteractiveElementToInteractiveRole`](https://biomejs.dev/linter/rules/no-noninteractive-element-to-interactive-role/) mistakenly flagging `<li role="treeitem">`,
  1597. - Fixed [#4622](https://github.com/biomejs/biome/issues/4622): Our JavaScript parser can now gracefully handle situations where we detect the parser to have stalled.
  1598. This means we don't fail with an assertion anymore, but invalid code can trigger a regular diagnostic in such cases.
  1599. - Fixed [#342](https://github.com/biomejs/biome/issues/342): The JavaScript parser now correctly handles invalid object member names, such as:
  1600. ```js
  1601. ({
  1602. params: { [paramName: string]: number } = {}
  1603. })
  1604. ```
  1605. - Fixed [#6211](https://github.com/biomejs/biome/issues/6211): previously the
  1606. import organizer emitted broken code when it merged an import at the start of
  1607. the file with another import and placed the merged result after a third import.
  1608. The following code is now correctly organized:
  1609. ```diff
  1610. - import { B } from "bc";
  1611. - import { C } from "bc";
  1612. import { A } from "a";
  1613. + import { B, C } from "bc";
  1614. ```
  1615. - Fixed [#4334](https://github.com/biomejs/biome/issues/4334): The formatter no longer inserts trailing a comma inside dynamic `import` expressions.
  1616. - Fixed [#5629](https://github.com/biomejs/biome/issues/5629): useHookAtTopLevel no longer report false-positives where the hook is at the top-level in a class method.
  1617. - Fixed [#5900](https://github.com/biomejs/biome/issues/5900): `biome migrate eslint` now support a nested `files` property in ESLint flat configs.
  1618. - Fixed [#3895](https://github.com/biomejs/biome/issues/3895): [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports/) no longer reports used values imported as types in an external module.
  1619. - Fixed a case where the code fix for `noUselessFragments` would remove more than just the fragment.
  1620. - Fixed [#5919](https://github.com/biomejs/biome/issues/5919). Now Biome correctly loads the configuration passed via `--config-path` when its path starts with `./` e.g. `--confi-path=./project/biome.json`
  1621. - Fixed [#5031](https://github.com/biomejs/biome/issues/5031): CSS formatting has been improved for numbers:
  1622. ```diff
  1623. .class {
  1624. - padding: .5em;
  1625. - marding: 1.0;
  1626. + padding: 0.5em;
  1627. + marding: 1;
  1628. }
  1629. ```
  1630. - Fixed [#5989](https://github.com/biomejs/biome/issues/5989) where large octal escape sequences led to an overflow.
  1631. - Implement improved error handling for the supports at rule
  1632. - Fix [#5053](https://github.com/biomejs/biome/issues/5053), now the rule correctly handles `console.log` inside arrow function expressions.
  1633. - Fix [#6105](https://github.com/biomejs/biome/issues/6105): css lint rules `useSortedProperties` should skip unknown properties.
  1634. - Fixed [#3229](https://github.com/biomejs/biome/issues/3229): Made formatting of compound selectors more consistent.
  1635. - Fixed a bug where passing `--max-diagnostics=0` would return a zero code even when errors were emitted.
  1636. - Fixed a bug where Biome didn't report any error when `--stdin-file-path` didn't have any extension.
  1637. Now Biome returns an error if `--stdin-file-path` doesn't have an extension.
  1638. - Fixed [#5601](https://github.com/biomejs/biome/issues/5601): The [`useSortedClasses`](https://biomejs.dev/linter/rules/use-sorted-classes/) rule now properly preserves the original JSX quote style when sorting utility classes, preventing syntax errors.
  1639. - The fix for `useSelfClosingElements` was marked as safe and the error message was improved.
  1640. - Fixed overrides that include language-specific settings from having an effect for some languages
  1641. - Fixed [#6144](https://github.com/biomejs/biome/issues/6144): [noUnusedImports](https://biomejs.dev/linter/rules/no-unused-imports/) reported incorrectly imports that were used as the type of parameters with the same name.
  1642. In the following code, the import `name` was reported as unused.
  1643. ```ts
  1644. import name from "mod";
  1645. function f(name: name.Readable): void {}
  1646. ```
  1647. - The lint rules [`useNamingConvention`](https://biomejs.dev/linter/rules/use-naming-convention/) and [`useFilenamingConvention`](https://biomejs.dev/linter/rules/use-filenaming-convention/) now accept character escapes at the start of a regex group.
  1648. Both these rules provide options that allow matching names against a regular expression.
  1649. Previously, an escaped character at the start of a regex group reported an error. They are now accepted.
  1650. For example, the following configuration is now valid doesn't emit an error anymore.
  1651. ```json
  1652. {
  1653. "linter": {
  1654. "rules": {
  1655. "style": {
  1656. "useNamingConvention": {
  1657. "level": "on",
  1658. "options": {
  1659. "conventions": [
  1660. {
  1661. "selector": {
  1662. "kind": "let"
  1663. },
  1664. "match": "(\\n.*)"
  1665. }
  1666. ]
  1667. }
  1668. }
  1669. }
  1670. }
  1671. }
  1672. }
  1673. ```
  1674. - Fixed [#5617](https://github.com/biomejs/biome/issues/5617): [noDuplicateObjectKeys](https://biomejs.dev/linter/rules/no-duplicate-object-keys/) now transfers the leading comments of the removed member.
  1675. - Fixed [#5409](https://github.com/biomejs/biome/issues/5409): [noParameterAssign](https://biomejs.dev/linter/rules/no-parameter-assign) now reports reassigned parameter of unparenthesized arrow functions.
  1676. The following code is now reported as invalid.
  1677. ```js
  1678. const f = (param) => {
  1679. param = {}; // Reassigning a function parameter is confusing.
  1680. };
  1681. ```
  1682. - Fixed [#4875](https://github.com/biomejs/biome/issues/4875): Relative file paths are now clickable in the Jetbrains IDE terminal.
  1683. - Fixed [#4719](https://github.com/biomejs/biome/issues/4719): `bracketSameLine` now performs as expected when a comment is placed before the last JSX attribute.
  1684. - Fixed [#4564](https://github.com/biomejs/biome/issues/4564): Biome no longer panics when a multi-byte character is found in a unicode escape sequence.
  1685. - Fixed [#4950](https://github.com/biomejs/biome/issues/4950): Resolved a false positive of character class range operators in regular expressions.
  1686. - Fixed handling of top-level variables by `useExplicitType` rule ([#5932](https://github.com/biomejs/biome/issues/5932)). Biome now allows all variables with explicit annotations, as well as variables with trivial RHS. Biome no longer emits duplicated errors when an untyped function is assigned to an untyped variable.
  1687. - Fixed [#4947](https://github.com/biomejs/biome/issues/4947): The `useTemplate` lint rule now ignores concatenated literals folded to multiple lines.
  1688. - Fixed [#4568](https://github.com/biomejs/biome/issues/4568): Broken import statements no longer can cause a panic in `useExhaustiveDependencies`.
  1689. - Fixed [#6042](https://github.com/biomejs/biome/pull/6042): [`noUselessEscapeInString`](https://next.biomejs.dev/linter/rules/no-useless-escape-in-string/) now reports useless escapes after skipping \${ in template literals.
  1690. - Fixed [#6229](https://github.com/biomejs/biome/issues/6229) where the fix of `noUnusedImports` emitted an invalid syntax. Now the following case emits a code fix that is syntactically correct:
  1691. ```js
  1692. import Used, { NotUsed } from "foo";
  1693. Used();
  1694. ```
  1695. - Fix [#5682](https://github.com/biomejs/biome/issues/5682): Object patterns with a nested assignment pattern no longer break properties.
  1696. For example, the following code:
  1697. ```js
  1698. const { foo: { bar } = { bar: false } } = props;
  1699. ```
  1700. is used to be formatted into:
  1701. ```js
  1702. const { foo: { bar } = { bar: false } } = props;
  1703. ```
  1704. , while Prettier does not expand properties in this case.
  1705. - Fixed #5620, [noConsole](https://biomejs.dev/linter/rules/no-console/) rule now correctly handles indirect `console.log` calls and references.
  1706. - When pulling code actions from the LSP, now the first choice suggested by the client will be the safe fix.
  1707. - Fixed [#6022](https://github.com/biomejs/biome/issues/6022), now the rule `noDuplicateProperties` does't trigger properties defined inside the `@keyframes` at rule
  1708. - Enhanced the error message of the diagnostics emitted when Biome can't parse a suppression comment.
  1709. - Fixed link to the docs inside CLI markup
  1710. - Fixed a bug where a suppression comment with an empty explanation was valid.
  1711. Now a suppression comment `// biome-ignore lint:` will raise a **warning** diagnostic.
  1712. - Fixed [#4026](https://github.com/biomejs/biome/issues/4026): Comments in `grid-template` are no longer moved by the formatter.
  1713. - Fixed [#3394](https://github.com/biomejs/biome/issues/3394): Resolved a false positive in `useSortedClasses`.
  1714. - Fixed [#342](https://github.com/biomejs/biome/issues/342) and [#4562](https://github.com/biomejs/biome/issues/4562): Biome no longer crashes when a `declare` statement is followed by an unexpected token.
  1715. - Fixed false positive in the rule [`noUnknownFunction`](https://biomejs.dev/linter/rules/no-unknown-function) where the [`tech`](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#tech) function was incorrectly flagged as an unknown function.
  1716. - Fixed [#4511](https://github.com/biomejs/biome/issues/4511): [noLabelWithoutControl](https://biomejs.dev/linter/rules/no-label-without-control/) now detects `<button>` tags as input.
  1717. - Fixed [#6039](https://github.com/biomejs/biome/issues/6039): [`noUselessEscapeInString`](https://next.biomejs.dev/linter/rules/no-useless-escape-in-string/) no longer reports `\${` escape in template literals.
  1718. - Fixed [#5985](https://github.com/biomejs/biome/issues/5985), which caused the import organizer to fail the merging of a default import with a named import.
  1719. The following code is now correctly organized:
  1720. ```diff
  1721. - import moment from 'moment';
  1722. - import { Moment } from 'moment';
  1723. + import moment, { Moment } from 'moment';
  1724. ```
  1725. - Fixed an issue where the `explain` command didn't the diagnostic category when a rule was explained.
  1726. - Improved the diagnostic of the rule `noUnusedVariables`. The rule message now provides the name of the unused binding.
  1727. - Added `RegExpStringIterator` to the analyzer globals.
  1728. - Fixed [#4208](https://github.com/biomejs/biome/issues/4208): [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/) now handles `JsxAttributeInitializerClause`, ensuring that fragments inside expressions like `<A b=<></> />` are preserved.
  1729. - Fixed [#4533](https://github.com/biomejs/biome/issues/4533): `noUnknownPseudoClass` no longer reports pseudo classes after a webkit scrollbar pseudo element.
  1730. The following code will no longer report a diagnostic:
  1731. ```css
  1732. ::-webkit-scrollbar-thumb:hover {
  1733. }
  1734. ```
  1735. - Updates the [`useJsxKeyInIterable`](https://biomejs.dev/linter/rules/use-jsx-key-in-iterable/) rule to more closely match the behavior of the ESLint plugin (e.g. mark the whole fragment as incorrect when no key is present). This also adds the option to check shorthand fragments (`<></>`)
  1736. - Renamed the rule `noDuplicatedFields` to `noDuplicateFields`. Run the command `biome migrate` to update your configuration.
  1737. - Fixed an issue where ignored files were incorrectly tracked by the Daemon.
  1738. - Fixed [#5116](https://github.com/biomejs/biome/issues/5116): [noUnknownPseudoElement](https://biomejs.dev/linter/rules/no-unknown-pseudo-element/) now supports `::slotted`.
  1739. - Fixed [#5979](https://github.com/biomejs/biome/issues/5979): `biome search` now correctly skips files that don't match the pattern's target language.
  1740. - Fixed [#4323](https://github.com/biomejs/biome/issues/4258): Fixed the case where `useSemanticElement` accidentally showed recommendations for `role="searchbox"` instead of `role="search"`.
  1741. - Support setting `indent_size` to `tab` in `.editorconfig`, the following config will not cause error:
  1742. ```editorconfig
  1743. root = true
  1744. [*]
  1745. indent_size = tab
  1746. ```
  1747. - Fixed [#4565](https://github.com/biomejs/biome/issues/4565): [noControlCharactersInRegex](https://biomejs.dev/linter/rules/no-control-characters-in-regex) no longer panics when it encounters an unterminated unicode escape sequence.
  1748. - Fixed [#5770](https://github.com/biomejs/biome/issues/5770), Biome's configuration file is now respected by the `migrate` command during migration
  1749. - Fixed an issue where the lexer didn't report errors for unterminated regex or string literals, such as the following cases:
  1750. ```js
  1751. "string
  1752. 'str
  1753. /\\217483
  1754. ```
  1755. - The [`useKeyWithClickEvents`](https://biomejs.dev/linter/rules/use-key-with-click-events/) rule has been improved with better support for ARIA roles.
  1756. Key improvements:
  1757. 1. **Accessibility checks**:
  1758. Now the rule correctly handles the following cases:
  1759. - If an element is hidden from screen readers
  1760. - If an element has the presentation role
  1761. - If an element is interactive
  1762. ```jsx
  1763. // No errors
  1764. <div aria-hidden="true" onClick={() => {}} /> // hidden from screen reader
  1765. <div role="presentation" onClick={() => {}} /> // presentation role
  1766. <button onClick={() => {}} /> // interactive role
  1767. ```
  1768. This change ensures the rule is more accurate and helpful.
  1769. 2. **Checks spread syntax**:
  1770. Spread syntax used to be ignored, but has been changed to be pointed out for more stringent checking.
  1771. ```jsx
  1772. // Errors
  1773. <div {...props} onClick={() => {}} />
  1774. // No errors
  1775. <div {...props} onClick={() => {}} onKeyDown={foo} />;
  1776. ```
  1777. 3. **Refactor**:
  1778. Now the rule uses the aria roles to determine if an element is interactive.
  1779. The changes shown here are meant to be closer to the original [jsx-eslint's `click-events-have-key-events` rule](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/main/docs/rules/click-events-have-key-events.md).
  1780. - Fixed [#6029](https://github.com/biomejs/biome/issues/6029): A new line before the semicolon in the previous statement is now kept after formatting.
  1781. For example, the following code:
  1782. ```js
  1783. const foo = 3;
  1784. [1, 2, 3].map((x) => x * 2);
  1785. ```
  1786. when `javascript.formatter.semicolons` is `always`, it becomes:
  1787. ```js
  1788. const foo = 3;
  1789. [1, 2, 3].map((x) => x * 2);
  1790. ```
  1791. when `javascript.formatter.semicolons` is `asNeeded`, the original code is considered as already formatted.
  1792. - [useArrayLiterals](https://biomejs.dev/linter/rules/use-array-literals/) now reports all expressions using the `Array` constructors.
  1793. Previously, the rule reported only use of the `Array` constructor in expressions statements.
  1794. ```js
  1795. // This was reported
  1796. new Array();
  1797. // This was not reported
  1798. const xs = new Array();
  1799. ```
  1800. - Improved error handling for the container at-rule.
  1801. - Fixed [#4665](https://github.com/biomejs/biome/issues/4665): the LSP previously
  1802. identified `.cjs` files as ESM files, making rules like `noRedundantUseStrict`
  1803. reports incorrectly valid `"use strict"` directives.
  1804. - Fixed [#5382](https://github.com/biomejs/biome/issues/5382): `useExportType` no longer reports an identifier that bound by both a variable and a type.
  1805. - Fixed [#5826](https://github.com/biomejs/biome/issues/5826): [`useNumericSeparators`](https://next.biomejs.dev/linter/rules/use-numeric-separators/) no longer reports single-digit `0`.
  1806. - Fixed [#5307](https://github.com/biomejs/biome/issues/5307), where CSS value lists were wrapped in a way that did not preserve semantic structure.
  1807. Biome now ensures that CSS value lists follow a more readable format, aligning with Prettier's behavior.
  1808. Before:
  1809. ```css
  1810. * {
  1811. box-shadow:
  1812. 0 0 0 1px #fff,
  1813. 0 0 0 3.2px rgba(89, 89, 235, 0.25),
  1814. 0 0 0 3.2px rgba(89, 89, 235, 0.25),
  1815. 0 0 0 3.2px red,
  1816. 0 0 0 3.2px rgba(89, 89, 235, 0.25);
  1817. }
  1818. ```
  1819. After:
  1820. ```css
  1821. * {
  1822. box-shadow:
  1823. 0 0 0 1px #fff,
  1824. 0 0 0 3.2px rgba(89, 89, 235, 0.25),
  1825. 0 0 0 3.2px rgba(89, 89, 235, 0.25),
  1826. 0 0 0 3.2px red,
  1827. 0 0 0 3.2px rgba(89, 89, 235, 0.25);
  1828. }
  1829. ```
  1830. - `tsconfig.*.json` files will now be treated the same as `tsconfig.json` files.
  1831. - The `summary` reporter now prints the files processed and the files fixed when passing the `--verbose` flag.
  1832. - Fixed [#5693](https://github.com/biomejs/biome/issues/5693): [`useRegexLiterals`](https://biomejs.dev/linter/rules/use-regex-literals/) now correctly handle useless escaped character in string literals.
  1833. - [useRegexLiterals](https://biomejs.dev/linter/rules/use-regex-literals) now suggests a correct fix when the pattern contains an escaped anti-slash `\/`.
  1834. Previously the rule suggested the following fix that led to a syntax error:
  1835. ```diff
  1836. - new RegExp("\/");
  1837. + /\\//
  1838. ```
  1839. The rule now suggests a correct fix:
  1840. ```diff
  1841. - new RegExp("\/");
  1842. + /\//
  1843. ```
  1844. Fixed [#5487](https://github.com/biomejs/biome/issues/5487).
  1845. - Fixed [`useConsistentCurlyBraces breaks react/no-unescaped-entities rule`](https://github.com/biomejs/biome/issues/5391)
  1846. Added a check for forbidden characters: `>`, `"`, `'` and `}`.
  1847. If any of these characters are detected, curly braces will be preserved.
  1848. Example:
  1849. ```jsx
  1850. function MyComponent() {
  1851. return <Foo>Jupiter {">"} Venus</Foo>;
  1852. }
  1853. ```
  1854. - The rule [`useNamingConvention`](https://biomejs.dev/linter/rules/use-naming-convention/) now suggests a rename that preserves uppercase if possible.
  1855. For instance, Biome suggested renaming `HTMLWrapper` as `htmlWrapper`:
  1856. ```diff
  1857. - import HTMLWrapper from "HTMLWrapper.tsx";
  1858. + import htmlWrapper from "HTMLWrapper.tsx";
  1859. function component() {
  1860. - return <HTMLWrapper> </HTMLWrapper>;
  1861. + return <htmlWrapper> </HTMLWrapper>;
  1862. }
  1863. ```
  1864. Since both `PascalCase` and `CamelCase` are accepted, Biome now suggests renaming `HTMLWrapper` as `HtmlWrapper`:
  1865. ```diff
  1866. - import HTMLWrapper from "HTMLWrapper.tsx";
  1867. + import HtmlWrapper from "HTMLWrapper.tsx";
  1868. function component() {
  1869. - return <HTMLWrapper> </HTMLWrapper>;
  1870. + return <HtmlWrapper> </HTMLWrapper>;
  1871. }
  1872. ```
  1873. - Fix a parsing error when a `JsxElementName` is `JsxMemberExpression`, and a `JsLogicalExpreesion` before it without a semicolon.
  1874. The following case will now not throw error:
  1875. ```jsx
  1876. import React from "react";
  1877. let b = 0;
  1878. function A() {
  1879. const a = b > 0 && b < 1;
  1880. return <React.Fragment>{a}</React.Fragment>;
  1881. }
  1882. ```
  1883. - Fixed Biome being unable to parse `insert_final_newline = unset` in EditorConfig files.
  1884. - Fixed [#4530](https://github.com/biomejs/biome/issues/4530): [useArrowFunction](https://biomejs.dev/linter/rules/use-arrow-function/) now preserves directives.
  1885. Previously the rule removed the directives when a function expression was turned into an arrow function.
  1886. The rule now correctly keeps the directives.
  1887. ```diff
  1888. - const withDirective = function () {
  1889. + const withDirective = () => {
  1890. "use server";
  1891. return 0;
  1892. }
  1893. ```
  1894. - Fixed [#4855](https://github.com/biomejs/biome/issues/4855): [useSortedClasses](https://biomejs.dev/linter/rules/use-sorted-classes/) now suggests code fixes that match the JSX quote style of the formatter.

auf github ansehenimported 2026-09-28 über npm