Changelog
Biome changelog
Section titled Biome changelogThis project follows Semantic Versioning. Due to the nature of Biome as a toolchain, it can be unclear what changes are considered major, minor, or patch. Read our guidelines to categorize a change.
New entries must be placed in a section entitled Unreleased.
Read
our guidelines for writing a good changelog entry.
Ureleased
Section titled UreleasedAnalyzer
Section titled AnalyzerConfiguration
Section titled ConfigurationBug fixes
Section titled Bug fixes- Fix enabled rules calculation. The precendence of individual rules,
allandrecommendpresets in top-level and group-level configs is now correctly respected. More details can be seen in (#2072) (#2028). Contributed by @Sec-ant
Editors
Section titled EditorsFormatter
Section titled FormatterJavaScript APIs
Section titled JavaScript APIsLinter
Section titled LinterParser
Section titled Parser1.6.1 (2024-03-12)
Section titled 1.6.1 (2024-03-12)Bug fixes
Section titled Bug fixes- CLI is now able to automatically search and resolve
biome.jsonc(#2008). Contributed by @Sec-ant - Fix a false positive where some files were counted as “fixed” even though they weren’t modified. Contributed by @ematipico
Configuration
Section titled ConfigurationBug fixes
Section titled Bug fixesjson.formatter.trailingCommasoption now works inoverrides(#2009). Contributed by @Sec-ant
Linter
Section titled LinterNew features
Section titled New features-
Add rule noDoneCallback, this rule checks the function parameter of hooks & tests for use of the done argument, suggesting you return a promise instead. Contributed by @vasucp1207
beforeEach(done => {// ...});
Bug fixes
Section titled Bug fixes-
useJsxKeyInIterable now recognizes function bodies wrapped in parentheses (#2011). Contributed by @Sec-ant
-
useShorthandFunctionType now preserves type parameters of generic interfaces when applying fixes (#2015). Contributed by @Sec-ant
-
Code fixes of useImportType and useExportType now handle multiline statements (#2041). Contributed by @Conaclos
-
noRedeclare no longer reports type parameter and parameter with identical names (#1992).
The following code is no longer reported:
function f<a>(a: a) {}Contributed by @Conaclos
-
noRedeclare now reports duplicate type parameters in a same declaration.
The following type parameters are now reported as a redeclaraion:
function f<T, T>() {}Contributed by @Conaclos
-
noUndeclaredDependencies now recognizes imports of subpath exports.
E.g., the following import statements no longer report errors if
@mui/materialandtailwindcssare installed as dependencies:import Button from "@mui/material/Button";import { fontFamily } from "tailwindcss/defaultTheme";Contributed by @Sec-ant
Parser
Section titled ParserBug fixes
Section titled Bug fixes-
JavaScript lexer is now able to lex regular expression literals with escaped non-ascii chars (#1941).
Contributed by @Sec-ant
1.6.0 (2024-03-08)
Section titled 1.6.0 (2024-03-08)Analyzer
Section titled AnalyzerNew features
Section titled New features-
Add partial for
.astrofiles. Biome is able to sort imports inside the frontmatter of the Astro files. Contributed by @ematipico---import { getLocale } from "astro:i18n";import { Code } from "astro:components";import { Code } from "astro:components";import { getLocale } from "astro:i18n";---<div></div> -
Add partial for
.vuefiles. Biome is able to sort imports inside the script block of Vue files. Contributed by @nhedger<script setup lang="ts">import Button from "./components/Button.vue";import * as vueUse from "vue-use";import * as vueUse from "vue-use";import Button from "./components/Button.vue";</script/><template></template> -
Add partial for
.sveltefiles. Biome is able to sort imports inside the script block of Svelte files. Contributed by @ematipico<script setup lang="ts">import Button from "./components/Button.svelte";import * as svelteUse from "svelte-use";import * as svelteUse from "svelte-use";import Button from "./components/Button.svelte";</script/><div></div> -
Add lint rule useJsxKeyInIterable from Eslint rule
react/jsx-key. Contributed by @vohoanglong0107 -
The analyzer now infers the correct quote from
javascript.formatter.quoteStyle, if set. This means that code fixes suggested by the analyzer will use the same quote of the formatter. Contributed by @ematipico
Enhancements
Section titled Enhancements-
noUnusedVariables ignores unused rest spread silbings.
The following code is now valid:
const { a, ...rest } = { a: 0, b: 1 };console.log(rest);Contributed by @ah-yu
-
Fix #1931. Built-in React hooks such as
useEffect()can now be validated by theuseExhaustiveDependendies, even when they’re not being imported from the React library. To do so, simply configure them like any other user-provided hooks.Contributed by @arendjr
-
Implemented #1128. User-provided React hooks can now be configured to track stable results. For example:
"useExhaustiveDependencies": {"level": "error","options": {"hooks": [{"name": "useMyState","stableResult": [1]}]}}This will allow the following to be validated:
const [myState, setMyState] = useMyState();const toggleMyState = useCallback(() => {setMyState(!myState);}, [myState]); // Only `myState` needs to be specified here.Contributed by @arendjr
Bug fixes
Section titled Bug fixes-
Fix #1748. Now for the following case we won’t provide an unsafe fix for the
noNonNullAssertionrule:x[y.z!];Contributed by @ah-yu
-
Imports that contain the protocol
:are now sorted after thenpm:modules, and before theURLmodules. Contributed by @ematipicoimport express from "npm:express";import Component from "./component.js"import { sortBy } from "virtual:utils";import { sortBy } from "virtual:utils";import Component from "./component.js" -
Fix #1081. The
useAwaitrule does not reportfor await...of. Contributed by @unvalley -
Fix #1827 by properly analyzing nested
try-finallystatements. Contributed by @ah-yu -
Fix #1924 Use the correct export name to sort in the import clause. Contributed by @ah-yu
-
Fix #1805 fix formatting arrow function which has conditional expression body Contributed by @mdm317
-
Fix #1781 by avoiding the retrieval of the entire static member expression for the reference if the static member expression does not start with the reference. Contributed by @ah-yu
New features
Section titled New features-
Add a new command
biome migrate prettier. The command will read the file.prettierrc/prettier.jsonand.prettierignoreand map its configuration to Biome’s one. Due to the different nature of.prettierignoreglobs and Biome’s globs, it’s highly advised to make sure that those still work under Biome. -
Now the file name printed in the diagnostics is clickable. If you run the CLI from your editor, you can Ctrl/⌘ + Click on the file name, and the editor will open said file. If row and columns are specified e.g.
file.js:32:7, the editor will set the cursor right in that position. Contributed by @ematipico -
Add an option
--lintertobiome rage. The option needs to check Biome linter configuration. Contributed by @seitarof -
Add an option
--formattertobiome rage. The option needs to check Biome formatter configuration. Contributed by @seitarof -
The CLI now consistently reports the number of files tha were changed, out of the total files that were analysed. Contributed by @ematipico
-
The CLI now consistently shows the number of errors and warnings emitted. Contributed by @ematipico
Bug fixes
Section titled Bug fixes-
Don’t process files under an ignored directory.
Previously, Biome processed all files in the traversed hierarchy, even the files under an ignored directory. Now, it completely skips the content of ignored directories.
For now, directories cannot be ignored using
files.includein the configuration file. This is a known limitation that we want to address in a future release.For instance, if you have a project with a folder
srcand a foldertest, the following configuration doesn’t completely ignoretest.{"files": {"include": ["src"]}}Biome will traverse
test, however all files of the directory are correctly ignored. This can result in file system errors, if Biome encounters dangling symbolic links or files with higher permissions.To avoid traversing the
testdirectory, you should ignore the directory usingignore:{"files": {"include": ["src"],"ignore": ["test"]}} -
Fix #1508 by excluding deleted files from being processed. Contributed by @ematipico
-
Fix #1173. Fix the formatting of a single instruction with commented in a control flow body to ensure consistency. Contributed by @mdm317
-
Fix overriding of
javascript.globals. Contributed by @arendjr -
Fix a bug where syntax rules weren’t run when pulling the diagnostics. Now Biome will emit more parsing diagnostics, e.g.
check.js:1:17 parse/noDuplicatePrivateClassMembers ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━× Duplicate private class member "#foo"> 1 │ class A { #foo; #foo }│ ^^^^Contributed by @ematipico
-
Fix #1774 by taking into account the option
--no-errors-on-unmatchedwhen running the CLI using--changed. Contributed by @antogyn
Enhancements
Section titled Enhancements-
Removed a superfluous diagnostic that was printed during the linting/check phase of a file:
test.js check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━× The file contains diagnostics that needs to be addressed.Contributed by @ematipico
-
The command
formatnow emits parsing diagnostics if there are any, and it will terminate with a non-zero exit code. Contributed by @ematipico
Configuration
Section titled ConfigurationNew features
Section titled New features-
Add the ability to resolve the configuration files defined inside
extendsfrom thenode_modules/directory.If you want to resolve a configuration file that matches the specifier
@org/configs/biome, then yourpackage.jsonfile must look this:{"name": "@org/configs","exports": {"./biome": "./biome.json"}}And the
biome.jsonfile that “imports” said configuration, will look like this:{"extends": "@org/configs/biome"}Read the documentation to better understand how it works, expectations and restrictions.
Editors
Section titled EditorsBug fixes
Section titled Bug fixes- Fix a regression where ignored files where formatted in the editor. Contributed by @ematipico
- Fix a bug where syntax rules weren’t run when pulling the diagnostics. Now Biome will emit more parsing diagnostics,
e.g.
Contributed by @ematipicocheck.js:1:17 parse/noDuplicatePrivateClassMembers ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━× Duplicate private class member "#foo"> 1 │ class A { #foo; #foo }│ ^^^^
Formatter
Section titled FormatterNew features
Section titled New features-
Biome now allows to format the
package.jsonfile. This is now the default behaviour and users can remove their workarounds. If you rely on other tools to formatpackage.json, you’ll have to ignore it via configuration. Contributed by @pattrickrice -
New formatter option
attributePositionthat have similar behavior as PrettiersingleAttributePerLine#1706. Contributed by @octoshikari -
Add partial for
.astrofiles. Biome is able to format the frontmatter of the Astro files. Contributed by @ematipico---statement ( );statement();---<div></div> -
Add partial for
.vuefiles. Biome is able to format the script block of Vue files. Contributed by @nhedger<script setup lang="ts">statement ( );statement();</script/><template></template> -
Add partial for
.sveltefiles. Biome is able to format the script block of Svelte files. Contributed by @ematipico<script setup lang="ts">statement ( );statement();</script/><div></div>
Enhancements
Section titled Enhancements-
composer.json,deno.json,jsconfig.json,package.jsonandtsconfig.jsonare no longer protected files.This means that you can now format them.
If you want to ignore these files, you can use the files.ignore configuration:
{"files": {"ignore": ["composer.json","jsconfig.json","package.json","tsconfig.json","typescript.json","deno.json","deno.jsonc"]}}The following files are still protected, and thus ignored:
composer.locknpm-shrinkwrap.jsonpackage-lock.jsonyarn.lock
Contributed by @pattrickrice and @Conaclos
Bug fixes
Section titled Bug fixes-
Fix #1039. Check unicode width instead of number of bytes when checking if regex expression is a simple argument.
This no longer breaks.
s(/🚀🚀/).s().s();Contributed by @kalleep
-
Fix #1218, by correctly preserving empty lines in member chains. Contributed by @ah-yu
-
Fix #1659 and #1662, by correctly taking into account the leading comma inside the formatter options. Contributed by @ematipico
-
Fix #1934. Fix invalid formatting of long arrow function for AsNeeded arrow parens Contributed by @fireairforce
JavaScript APIs
Section titled JavaScript APIsLinter
Section titled LinterPromoted rules
Section titled Promoted rulesNew rules are incubated in the nursery group. Once stable, we promote them to a stable group. The following rules are promoted:
- complexity/noEmptyTypeParameters
- complexity/noUselessLoneBlockStatements
- correctness/noInvalidUseBeforeDeclaration
- correctness/noUnusedImports
- correctness/noUnusedPrivateClassMembers
- security/noGlobalEval
- style/useConsistentArrayType
- style/useExportType
- style/useFilenamingConvention
- style/useForOf
- style/useImportType
- style/useNodejsImportProtocol
- style/useNumberNamespace
- style/useShorthandFunctionType
- suspicious/noEmptyBlockStatements
- suspicious/noGlobalAssign
- suspicious/noMisleadingCharacterClass
- suspicious/noThenProperty
- suspicious/useAwait
Additionally, the following rules are now recommended:
Removed rules
Section titled Removed rules-
Remove
nursery/useGroupedTypeImport. The rule style/useImportType covers the behavior of this rule.Note that removing a nursery rule is not considered a breaking change according to our semantic versioning.
Contributed by @Conaclos
New features
Section titled New features-
Add the rule noSkippedTests, to disallow skipped tests:
describe.skip("test", () => {});it.skip("test", () => {});Contributed by @ematipico
-
Add the rule noFocusedTests, to disallow skipped tests:
describe.only("test", () => {});it.only("test", () => {});Contributed by @ematipico
-
Add rule useSortedClasses, to sort CSS utility classes:
<div class="px-2 foo p-4 bar" /><div class="foo·bar·p-4·px-2" />Contributed by @DaniGuardiola
-
Add rule noUndeclaredependencies, to detect the use of dependencies that aren’t present in the
package.json.The rule ignores imports using a protocol such as
node:,bun:,jsr:,https:.Contributed by @ematipico and @Conaclos
-
Add rule noNamespaceImport, to report namespace imports:
import * as foo from "foo";Contributed by @unvalley
-
Add partial support for
.astrofiles. Biome is able to lint and fix the frontmatter of the Astro files. Contributed by @ematipico---delete a.ba.b = undefined---<div></div> -
Add partial support for
.vuefiles. Biome is able to lint and fix the script block of the Vue files.<script setup lang="ts">delete a.ba.b = undefined<script><template></template>Contributed by @nhedger
-
Add rule useNodeAssertStrict, which promotes the use of
node:assert/strictovernode:assert. Contributed by @ematipico -
Add rule noExportsInTest which disallows
exportormodules.exportsin files containing test. Contributed by @ah-yu -
Add rule noSemicolonInJsx to detect possible wrong semicolons inside JSX elements.
const Component = () => {return (<div><div />;</div>);}Contributed by @fujiyamaorange
-
Add rule noBarrelFile, to report the usage of barrel file:
export * from "foo";Contributed by @togami2864
Enhancements
Section titled Enhancements-
noUselessFragments now rule not triggered for jsx attributes when the fragment child is simple text.
export function SomeComponent() {return <div x-some-prop={<>Foo</>} />;}Also fixes code action when the fragment child is of type
JsxExpressionChild.<><Hello leftIcon={<>{provider?.icon}</>} />{<>{provider?.icon}</>}<>{provider?.icon}</></>Contributed by @vasucp1207
-
noUselessTernary now provides unsafe code fixes. Contributed by @vasucp1207
-
noApproximativeNumericConstant now provides unsafe code fixes and handle numbers without leading zero and numbers with digit separators.
The following numbers are now reported as approximated constants.
3.14_15; // PI.4342; // LOG10EContributed by @Conaclos
-
noPrecisionLoss no longer reports number with extra zeros.
The following numbers are now valid.
.1230000000000000000000000;1230000000000000000000000.0;Contributed by @Conaclos
-
useNamingConvention now supports unicase letters (#1786).
unicase letters have a single case: they are neither uppercase nor lowercase. Previously, Biome reported names in unicase as invalid. It now accepts a name in unicase everywhere.
The following code is now accepted:
const 안녕하세요 = { 안녕하세요: 0 };We still reject a name that mixes unicase characters with lowercase or uppercase characters: The following names are rejected:
const A안녕하세요 = { a안녕하세요: 0 };Contributed by @Conaclos
-
useNamingConvention and useFilenamingConvention now provides a new option
requireAsciito require identifiers to be in ASCII.To avoid any breaking change, this option is turned off by default. We intend to turn it on in the next major release of Biome (Biome 2.0).
Set the
requireAsciirule option totrueto require identifiers to be in ASCII.{"linter": {"rules": {"style": {"useNamingConvention": { "options": { "requireAscii": false } }},"nursery": {"useFilenamingConvention": { "options": { "requireAscii": false } }}}}}Contributed by @Conaclos
-
noUnusedVariables no longer reports unused imports.
We now have a dedicated rule for reporting unused imports: noUnusedImports
Contributed by @Conaclos
Bug fixes
Section titled Bug fixes-
Fix missing link in noStaticOnlyClass documentation. Contributed by @yndajas
-
noConfusingVoidType no longer reports valid use of the void type in conditional types (#1812).
The rule no longer reports the following code:
type Conditional<T> = T extends void ? Record<string, never> : TContributed by @lucasweng
-
noInvalidUseBeforeDeclaration no longer reports valid use of binding patterns (#1648).
The rule no longer reports the following code:
const { a = 0, b = a } = {};Contributed by @Conaclos
-
noUnusedVariables no longer reports used binding patterns (#1652).
The rule no longer reports
aas unused the following code:const { a = 0, b = a } = {};export { b };Contributed by @Conaclos
-
Fix #1651. noVar now ignores TsGlobalDeclaration. Contributed by @vasucp1207
-
Fix #1640. useEnumInitializers code action now generates valid code when last member has a comment but no comma. Contributed by @kalleep
-
Fix #1653. Handle a shorthand value in
useForOfto avoid the false-positive case. Contributed by @togami2864 -
Fix #1656. useOptionalChain code action now correctly handles logical and chains where methods with the same name are invoked with different arguments:
tags·&&·tags.includes('a')·&&·tags.includes('b')tags?.includes('a') && tags.includes('b')Contributed by @lucasweng
-
Fix #1704. Convert
/to escaped slash\/to avoid parsing error in the result of autofix. Contributed by @togami2864 -
Fix#1697. Preserve leading trivia in autofix of suppression rules. Contributed by @togami2864
-
Fix #603. Trim trailing whitespace to avoid double insertion. Contributed by @togami2864
-
Fix #1765. Now the rule
noDeletedoesn’t trigger when deleting a dataset:delete element.dataset.prop;Contributed by @ematipico
-
useNamingConvention and useFilenamingConvention now reject identifiers with consecutive delimiters.
The following name is now invalid because it includes two underscores:
export const MY__CONSTANT = 0;Note that we still allow consecutive leading and consecutive trailing underscores.
Contributed by @Conaclos
-
Fix #1932 Allow redeclaration of type parameters in different declarations. Contributed by @keita-hino
-
Fix #1945 Allow constructor with default parameters in
noUselessConstructor -
Fix #1982 Change to iterate over the module item lists and ignore .d.ts files. Contributed by @togami2864
Parser
Section titled ParserBug fixes
Section titled Bug fixes-
Fix #1728. Correctly parse the global declaration when the
{token is on the line following theglobalkeyword.Now the following code is correctly parsed:
declare global{ }declare module foo {global{ }}Contributed by @ah-yu
-
Fix #1730. Correctly parse
deleteexpressions with operands that are not simple member expressions.delete(a.b);delete console.log(1);delete(() => {});Contributed by @printfn
Website
Section titled WebsiteBug fixes
Section titled Bug fixes- Fix #1981. Identify TypeScript definition files by their file path within the playground. Contributed by @ah-yu
1.5.3 (2024-01-22)
Section titled 1.5.3 (2024-01-22)Bug fixes
Section titled Bug fixes-
Fix #1584. Ensure the LSP only registers the formatter once. Contributed by @nhedger
-
Fix #1589. Fix invalid formatting of own line comments when they were at the end of an import/export list. Contributed by @spanishpear
Configuration
Section titled ConfigurationBug fixes
Section titled Bug fixes-
Override correctly the recommended preset (#1349).
Previously, if unspecified, Biome turned on the recommended preset in overrides. This resulted in reporting diagnostics with a severity level set to
off. This in turn caused Biome to fail.Now Biome won’t switch on the recommended preset in
overridesunless told to do so.Contributed by @Conaclos
-
Don’t format ignored files that are well-known JSONC files when
files.ignoreUnknownis enabled (#1607).Previously, Biome always formatted files that are known to be JSONC files (e.g.
.eslintrc) whenfiles.ignoreUnknownwas enabled.Contributed by @Conaclos
Formatter
Section titled FormatterNew features
Section titled New features- Add option
json.formatter.trailingCommas, to provide a better control over the trailing comma in JSON/JSONC files. Its default value is"none".
Bug fixes
Section titled Bug fixes- Fix #1178, where the line ending option wasn’t correctly applied. Contributed by @ematipico
- Fix #1571. Fix invalid formatting of nested multiline comments. Contributed by @ah-yu
Linter
Section titled LinterBug fixes
Section titled Bug fixesFix #1575. noArrayIndexKey now captures array index value inside template literals and with string concatination. Contributed by @vasucp1207
-
Linter rules that inspect regexes now handle multibyte characters correctly (#1522).
Previously, noMisleadingCharacterClass, noMultipleSpacesInRegularExpressionLiterals, and noEmptyCharacterClassInRegex made Biome errors on multi-bytes characters. Multibyte characters are now handled correctly.
The following code no longer raises an internal error:
// Cyrillic characters/[\u200E\u2066-\u2069]/gu;Contributed by @Conaclos
-
useExhaustiveDependencies no longer made Biome errors in code TypeScript import equal declarations (#1194). Contributed by @Conaclos
-
Fix typo in the diagnostic of noNodejsModules. Contributed by @huseeiin
Parser
Section titled ParserBug fixes
Section titled Bug fixes-
Accept the
constmodifier for type parameter in method type signature (#1624).The following code is now correctly parsed:
type Foo = {<const T>();method<const T>();};Contributed by @magic-akari
-
Correctly parse type arguments in expression(#1184).
The following code is now correctly parsed in typescript:
0 < (0 >= 1);Contributed by @ah-yu
Website
Section titled Website- Add a page that maps the Biome rule to its source. Contributed by @ematipico
Fixes
Section titled Fixes-
Generate Open Graph images based on the linked page. Contributed by @ematipico
-
Fix examples of the git hook page. Contributed by @9renpoto, @lmauromb, and @Conaclos
-
Fix dead and erroneous hyperlinks. Contributed by @Sec-ant and Conaclos
1.5.2 (2024-01-15)
Section titled 1.5.2 (2024-01-15)Bug fixes
Section titled Bug fixes-
Fix #1512 by skipping verbose diagnostics from the count. Contributed by @ematipico
-
Correctly handle cascading
includeandignore.Previously Biome incorrectly included files that were included at tool level and ignored at global level. In the following example,
file.jswas formatted when it should have been ignored. Now, Biome correctly ignores the directory./src/sub/.Terminal window ❯ tree srcsrc└── sub└── file.js❯ cat biome.json{"files": { "ignore": ["./src/sub/"] },"formatter": { "include": ["./src"] }}Contributed by @Conaclos
-
Don’t emit verbose warnings when a protected file is ignored.
Some files, such as
package.jsonandtsconfig.json, are protected. Biome emits a verbose warning when it encounters a protected file.Previously, Biome emitted this verbose warning even if the file was ignored by the configuration. Now, it doesn’t emit verbose warnings for protected files that are ignored.
Contributed by @Conaclos
-
overridesno longer affect which files are ignored. Contributed by @Conaclos -
The file
biome.jsoncan’t be ignored anymore. Contributed by @ematipico -
Fix #1541 where the content of protected files wasn’t returned to
stdout. Contributed by @ematipico -
Don’t handle CSS files, the formatter isn’t ready yet. Contributed by @ematipico
Configuration
Section titled ConfigurationBug fixes
Section titled Bug fixes-
Fix 1440, a case where
extendsandoverridesweren’t correctly emitting the final configuration. Contributed by @arendjr -
Correctly handle
includewhenignoreis set (#1468). Contributed by @ConaclosPreviously, Biome ignored
includeifignorewas set. Now, Biome check bothincludeandignore. A file is processed if it is included and not ignored. Ifincludeis not set all files are considered included.
Formatter
Section titled FormatterBug fixes
Section titled Bug fixes-
Fix placement of comments before
*token in generator methods with decorators. #1537 Contributed by @ah-yu -
Fix #1406. Ensure comments before the
asynckeyword are placed before it. Contributed by @ah-yu -
Fix #1172. Fix placement of line comment after function expression parentheses, they are now attached to first statement in body. Contributed by @kalleep
-
Fix #1511 that made the JavaScript formatter crash. Contributed @Conaclos
Linter
Section titled LinterEnhancements
Section titled Enhancements-
Add an unsafe code fix for noConsoleLog. Contributed by @vasucp1207
-
useArrowFunction no longer reports function in
extendsclauses or in anewexpression. Contributed by @ConaclosThese cases require the presence of a prototype.
-
Add dependency variable names on error message when useExhaustiveDependencies rule shows errors. Contributed by @mehm8128
Bug fixes
Section titled Bug fixes-
The fix of useArrowFunction now adds parentheses around the arrow function in more cases where it is needed (#1524).
A function expression doesn’t need parentheses in most expressions where it can appear. This is not the case with the arrow function. We previously added parentheses when the function appears in a call or member expression. We now add parentheses in binary-like expressions and other cases where they are needed, hopefully covering all cases.
Previously:
f = f ?? function() {};f = f ?? () => {};Now:
f = f ?? function() {};f = f ?? (() => {});Contributed by @Conaclos
-
Fix #1514. Fix autofix suggestion to avoid the syntax error in
no_useless_fragments. Contributed by @togami2864
1.5.1 (2024-01-10)
Section titled 1.5.1 (2024-01-10)Bug fixes
Section titled Bug fixes- The diagnostics
files/missingHandlerare now shown only when the option--verboseis passed. Contributed by @ematipico - The diagnostics for protected files are now shown only when the option
--verboseis passed. Contributed by @ematipico - Fix #1465, by taking in consideration the workspace folder when matching a pattern. Contributed by @ematipico
- Fix #1465, by correctly process globs that contain file names. Contributed by @ematipico
Formatter
Section titled FormatterBug fixes
Section titled Bug fixes- Fix #1170. Fix placement of comments inside default switch clause. Now all line comments that have a preceding node will keep their position. Contributed by @kalleep
Linter
Section titled LinterBug fixes
Section titled Bug fixesFix #1335. noUselessFragments now ignores code action on component props when the fragment is empty. Contributed by @vasucp1207
-
useConsistentArrayType was accidentally placed in the
stylerule group instead of thenurserygroup. It is now correctly placed undernursery.
Fix #1483. useConsistentArrayType now correctly handles its option. Contributed by @Conaclos
Fix #1502. useArrowFunction now correctly handle functions that return a (comma) sequence expression. Contributed by @Conaclos
Previously the rule made an erroneous suggestion:
f(function() { return 0, 1; }, "");f(() => 0, 1, "")Now, the rule wraps any comma sequence between parentheses:
f(function() { return 0, 1; }, "");f(() => (0, 1), "")Fix #1473: useHookAtTopLevel now correctly handles React components and hooks that are nested inside other functions. Contributed by @arendjr
1.5.0 (2024-01-08)
Section titled 1.5.0 (2024-01-08)Biome now scores 97% compatibility with Prettier and features more than 180 linter rules.
Analyzer
Section titled AnalyzerNew features
Section titled New features-
Biome now shows a diagnostic when it encounters a protected file. Contributed by @ematipico
-
The command
biome migratenow updates the$schemaif there’s an outdated version. -
The CLI now takes in consideration the
.gitignorein the home directory of the user, if it exists. Contributed by @ematipico -
The
biome cicommand is now able to print GitHub Workflow Commands when there are diagnostics in our code. Contributed by @nikeee This might require setting the proper permissions on your GitHub action:permissions:pull-requests: write -
The commands
format,lint,checkandcinow accept two new arguments:--changedand--since. Use these options with the VCS integration is enabled to process only the files that were changed. Contributed by @simonxabrisTerminal window biome format --write --changed -
Introduced a new command called
biome explain, which has the capability to display documentation for lint rules. Contributed by @kalleep -
You can use the command
biome explainto print the documentation of lint rules. Contributed by @kalleepTerminal window biome explain noDebuggerbiome explain useAltText -
You can use the command
biome explainto print the directory where daemon logs are stored. Contributed by @ematipicoTerminal window biome explain daemon-logs -
Removed the hard coded limit of 200 printable diagnostics. Contributed by @ematipico
Bug fixes
Section titled Bug fixes-
Fix #1247, Biome now prints a warning diagnostic if it encounters files that can’t handle. Contributed by @ematipico
You can ignore unknown file types using the
files.ignoreUnknownconfiguration inbiome.json:{"files": {"ignoreUnknown": true}}Or the
--files-ignore-unknownCLI option:Terminal window biome format --files-ignore-unknown=true --write . -
Fix #709 and #805 by correctly parsing
.gitignorefiles. Contributed by @ematipico -
Fix #1117 by correctly respecting the matching. Contributed by @ematipico
-
Fix #691 and #1190, by correctly apply the configuration when computing
overridesconfiguration. Contributed by @ematipico
Configuration
Section titled ConfigurationNew features
Section titled New features-
Users can specify git ignore patterns inside
ignoreandincludeproperties, for example it’s possible to allow list globs of files using the!character:{"files": {"ignore": ["node_modules/**","!**/dist/**" // this is now accepted and allow files inside the `dist` folder]}}
Editors
Section titled EditorsNew features
Section titled New features-
The LSP registers formatting without the need of using dynamic capabilities from the client.
This brings formatting services to the editors that don’t support or have limited support for dynamic capabilities.
Formatter
Section titled FormatterBug fixes
Section titled Bug fixes-
Fix #1169. Account for escaped strings when computing layout for assignments. Contributed by @kalleep
-
Fix #851. Allow regular function expressions to group and break as call arguments, just like arrow function expressions. #1003 Contributed by @faultyserver
-
Fix #914. Only parenthesize type-casted function expressions as default exports. #1023 Contributed by @faultyserver
-
Fix #1112. Break block bodies in case clauses onto their own lines and preserve trailing fallthrough comments. #1035 Contributed by @faultyserver
-
Fix
RemoveSoftLinesBufferbehavior to also removed conditional expanded content, ensuring no accidental, unused line breaks are included #1032 Contributed by @faultyserver -
Fix #1024. Allow JSX expressions to nestle in arrow chains #1033 Contributed by @faultyserver
-
Fix incorrect breaking on the left side of assignments by always using fluid assignment. #1021 Contributed by @faultyserver
-
Fix breaking strategy for nested object patterns in function parameters #1054 Contributed by @faultyserver
-
Fix over-indention of arrow chain expressions by simplifying the way each chain is grouped #1036, #1136, and #1162 Contributed by @faultyserver.
-
Fix “simple” checks for calls and member expressions to correctly handle array accesses, complex arguments to single-argument function calls, and multiple-argument function calls. #1057 Contributed by @faultyserver
-
Fix text wrapping and empty line handling for JSX Text elements to match Prettier’s behavior. #1075 Contributed by @faultyserver
-
Fix leading comments in concisely-printed arrays to prevent unwanted line breaks. #1135 Contributed by @faultyserver
-
Fix
best_fittingand interned elements preventing expansion propagation from sibling elements. #1141 Contributed by @faultyserver -
Fix heuristic for grouping function parameters when type parameters with constraints are present. #1153. Contributed by @faultyserver.
-
Fix binary-ish and type annotation handling for grouping call arguments in function expressions and call signatures. #1152 and #1160 Contributed by @faultyserver
-
Fix handling of nestled JSDoc comments to preserve behavior for overloads. #1195 Contributed by @faultyserver
-
Fix #1208. Fix extraction of inner types when checking for simple type annotations in call arguments. #1195 Contributed by @faultyserver
-
Fix #1220. Avoid duplicating comments in type unions for mapped, empty object, and empty tuple types. #1240 Contributed by @faultyserver
-
Fix #1356. Ensure
if_group_fits_on_linecontent is always written inRemoveSoftLinesBuffers. #1357 Contributed by @faultyserver -
Fix #1171. Correctly format empty statement with comment inside arrow body when used as single argument in call expression. Contributed by @kalleep
-
Fix #1106. Fix invalid formatting of single bindings when Arrow Parentheses is set to “AsNeeded” and the expression breaks over multiple lines. #1449 Contributed by @faultyserver
JavaScript APIs
Section titled JavaScript APIsLinter
Section titled LinterPromoted rules
Section titled Promoted rulesNew rules are incubated in the nursery group. Once stable, we promote them to a stable group. The following rules are promoted:
- a11y/noAriaHiddenOnFocusable
- a11y/useValidAriaRole
- complexity/useRegexLiterals
- suspicious/noImplicitAnyLet
- style/noDefaultExport
New features
Section titled New features-
Add useExportType that enforces the use of type-only exports for types. Contributed by @Conaclos
interface A {}interface B {}class C {}export type { A, C }export { type A, C }export { type B }export type { B } -
Add useImportType that enforces the use of type-only imports for types. Contributed by @Conaclos
import { A, B } from "./mod.js";import { type A, B } from "mod";let a: A;const b: B = new B();Also, the rule groups type-only imports:
import { type A, type B } from "./mod.js";import type { A, B } from "./mod.js"; -
Add useFilenamingConvention, that enforces naming conventions for JavaScript and TypeScript filenames. Contributed by @Conaclos
By default, the rule requires that a filename be in
camelCase,kebab-case,snake_case, or matches the name of anexportin the file. The rule provides options to restrict the allowed cases. -
Add useNodejsImportProtocol that enforces the use of the
node:protocol when importing Node.js modules. Contributed by @2-NOW, @vasucp1207, and @Conaclosimport fs from "fs";import fs from "node:fs"; -
Add useNumberNamespace that enforces the use of the
Numberproperties instead of the global ones.parseInt;Number.parseInt;- Infinity;Number.NEGATIVE_INFINITY; -
Add useShorthandFunctionType that enforces using function types instead of object type with call signatures. Contributed by @emab, @ImBIOS, and @seitarof
interface Example {(): string;}type Example = () => string
- Add [noNodejsModules](https://biomejs.dev/linter/rules/no-nodejs-modules), that disallows the use of _Node.js_ modules. Contributed by @anonrig, @ematipico, and @Conaclos
- Add [noInvalidUseBeforeDeclaration](https://biomejs.dev/linter/rules/no-invalid-use-before-declaration) that reports variables and function parameters used before their declaration. Contributed by @Conaclos
```js function f() { console.log(c); // Use of `c` before its declaration. const c = 0; }-
Add useConsistentArrayType that enforces the use of a consistent syntax for array types. Contributed by @eryue0220
This rule will replace useShorthandArrayType. It provides an option to choose between the shorthand or the generic syntax.
-
Add noEmptyTypeParameters that ensures that any type parameter list has at least one type parameter. Contributed by @togami2864
This will report the following empty type parameter lists:
interface Foo<> {}// ^^type Bar<> = {};// ^^ -
Add noGlobalEval that reports any use of the global
eval. Contributed by @you-5805 -
Add noGlobalAssign that reports assignment to global variables. Contributed by @chansuke
Object = {}; // report assignment to `Object`. -
Add noMisleadingCharacterClass that disallows characters made with multiple code points in character class. Contributed by @togami2864
-
Add noThenProperty that disallows the use of
thenas property name. Adding athenproperty makes an object thenable that can lead to errors with Promises. Contributed by @togami2864 -
Add noUselessTernary that disallows conditional expressions ( ternaries) when simpler alternatives exist.
var a = x ? true : true; // this could be simplified to `x`
Enhancements
Section titled Enhancements-
noEmptyInterface ignores empty interfaces that extend a type. Address #959 and #1157. Contributed by @Conaclos
This allows supporting interface augmentation in external modules as demonstrated in the following example:
interface Extension {metadata: unknown;}declare module "@external/module" {// Empty interface that extends a type.export interface ExistingInterface extends Extension {}} -
Preserve more comments in the code fix of useExponentiationOperator. Contributed by @Conaclos
The rule now preserves comments that follow the (optional) trailing comma.
For example, the rule now suggests the following code fix:
Math.pow(a, // a2, // 2);a ** // a2 // 2 -
<svg>element is now considered as a non-interactive HTML element (#1095). Contributed by @chansukeThis affects the following rules:
-
noMultipleSpacesInRegularExpressionLiterals has a safe code fix. Contributed by @Conaclos
-
useArrowFunction ignores expressions that use
new.target. Contributed by @Conaclos -
noForEach now reports only calls that use a callback with
0or1parameter. Address #547. Contributed by @Conaclos
Bug fixes
Section titled Bug fixesFix #1061. noRedeclare
no longer reports overloads of export default function. Contributed by @Conaclos
The following code is no longer reported:
export default function(a: boolean): boolean;export default function(a: number): number;export default function(a: number | boolean): number | boolean { return a;}Fix #651, useExhaustiveDependencies no longer reports out of scope dependencies. Contributed by @kalleep
The following code is no longer reported:
let outer = false;
const Component = ({}) => { useEffect(() => { outer = true; }, []);}Fix #1191. noUselessElse
now preserve comments of the else clause. Contributed by @Conaclos
For example, the rule suggested the following fix:
function f(x) { if (x <0) { return 0; } // Comment else { return x; }}Now the rule suggests a fix that preserves the comment of the else clause:
function f(x) { if (x <0) { return 0; } // Comment else { return x; }}Fix #1383. noConfusingVoidType
now accepts the void type in type parameter lists.
The rule no longer reports the following code:
f<void>();Fix #728. useSingleVarDeclarator no longer outputs invalid code. Contributed by @Conaclos
Fix #1167. useValidAriaProps
no longer reports aria-atomic as invalid. Contributed by @unvalley
Fix #1192. useTemplate now correctly handles parenthesized expressions and respects type coercions. Contributed by @n-gude
These cases are now properly handled:
"a" + (1 + 2) // `a${1 + 2}`1 + (2 + "a") // `${1}${2}a`Fix #1456. useTemplate now reports expressions with an interpolated template literal and non-string expressions. Contributed by @n-gude
The following code is now reported:
`a${1}` + 2;Fix #1436. useArrowFunction now applies a correct fix when a function expression is used in a call expression or a member access. Contributed by @Conaclos
For example, the rule proposed the following fix:
const called = function() {}();const called = () => {}();It now proposes a fix that adds the needed parentheses:
const called = function() {}();const called = (() => {})();Fix #696. useHookAtTopLevel now correctly detects early returns before the calls to the hook.
-
The code fix of noUselessTypeCOnstraint now adds a trailing comma when needed to disambiguate a type parameter list from a JSX element. COntributed by @Conaclos
Fix #578. useExhaustiveDependencies
now correctly recognizes hooks namespaced under the React namespace. Contributed by @XiNiHa
Fix #910. noSvgWithoutTitle
now ignores <svg> element with aria-hidden="true". COntributed by @vasucp1207
Parser
Section titled ParserBREAKING CHANGES
Section titled BREAKING CHANGES-
The representation of imports has been simplified. Contributed by @Conaclos
The new representation is closer to the ECMAScript standard. It provides a single way of representing a namespace import such as
import * as ns from "". It rules out some invalid states that was previously representable. For example, it is no longer possible to represent a combined import with atypequalifier such asimport type D, { N } from "".See #1163 for more details.
New features
Section titled New features-
Imports and exports with both an import attribute and a
typequalifier are now reported as parse errors.import type A from "mod" with { type: "json" };// ^^^^ ^^^^^^^^^^^^^^^^^^^^^// parse error
Bug fixes
Section titled Bug fixes-
Fix #1077 where parenthesized identifiers in conditional expression were being parsed as arrow expressions. Contributed by @kalleep
These cases are now properly parsed:
JavaScript:
a ? (b) : a => {};TypeScript:
a ? (b) : a => {};JSX:
bar ? (foo) : (<a>{() => {}}</a>); -
Allow empty type parameter lists for interfaces and type aliases (#1237). COntributed by @togami2864
TypeScript allows interface declarations and type aliases to have empty type parameter lists. Previously Biome didn’t handle this edge case. Now, it correctly parses this syntax:
interface Foo<> {}type Bar<> = {};
Crates
Section titled CratesBREAKING CHANGES
Section titled BREAKING CHANGES- Rename the
biome_js_unicode_tablecrate tobiome_unicode_table(#1302). COntributed by @chansuke
1.4.1 (2023-11-30)
Section titled 1.4.1 (2023-11-30)Editors
Section titled EditorsBug fixes
Section titled Bug fixes- Fix #933. Some files are properly ignored in the LSP too.
E.g.
package.json,tsconfig.json, etc. - Fix #1394, by inferring the language extension from the internal saved files. Now newly created files JavaScript correctly show diagnostics.
Formatter
Section titled FormatterBug fixes
Section titled Bug fixes-
Fix some accidental line breaks when printing array expressions within arrow functions and other long lines #917. Contributed by @faultyserver
-
Match Prettier’s breaking strategy for
ArrowChainlayouts #934. Contributed by @faultyserver -
Fix double-printing of leading comments in arrow chain expressions #951. Contributed by @faultyserver
Linter
Section titled LinterBug fixes
Section titled Bug fixes- Fix #910, where the rule
noSvgWithoutTitleshould skip elements that havearia-hiddenattributes. Contributed by @vasucp1207
New features
Section titled New features- Add useForOf rule. The rule recommends a for-of loop when the loop index is only used to read from an array that is being iterated. Contributed by @victor-teles
Enhancement
Section titled Enhancement-
Address #924 and #920. noUselessElse now ignores
elseclauses that follow at least oneifstatement that doesn’t break early. Contributed by @ConaclosFor example, the following code is no longer reported by the rule:
function f(x) {if (x < 0) {// this `if` doesn't break early.} else if (x > 0) {return x;} else {// This `else` block was previously reported as useless.}}
Bug fixes
Section titled Bug fixesFix #918. useSimpleNumberKeys no longer repports false positive on comments. Contributed by @kalleep
-
Fix #953. noRedeclare no longer reports type parameters with the same name in different mapped types as redeclarations. Contributed by @Conaclos
Fix #608. useExhaustiveDependencies no longer repports missing dependencies for React hooks without dependency array. Contributed by @kalleep
Parser
Section titled Parser1.4.0 (2023-11-27)
Section titled 1.4.0 (2023-11-27)-
Remove the CLI options from the
lsp-proxy, as they were never meant to be passed to that command. Contributed by @ematipico -
Add option
--config-pathtolsp-proxyandstartcommands. It’s now possible to tell the Daemon server to loadbiome.jsonfrom a custom path. Contributed by @ematipico -
Add option
--diagnostic-level. It lets users control the level of diagnostics printed by the CLI. Possible values are:"info","warn", and"hint". Contributed by @simonxabris -
Add option
--line-feedto theformatcommand. Contributed by @SuperchupuDev -
Add option
--bracket-same-lineto theformatcommand. Contributed by @faultyserve -
Add option
--bracket-spacingto theformatcommand. Contributed by @faultyserve
Bug fixes
Section titled Bug fixes- Fix the command
format, now it returns a non-zero exit code when if there pending diffs. Contributed by @ematipico
Formatter
Section titled FormatterNew features
Section titled New features-
Add the configuration
formatter.lineFeed. It allows changing the type of line endings. Contributed by @SuperchupuDev -
Add the configuration
javascript.formatter.bracketSameLine. It allows controlling whether ending>of a multi-line JSX element should be on the last attribute line or not. #627. Contributed by @faultyserver -
Add the configuration
javascript.formatter.bracketSpacing. It allows controlling whether spaces are inserted around the brackets of object literals. #627. Contributed by @faultyserver
Bug fixes
Section titled Bug fixes-
Fix #832, the formatter no longer keeps an unnecessary trailing comma in type parameter lists. Contributed by @Conaclos
class A<T,> {}class A<T> {} -
Fix #301, the formatter should not break before the
inkeyword. Contributed by @ematipico
Linter
Section titled LinterPromoted rules
Section titled Promoted rules- a11y/noInteractiveElementToNoninteractiveRole
- complexity/noThisInStatic
- complexity/useArrowFunction
- correctness/noEmptyCharacterClassInRegex
- correctness/noInvalidNewBuiltin
- style/noUselessElse
- style/useAsConstAssertion
- style/useShorthandAssign
- suspicious/noApproximativeNumericConstant
- suspicious/noMisleadingInstantiator
- suspicious/noMisrefactoredShorthandAssign
The following rules are now recommended:
The following rules are now deprecated:
- correctness/noNewSymbol The rule is replaced by correctness/noInvalidNewBuiltin
New features
Section titled New features-
Add noDefaultExport which disallows
export default. Contributed by @Conaclos -
Add noAriaHiddenOnFocusable which reports hidden and focusable elements. Contributed by @vasucp1207
-
Add noImplicitAnyLet that reports variables declared with
letand without initialization and type annotation. Contributed by @TaKO8Ki and @b4s36t4 -
Add useAwait that reports
asyncfunctions that don’t use anawaitexpression. -
Add useValidAriaRole. Contributed by @vasucp1207
-
Add useRegexLiterals that suggests turning call to the regex constructor into regex literals. COntributed by @Yuiki
Enhancements
Section titled Enhancements- Add an unsafe code fix for a11y/useAriaActivedescendantWithTabindex
Bug fixes
Section titled Bug fixes-
Fix #639 by ignoring unused TypeScript’s mapped key. Contributed by @Conaclos
-
Fix #565 by handling several
inferwith the same name in extends clauses of TypeScript’s conditional types. Contributed by @Conaclos
Fix #653. noUnusedImports
now correctly removes the entire line where the unused import is. Contributed by @Conaclos
-
Fix #607
useExhaustiveDependencies, ignore optional chaining, Contributed by @msdlisper -
Fix #676, by using the correct node for the
"noreferrer"when applying the code action. Contributed by @ematipico -
Fix #455. The CLI can now print complex emojis to the console correctly.
Fix #727. noInferrableTypes
now correctly keeps type annotations when the initialization expression is null. Contributed by @Conaclos
Fix #784, noSvgWithoutTitle
fixes false-positives to aria-label and reports svg’s role attribute is implicit. Contributed by @unvalley
-
Fix #834 that made noUselessLoneBlockStatements reports block statements of switch clauses. Contributed by @vasucp1207
-
Fix #783 that made noUselessLoneBlockStatements reports block statements of
try-catchstructures. Contributed by @hougesen -
Fix #69 that made correctness/noUnnecessaryContinue incorrectly reports a
continueused to break a switch clause. Contributed by @TaKO8Ki -
Fix #664 by improving the diagnostic of style/useNamingConvention when double capital are detected in strict camel case mode. Contributed by @vasucp1207
-
Fix #643 that erroneously parsed the option of complexity/useExhaustiveDependencies. Contributed by @arendjr
Parser
Section titled ParserBug fixes
Section titled Bug fixes- Fix #846 that erroneously parsed
<const T,>() => {}as a JSX tag instead of an arrow function when both TypeScript and JSX are enabled.
VSCode
Section titled VSCode1.3.3 (2023-10-31)
Section titled 1.3.3 (2023-10-31)Analyzer
Section titled AnalyzerBug fixes
Section titled Bug fixes- Fix #604 which
made noConfusingVoidType report false positives when
the
voidtype is used in a generic type parameter. Contributed by @unvalley
Bug fixes
Section titled Bug fixes- Fix how
overridesbehave. Nowignoreandincludeapply or not the override pattern, so they override each other. Now the options insideoverridesoverride the top-level options. - Bootstrap the logger only when needed. Contributed by @ematipico
- Fix how
overridesare run. The propertiesignoreandincludehave different semantics and only apply/not apply an override. Contributed by @ematipico
Editors
Section titled EditorsBug fixes
Section titled Bug fixes- Fix #592, by changing binary resolution in the IntelliJ plugin. Contributed by @Joshuabaker2
Formatter
Section titled FormatterBug fixes
Section titled Bug fixes-
Apply the correct layout when the right hand of an assignment expression is an
awaitexpression or a yield expression. Contributed by @ematipico -
Fix #303, where nested arrow functions didn’t break. Contributed by @victor-teles
Linter
Section titled LinterNew features
Section titled New features- Add noUnusedPrivateClassMembers rule. The rule disallow unused private class members. Contributed by @victor-teles
Bug fixes
Section titled Bug fixes-
Fix #175 which made noRedeclare report index signatures using the name of a variable in the parent scope.
-
Fix #557 which made noUnusedImports report imported types used in
typeofexpression. Contributed by @Conaclos -
Fix #576 by removing some erroneous logic in noSelfAssign. Contributed by @ematipico
-
Fix #861 that made noUnusedVariables always reports the parameter of a non-parenthesize arrow function as unused.
-
Fix #595 by updating unsafe-apply logic to avoid unexpected errors in noUselessFragments. Contributed by @nissy-dev
-
Fix #591 which made noRedeclare report type parameters with identical names but in different method signatures. Contributed by @Conaclos
-
Support more a11y roles and fix some methods for a11y lint rules Contributed @nissy-dev
-
Fix #609
useExhaustiveDependencies, by removinguseContext,useIdanduseSyncExternalStorefrom the known hooks. Contributed by @msdlisper -
Fix
useExhaustiveDependencies, by removinguseContext,useIdanduseSyncExternalStorefrom the known hooks. Contributed by @msdlisper -
Fix #871 and #610. Now
useHookAtTopLevelcorrectly handles nested functions. Contributed by @arendjr -
The options of the rule
useHookAtTopLevelare deprecated and will be removed in Biome 2.0. The rule now determines the hooks using the naming convention set by React.{"linter": {"rules": {"correctness": {"useHookAtTopLevel": "error","useHookAtTopLevel": {"level": "error","options": {"hooks": [{"name": "useLocation","closureIndex": 0,"dependenciesIndex": 1},{ "name": "useQuery", "closureIndex": 1, "dependenciesIndex": 0 }]}}}}}}
Parser
Section titled ParserEnhancements
Section titled Enhancements- Support RegExp v flag. Contributed by @nissy-dev
- Improve error messages. Contributed by @ematipico
1.3.1 (2023-10-20)
Section titled 1.3.1 (2023-10-20)Bug fixes
Section titled Bug fixes- Fix
ragecommand, now it doesn’t print info about running servers. Contributed by @ematipico
Editors
Section titled EditorsBug fixes
Section titled Bug fixes- Fix #552, where the formatter isn’t correctly triggered in Windows systems. Contributed by @victor-teles
Linter
Section titled LinterNew features
Section titled New features- Add noThisInStatic rule. Contributed by @ditorodev and @Conaclos
Bug fixes
Section titled Bug fixes-
Fix #548 which made noSelfAssign panic.
-
Fix #555, by correctly map
globalsinto the workspace.
1.3.0 (2023-10-19)
Section titled 1.3.0 (2023-10-19)Analyzer
Section titled AnalyzerEnhancements
Section titled Enhancements-
Import sorting is safe to apply now, and it will be applied when running
check --applyinstead ofcheck --apply-unsafe. -
Import sorting now handles Bun imports
bun:<name>, absolute path imports/<path>, and Node’s subpath imports#<name>. See our documentation for more details. Contributed by @Conaclos
Bug fixes
Section titled Bug fixes- Fix #319. The command
biome lintnow shows the correct options. Contributed by @ematipico - Fix #312. Running
biome --versionnow exits with status code0instead of1. Contributed by @nhedger - Fix a bug where the
extendsfunctionality doesn’t carry overorganizeImports.ignore. Contributed by @ematipico - The CLI now returns the original content when using
stdinand the original content doesn’t change. Contributed by @ematipico
New features
Section titled New features-
Add support for
BIOME_BINARYenvironment variable to override the location of the binary. Contributed by @ematipico -
Add option
--indent-width, and deprecated the option--indent-size. Contributed by @ematipico -
Add option
--javascript-formatter-indent-width, and deprecated the option--javascript-formatter-indent-size. Contributed by @ematipico -
Add option
--json-formatter-indent-width, and deprecated the option--json-formatter-indent-size. Contributed by @ematipico -
Add option
--daemon-logstobiome rage. The option is required to view Biome daemon server logs. Contributed by @unvalley -
Add support for logging. By default, Biome doesn’t log anything other than diagnostics. Logging can be enabled with the new option
--log-level:Terminal window biome format --log-level=info ./srcThere are four different levels of logging, from the most verbose to the least verbose:
debug,info,warnanderror. Here’s how anINFOlog will look like:2023-10-05T08:27:01.954727Z INFO Analyze file ./website/src/playground/components/Resizable.tsxat crates/biome_service/src/file_handlers/javascript.rs:298 on biome::worker_5in Pulling diagnostics with categories: RuleCategories(SYNTAX)in Processes formatting with path: "./website/src/playground/components/Resizable.tsx"in Process check with path: "./website/src/playground/components/Resizable.tsx"You can customize how the log will look like with a new option
--log-kind. The supported kinds are:pretty,compactandjson.prettyis the default logging. Here’s how acompactlog will look like:2023-10-05T08:29:04.864247Z INFO biome::worker_2 Process check:Processes linting:Pulling diagnostics: crates/biome_service/src/file_handlers/javascript.rs: Analyze file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx" categories=RuleCategories(LINT)2023-10-05T08:29:04.864290Z INFO biome::worker_7 Process check:Processes formatting: crates/biome_service/src/file_handlers/javascript.rs: Format file ./website/src/playground/components/Tabs.tsx path="./website/src/playground/components/Tabs.tsx" path="./website/src/playground/components/Tabs.tsx"2023-10-05T08:29:04.879332Z INFO biome::worker_2 Process check:Processes formatting:Pulling diagnostics: crates/biome_service/src/file_handlers/javascript.rs: Analyze file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx" categories=RuleCategories(SYNTAX)2023-10-05T08:29:04.879383Z INFO biome::worker_2 Process check:Processes formatting: crates/biome_service/src/file_handlers/javascript.rs: Format file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx"
Enhancements
Section titled Enhancements- Deprecated the environment variable
ROME_BINARY. UseBIOME_BINARYinstead. Contributed by @ematipico - Biome doesn’t check anymore the presence of the
.gitfolder when VCS support is enabled. Contributed by @ematipico biome ragedoesn’t print the logs of the daemon, usebiome rage --daemon-logsto print them. Contributed by @unvalley
Configuration
Section titled ConfigurationNew features
Section titled New features-
Add option
formatter.indentWidth, and deprecated the optionformatter.indentSize. Contributed by @ematipico -
Add option
javascript.formatter.indentWidth, and deprecated the optionjavascript.formatter.indentSize. Contributed by @ematipico -
Add option
json.formatter.indentWidth, and deprecated the optionjson.formatter.indentSize. Contributed by @ematipico -
Add option
includeto multiple sections of the configurationfiles.include;formatter.include;linter.include;organizeImports.include; Whenincludeandignoreare both specified,ignoretakes precedence overinclude
-
Add option
overrides, where users can modify the behaviour of the tools for certain files or paths.For example, it’s possible to modify the formatter
lineWidth, and evenquoteStylefor certain files that are included in glob pathgenerated/**:{"formatter": {"lineWidth": 100},"overrides": [{"include": ["generated/**"],"formatter": {"lineWidth": 160},"javascript": {"formatter": {"quoteStyle": "single"}}}]}Or, you can disable certain rules for certain path, and disable the linter for other paths:
{"linter": {"enabled": true,"rules": {"recommended": true}},"overrides": [{"include": ["lib/**"],"linter": {"rules": {"suspicious": {"noDebugger": "off"}}}},{"include": ["shims/**"],"linter": {"enabled": false}}]}
Bug fixes
Section titled Bug fixes- Fix #343,
extendswas incorrectly applied to thebiome.jsonfile. Contributed by @ematipico
Editors
Section titled EditorsBug fixes
Section titled Bug fixes-
Fix #404. Biome intellij plugin now works on Windows. Contributed by @victor-teles
-
Fix #402. Biome
formaton intellij plugin now recognize biome.json. Contributed by @victor-teles
Formatter
Section titled FormatterEnhancements
Section titled Enhancements- Use
OnceCellfor the Memoized memory because that’s what theRefCell<Option>implemented. Contributed by @denbezrukov
Linter
Section titled LinterPromoted rules
Section titled Promoted rules- complexity/noExcessiveCognitiveComplexity
- complexity/noVoid
- correctness/useExhaustiveDependencies
- correctness/useHookAtTopLevel
- performance/noAccumulatingSpread
- style/useCollapsedElseIf
- suspicious/noConfusingVoidType
- suspicious/noFallthroughSwitchClause
- suspicious/noGlobalIsFinite
- suspicious/noGlobalIsNan
- suspicious/useIsArray
The following rules are now recommended:
New features
Section titled New features-
Add noEmptyCharacterClassInRegex rule. The rule reports empty character classes and empty negated character classes in regular expression literals. Contributed by @Conaclos
-
Add noMisleadingInstantiator rule. The rule reports the misleading use of the
newandconstructormethods. Contributed by @unvalley -
Add noUselessElse rule. The rule reports
elseclauses that can be omitted because theirifbranches break. Contributed by @Conaclos -
Add noUnusedImports rule. The rule reports unused imports and suggests removing them. Contributed by @Conaclos
noUnusedVariables reports also unused imports, but don’t suggest their removal. Once noUnusedImports stabilized, noUnusedVariables will not report unused imports.
-
Add useShorthandAssign rule. The rule enforce use of shorthand operators that combine variable assignment and some simple mathematical operations. For example, x = x + 4 can be shortened to x += 4. Contributed by @victor-teles
-
Add useAsConstAssertion rule. The rule enforce use of
as constassertion to infer literal types. Contributed by @unvalley -
Add noMisrefactoredShorthandAssign rule. The rule reports shorthand assigns when variable appears on both sides. For example
x += x + bContributed by @victor-teles -
Add noApproximativeNumericConstant rule. Contributed by @nikeee
Add noInteractiveElementToNoninteractiveRole rule. The rule enforces the non-interactive ARIA roles are not assigned to interactive HTML elements. Contributed by @nissy-dev
-
Add useAriaActivedescendantWithTabindex rule. The rule enforces that
tabIndexis assigned to non-interactive HTML elements witharia-activedescendant. Contributed by @nissy-dev -
Add noUselessLoneBlockStatements rule. The rule reports standalone blocks that don’t include any lexical scoped declaration. Contributed by @emab
-
Add noInvalidNewBuiltin rule. The rule reports use of
newonSymbolandBigInt. Contributed by @lucasweng
Enhancements
Section titled Enhancements-
The following rules have now safe code fixes:
-
noAccumulatingSpread makes more check in order to reduce potential false positives. Contributed by @Vivalldi
-
noConstAssign now provides an unsafe code fix that replaces
constwithlet. Contributed by @vasucp1207 -
noExcessiveComplexity default complexity threshold is now
15. Contributed by @arendjr -
noPositiveTabindexValue now provides an unsafe code fix that set to
0the tab index. Contributed by @vasucp1207 -
noUnusedLabels no longer reports unbreakable labeled statements. Contributed by @Conaclos
-
noUnusedVariables now reports unused TypeScript’s type parameters. Contributed by @Conaclos
-
useAnchorContent now provides an unsafe code fix that removes the `aria-hidden“ attribute. Contributed by @vasucp1207
-
useValidAriaProps now provides an unsafe code fix that removes invalid properties. Contributed by @vasucp1207
-
noExcessiveComplexitywas renamed tonoExcessiveCognitiveComplexity
Bug fixes
Section titled Bug fixesFix #294. noConfusingVoidType no longer reports false positives for return types. Contributed by @b4s36t4
Fix #313. noRedundantUseStrict now keeps leading comments.
Fix #383. noMultipleSpacesInRegularExpressionLiterals now provides correct code fixes when consecutive spaces are followed by a quantifier. Contributed by @Conaclos
Fix #397. useNumericLiterals now provides correct code fixes for signed numbers. Contributed by @Conaclos
-
Fix 452. The linter panicked when it met a malformed regex (a regex not ending with a slash).
-
Fix #104. We now correctly handle types and values with the same name.
-
Fix #243 a false positive case where the incorrect scope was defined for the
infertype in rule noUndeclaredVariables. Contributed by @denbezrukov -
Fix #322, now noSelfAssign correctly handles literals inside call expressions.
-
Changed how noSelfAssign behaves. The rule is not triggered anymore on function calls. Contributed by @ematipico
Parser
Section titled Parser-
Enhance diagnostic for infer type handling in the parser. The ‘infer’ keyword can only be utilized within the ’ extends’ clause of a conditional type. Using it outside this context will result in an error. Ensure that any type declarations using ‘infer’ are correctly placed within the conditional type structure to avoid parsing issues. Contributed by @denbezrukov
-
Add support for parsing trailing commas inside JSON files:
{"json": {"parser": {"allowTrailingCommas": true}}}Contributed by @nissy-dev
VSCode
Section titled VSCode1.2.2 (2023-09-16)
Section titled 1.2.2 (2023-09-16)Bug fixes
Section titled Bug fixes- Fix a condition where import sorting wasn’t applied when running
biome check --apply
1.2.1 (2023-09-15)
Section titled 1.2.1 (2023-09-15)Configuration
Section titled Configuration- Fix an edge case where the formatter language configuration wasn’t picked.
- Fix the configuration schema, where
json.formatterproperties weren’t transformed in camel case.
1.2.0 (2023-09-15)
Section titled 1.2.0 (2023-09-15)New features
Section titled New features- Add new options to customize the behaviour the formatter based on the language of the file
--json-formatter-enabled--json-formatter-indent-style--json-formatter-indent-size--json-formatter-line-width--javascript-formatter-enabled--javascript-formatter-indent-style--javascript-formatter-indent-size--javascript-formatter-line-width
Bug fixes
Section titled Bug fixes- Fix a bug where
--errors-on-warningdidn’t work when runningbiome cicommand.
Configuration
Section titled ConfigurationNew features
Section titled New features- Add new options to customize the behaviour of the formatter based on the language of the file
json.formatter.enabledjson.formatter.indentStylejson.formatter.indentSizejson.formatter.lineWidthjavascript.formatter.enabledjavascript.formatter.indentStylejavascript.formatter.indentSizejavascript.formatter.lineWidth
Linter
Section titled LinterPromoted rules
Section titled Promoted rulesNew rules are incubated in the nursery group. Once stable, we promote them to a stable group. The following rules are promoted:
- a11y/noAriaUnsupportedElements
- a11y/noNoninteractiveTabindex
- a11y/noRedundantRoles
- a11y/useValidAriaValues
- complexity/noBannedTypes
- complexity/noStaticOnlyClass
- complexity/noUselessEmptyExport
- complexity/noUselessThisAlias
- correctness/noConstantCondition
- correctness/noNonoctalDecimalEscape
- correctness/noSelfAssign
- style/useLiteralEnumMembers
- style/useNamingConvention
- suspicious/noControlCharactersInRegex
- suspicious/noUnsafeDeclarationMerging
- suspicious/useGetterReturn
New rules
Section titled New rules- Add noConfusingVoidType rule. The rule reports the unusual
use of the
voidtype. Contributed by @shulandmimi
Removed rules
Section titled Removed rules-
Remove
noConfusingArrowCode formatters, such as prettier and Biome, always adds parentheses around the parameter or the body of an arrow function. This makes the rule useless.
Contributed by @Conaclos
Enhancements
Section titled Enhancements-
noFallthroughSwitchClause now relies on control flow analysis to report most of the switch clause fallthrough. Contributed by @Conaclos
-
noAssignInExpressions no longer suggest code fixes. Most of the time the suggestion didn’t match users’ expectations. Contributed by @Conaclos
-
noUselessConstructor no longer emits safe code fixes. Contributed by @Conaclos
All code fixes are now emitted as unsafe code fixes. Removing a constructor can change the behavior of a program.
-
useCollapsedElseIf now only provides safe code fixes. Contributed by @Conaclos
-
noUnusedVariables now reports more cases.
The rule is now able to ignore self-writes. For example, the rule reports the following unused variable:
let a = 0;a++;a += 1;The rule is also capable of detecting an unused declaration that uses itself. For example, the rule reports the following unused interface:
interface I {instance(): I}Finally, the rule now ignores all TypeScript declaration files, including global declaration files.
Contributed by @Conaclos
Bug fixes
Section titled Bug fixes-
Fix #182, making useLiteralKeys retains optional chaining. Contributed by @denbezrukov
-
Fix #168, fix useExhaustiveDependencies false positive case when stable hook is on a new line. Contributed by @denbezrukov
-
Fix #137, fix noRedeclare false positive case with TypeScript module declaration:
declare module '*.gif' {const src: string;}declare module '*.bmp' {const src: string;}Contributed by @denbezrukov
-
Fix #258, fix noUselessFragments the case where the rule removing an assignment. Contributed by @denbezrukov
-
Fix #266, where
complexity/useLiteralKeysemitted a code action with an invalid AST. Contributed by @ematipico -
Fix #105, removing false positives reported by noUnusedVariables.
The rule no longer reports the following used variable:
const a = f(() => a);Contributed by @Conaclos
VSCode
Section titled VSCodeEnhancements
Section titled Enhancements-
Improve server binary resolution when using certain package managers, notably pnpm.
The new strategy is to point to
node_modules/.bin/biomepath, which is consistent for all package managers.
1.1.2 (2023-09-07)
Section titled 1.1.2 (2023-09-07)Editors
Section titled EditorsBug fixes
Section titled Bug fixes- Fix a case where an empty JSON file would cause the LSP server to crash. Contributed by @ematipico
Linter
Section titled LinterEnhancements
Section titled Enhancements-
useNamingConvention now accepts import namespaces in PascalCase and rejects export namespaces in CONSTANT_CASE.
The following code is now valid:
import * as React from "react";And the following code is now invalid:
export * as MY_NAMESPACE from "./lib.js";Contributed by @Conaclos
-
noUselessConstructor now ignores decorated classes and decorated parameters. The rule now gives suggestions instead of safe fixes when parameters are annotated with types. Contributed by @Conaclos
1.1.1 (2023-09-07)
Section titled 1.1.1 (2023-09-07)Analyzer
Section titled AnalyzerBug fixes
Section titled Bug fixes- The diagnostic for
// rome-ignoresuppression comment should not be a warning. A warning could block the CI, marking a gradual migration difficult. The code action that changes// rome-ignoreto// biome-ignoreis disabled as consequence. Contributed by @ematipico
1.1.0 (2023-09-06)
Section titled 1.1.0 (2023-09-06)Analyzer
Section titled AnalyzerEnhancements
Section titled Enhancements- Add a code action to replace
rome-ignorewithbiome-ignore. Usebiome check --apply-unsafeto update all the comments. The action is not bulletproof, and it might generate unwanted code, that’s why it’s unsafe action. Contributed by @ematipico
Enhancements
Section titled Enhancements- Biome now reports a diagnostics when a
rome.jsonfile is found. biome migrate --writecreatesbiome.jsonfromrome.json, but it won’t delete therome.jsonfile. Contributed by @ematipico
Bug fixes
Section titled Bug fixes- Biome uses
biome.jsonfirst, then it attempts to userome.json. - Fix a case where Biome couldn’t compute correctly the ignored files when the VSC integration is enabled. Contributed by @ematipico
Configuration
Section titled ConfigurationEditors
Section titled EditorsBug fixes
Section titled Bug fixes- The LSP now uses its own socket and won’t rely on Biome’s socket. This fixes some cases where users were seeing
multiple servers in the
rageoutput.
Formatter
Section titled FormatterEnhancements
Section titled Enhancements- You can use
// biome-ignoreas suppression comment. - The
// rome-ignoresuppression is deprecated.
JavaScript APIs
Section titled JavaScript APIsLinter
Section titled LinterNew features
Section titled New features- Add useCollapsedElseIf rule. This new rule requires merging
an
elseand anif, if theifstatement is the only statement in theelseblock. Contributed by @n-gude
Enhancements
Section titled Enhancements-
useTemplate now reports all string concatenations.
Previously, the rule ignored concatenation of a value and a newline or a backquote. For example, the following concatenation was not reported:
v + "\n";"`" + v + "`";The rule now reports these cases and suggests the following code fixes:
v + "\n";`${v}\n`;v + "`";`\`${v}\``;Contributed by @Conaclos
-
useExponentiationOperator suggests better code fixes.
The rule now preserves any comment preceding the exponent, and it preserves any parenthesis around the base or the exponent. It also adds spaces around the exponentiation operator
**, and always adds parentheses for pre- and post-updates.Math.pow(a++, /**/ (2))(a++) ** /**/ (2)Contributed by @Conaclos
-
You can use
// biome-ignoreas suppression comment. -
The
// rome-ignoresuppression is deprecated.
Bug fixes
Section titled Bug fixes-
Fix #80, making noDuplicateJsxProps case-insensitive.
Some frameworks, such as Material UI, rely on the case-sensitivity of JSX properties. For example, TextField has two properties with the same name, but distinct cases:
<TextField inputLabelProps="" InputLabelProps=""></TextField>Contributed by @Conaclos
-
Fix #138
noCommaOperator now correctly ignores all use of comma operators inside the update part of a
forloop. The following code is now correctly ignored:for (let i = 0, j = 1, k = 2;i < 100;i++, j++, k++) {}Contributed by @Conaclos
-
Fix rome#4713.
Previously, useTemplate made the following suggestion:
a + b + "px"`${a}${b}px`This breaks code where
aandbare numbers.Now, the rule makes the following suggestion:
a + b + "px"`${a + b}px`Contributed by @Conaclos
-
Fix rome#4109
Previously, useTemplate suggested an invalid code fix when a leading or trailing single-line comment was present:
// leading comment1 /* inner comment */ + "+" + 2 // trailing comment`${// leading comment1 /* inner comment */}+${2 //trailing comment}` // trailing commentNow, the rule correctly handles this case:
// leading comment1 + "+" + 2 // trailing comment`${1}+${2}` // trailing commentAs a sideeffect, the rule also suggests the removal of any inner comments.
Contributed by @Conaclos
-
Fix rome#3850
Previously useExponentiationOperator suggested invalid code in a specific edge case:
1 +Math.pow(++a, 2)1 +++a**2Now, the rule properly adds parentheses:
1 +Math.pow(++a, 2)1 +(++a) ** 2Contributed by @Conaclos
-
Fix #106
noUndeclaredVariables now correctly recognizes some TypeScript types such as
Uppercase.Contributed by @Conaclos
-
Fix rome#4616
Previously noUnreachableSuper reported valid codes with complex nesting of control flow structures.
Contributed by @Conaclos
1.0.0 (2023-08-28)
Section titled 1.0.0 (2023-08-28)Analyzer
Section titled AnalyzerBREAKING CHANGES
Section titled BREAKING CHANGES-
The organize imports feature now groups import statements by “distance”.
Modules “farther” from the user are put on the top, and modules “closer” to the user are placed on the bottom. Check the documentation for more information about it.
-
The organize imports tool is enabled by default. If you don’t want to use it, you need to disable it explicitly:
{"organizeImports": {"enabled": false}}
BREAKING CHANGES
Section titled BREAKING CHANGES-
The CLI now exists with an error when there’s an error inside the configuration.
Previously, biome would raise warnings and continue the execution by applying its defaults.
This could have been better for users because this could have created false positives in linting or formatted code with a configuration that wasn’t the user’s.
-
The command
biome checknow shows formatter diagnostics when checking the code.The diagnostics presence will result in an error code when the command finishes.
This aligns with semantic and behaviour meant for the command
biome check. -
initcommand emits abiome.jsonfile;
Other changes
Section titled Other changes-
Fix #4670, don’t crash at empty default export.
-
Fix #4556, which correctly handles new lines in the
.gitignorefile across OS. -
Add a new option to ignore unknown files
--files-ignore-unknown:Terminal window biome format --files-ignore-unknown ./srcDoing so, Biome won’t emit diagnostics for files that doesn’t know how to handle.
-
Add the new option
--no-errors-on-unmatched:Terminal window biome format --no-errors-on-unmatched ./srcBiome doesn’t exit with an error code if no files were processed in the given paths.
-
Fix the diagnostics emitted when running the
biome formatcommand. -
Biome no longer warns when discovering (possibly infinite) symbolic links between directories.
This fixes #4193 which resulted in incorrect warnings when a single file or directory was pointed at by multiple symbolic links. Symbolic links to other symbolic links do still trigger warnings if they are too deeply nested.
-
Introduced a new command called
biome lint, which will only run lint rules against the code base. -
Biome recognizes known files as “JSON files with comments allowed”:
typescript.json;tsconfig.json;jsconfig.json;tslint.json;babel.config.json;.babelrc.json;.ember-cli;typedoc.json;.eslintrc.json;.eslintrc;.jsfmtrc;.jshintrc;.swcrc;.hintrc;.babelrc;
-
Add support for
biome.json;
Configuration
Section titled ConfigurationOther changes
Section titled Other changes-
Add a new option to ignore unknown files:
{"files": {"ignoreUnknown": true}}Doing so, Biome won’t emit diagnostics for file that it doesn’t know how to handle.
-
Add a new
"javascript"option to support the unsafe/experimental parameter decorators:{"javascript": {"parser": {"unsafeParameterDecoratorsEnabled": true}}} -
Add a new
"extends"option, useful to split the configuration file in multiple files:{"extends": ["../sharedFormatter.json", "linter.json"]}The resolution of the files is file system based, Biome doesn’t know how to resolve dependencies yet.
-
The commands
biome checkandbiome lintnow show the remaining diagnostics even when--apply-safeor--apply-unsafeare passed. -
Fix the commands
biome checkandbiome lint, they won’t exit with an error code if no error diagnostics are emitted. -
Add a new option
--error-on-warnings, which instructs Biome to exit with an error code when warnings are emitted.Terminal window biome check --error-on-wanrings ./src -
Add a configuration to enable parsing comments inside JSON files:
{"json": {"parser": {"allowComments": true}}}
Editors
Section titled EditorsOther changes
Section titled Other changes-
The Biome LSP can now show diagnostics belonging to JSON lint rules.
-
The Biome LSP no longer applies unsafe quickfixes on-save when
editor.codeActionsOnSave.quickfix.biomeis enabled. -
Fix #4564; files too large don’t emit errors.
-
The Biome LSP sends client messages when files are ignored or too big.
Formatter
Section titled Formatter-
Add a new option called
--jsx-quote-style.This option lets you choose between single and double quotes for JSX attributes.
-
Add the option
--arrow-parentheses.This option allows setting the parentheses style for arrow functions.
-
The JSON formatter can now format
.jsonfiles with comments.
Linter
Section titled LinterRemoved rules
Section titled Removed rules-
Remove
complexity/noExtraSemicolon(#4553)The Biome formatter takes care of removing extra semicolons. Thus, there is no need for this rule.
-
Remove
useCamelCaseUse useNamingConvention instead.
New rules
Section titled New rules-
Add noGlobalIsFinite
This rule recommends using
Number.isFiniteinstead of the global and unsafeisFinitethat attempts a type coercion. -
Add noGlobalIsNan
This rule recommends using
Number.isNaNinstead of the global and unsafeisNaNthat attempts a type coercion. -
Add noUnsafeDeclarationMerging
This rule disallows declaration merging between an interface and a class.
-
This rule disallows useless aliasing of
thisin arrow functions. -
Add useArrowFunction
This rule proposes turning function expressions into arrow functions. Function expressions that use
thisare ignored. -
This rule disallow duplicate keys in a JSON object.
-
Add noVoid
This rule disallows the use of
void. -
This rule disallows
\8and\9escape sequences in string literals. -
This rule disallows useless
export {}. -
Add useIsArray
This rule proposes using
Array.isArray()instead ofinstanceof Array. -
Add useGetterReturn
This rule enforces the presence of non-empty return statements in getters. This makes the following code incorrect:
class Person {get firstName() {}}
Promoted rules
Section titled Promoted rulesNew rules are promoted, please check #4750 for more details:
- a11y/useHeadingContent
- complexity/noForEach
- complexity/useLiteralKeys
- complexity/useSimpleNumberKeys
- correctness/useIsNan
- suspicious/noConsoleLog
- suspicious/noDuplicateJsxProps
The following rules are now recommended:
Other changes
Section titled Other changes-
Add new TypeScript globals (
AsyncDisposable,Awaited,DecoratorContext, and others) 4643. -
noRedeclare: allow redeclare of index signatures are in different type members #4478
Improve noConsoleLog, noGlobalObjectCalls, useIsNan,
and useNumericLiterals by handling globalThis and window
namespaces.
For instance, the following code is now reported by noConsoleLog:
globalThis.console.log("log")-
Improve noDuplicateParameters to manage constructor parameters.
-
Improve noInnerDeclarations
Now, the rule doesn’t report false-positives about ambient TypeScript declarations. For example, the following code is no longer reported by the rule:
declare var foo; -
Improve useEnumInitializers
The rule now reports all uninitialized members of an enum in a single diagnostic.
Moreover, ambient enum declarations are now ignored. This avoids reporting ambient enum declarations in TypeScript declaration files.
declare enum Weather {Rainy,Sunny,} -
Relax noBannedTypes and improve documentation
The rule no longer reports a user type that reuses a banned type name. The following code is now allowed:
import { Number } from "a-lib";declare const v: Number;The rule now allows the use of the type
{}to denote a non-nullable generic type:function f<T extends {}>(x: T) {assert(x != null);}And in a type intersection for narrowing a type to its non-nullable equivalent type:
type NonNullableMyType = MyType & {}; -
Improve noConstantCondition
The rule now allows
while(true). This recognizes a common pattern in the web community:while (true) {if (cond) {break;}} -
Improve the diagnostic and the code action of useDefaultParameterLast.
The diagnostic now reports the last required parameter which should precede optional and default parameters.
The code action now removes any whitespace between the parameter name and its initialization.
-
Relax
noConfusingArrowAll arrow functions that enclose its parameter with parenthesis are allowed. Thus, the following snippet no longer trigger the rule:
var x = (a) => 1 ? 2 : 3;The following snippet still triggers the rule:
var x = a => 1 ? 2 : 3; -
Relax useLiteralEnumMembers
Enum members that refer to previous enum members are now allowed. This allows a common pattern in enum flags like in the following example:
enum FileAccess {None = 0,Read = 1,Write = 1 << 1,All = Read | Write,}Arbitrary numeric constant expressions are also allowed:
enum FileAccess {None = 0,Read = 2**0,Write = 2**1,All = Read | Write,} -
Improve useLiteralKeys.
Now, the rule suggests simplifying computed properties to string literal properties:
{["1+1"]: 2,"1+1": 2,}It also suggests simplifying string literal properties to static properties:
{"a": 0,a: 0,}These suggestions are made in object literals, classes, interfaces, and object types.
-
Improve noNewSymbol.
The rule now handles cases where
Symbolis namespaced with the globalglobalThisorwindow. -
The rules useExhaustiveDependencies and useHookAtTopLevel accept a different shape of options
Old configuration:
{"linter": {"rules": {"nursery": {"useExhaustiveDependencies": {"level": "error","options": {"hooks": [["useMyEffect", 0, 1]]}}}}}}New configuration:
{"linter": {"rules": {"nursery": {"useExhaustiveDependencies": {"level": "error","options": {"hooks": [{"name": "useMyEffect","closureIndex": 0,"dependenciesIndex": 1}]}}}}}} -
noRedundantUseStrict check only
'use strict'directive to resolve false positive diagnostics.React introduced new directives, “use client” and “use server”. The rule raises false positive errors about these directives.
-
Fix a crash in the NoParameterAssign rule that occurred when there was a bogus binding. #4323
-
Fix useExhaustiveDependencies in the following cases #4330:
- when the first argument of hooks is a named function
- inside an export default function
- for
React.usehooks
-
Fix noInvalidConstructorSuper that erroneously reported generic parents #4624.
-
Fix noDuplicateCase that erroneously reported as equals the strings literals
"'"and'"'#4706. -
Fix NoUnreachableSuper’s false positive diagnostics (#4483) caused to nested if statement.
The rule no longer reports
This constructor calls super() in a loopwhen using nested if statements in a constructor. -
Fix useHookAtTopLevel’s false positive diagnostics (#4637)
The rule no longer reports false positive diagnostics when accessing properties directly from a hook and calling a hook inside function arguments.
-
Fix noUselessConstructor which erroneously reported constructors with default parameters rome#4781
-
Fix noUselessFragments’s panics when running
biome check --apply-unsafe(#4637)This rule’s code action emits an invalid AST, so I fixed using JsxString instead of JsStringLiteral
-
Fix noUndeclaredVariables’s false positive diagnostics (#4675)
The semantic analyzer no longer handles
thisreference identifier. -
Fix noUnusedVariables’s false positive diagnostics (#4688)
The semantic analyzer handles ts export declaration clause correctly.
Parser
Section titled Parser-
Add support for decorators in class method parameters, example:
class AppController {get(@Param() id) {}// ^^^^^^^^ new supported syntax}This syntax is only supported via configuration, because it’s a non-standard syntax.
{"javascript": {"parser": {"unsafeParameterDecoratorsEnabled": true}}} -
Add support for parsing comments inside JSON files:
{"json": {"parser": {"allowComments": true}}} -
Add support for the new
usingsyntaxconst using = resource.lock();