Analyzer
Bug fixes
-
Fix #1748. Now for the following case we won't provide an unsafe fix for the
noNonNullAssertion
rule:x[y.z!];
Contributed by @ah-yu
-
Fix #1081. The
useAwait
rule does not reportfor await...of
. Contributed by @unvalley
CLI
New features
-
Add a new command
biome migrate prettier
. The command will read the file.prettierrc
/prettier.json
and.prettierignore
and map its configuration to Biome's one.
Due to the different nature of.prettierignore
globs 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
--linter
tobiome rage
. The option needs to check Biome linter configuration. Contributed by @seitarof -
Add an option
--formatter
tobiome rage
. The option needs to check Biome formatter configuration. Contributed by @seitarof
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 completly skip the content of ignored directories. -
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
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
Configuration
New features
-
Add the ability to resolve the configuration files defined inside
extends
from thenode_modules/
directory.If you want to resolve a configuration file that matches the specifier
@org/configs/biome
, then yourpackage.json
file must look this:{ "name": "@org/configs", "exports": { "./biome": "./biome.json" } }
And the
biome.json
file 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
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
New features
-
Biome now allows to format the
package.json
file. 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
attributePosition
that have similar behavior as PrettiersingleAttributePerLine
#1706. Contributed by @octoshikari -
Add partial for
.astro
files. Biome is able to format the frontmatter of the Astro files. Contributed by @ematipico--- - statement ( ); + statement(); --- <div></div>
-
Add partial for
.vue
files. 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
.svelte
files. Biome is able to format the script block of Svelte files. Contributed by @ematipico<script setup lang="ts"> - statement ( ); + statement(); </script/> <div></div>
Bug fixes
-
Fix #1039. Check unicode width instead of number of bytes when checking if regex expression is a simple argument. Contributed by @kalleep
This no longer breaks.
s(/🚀🚀/).s().s();
-
Fix #1218, by correctly preserving empty lines in member chains. Contributed by @ah-yu
JavaScript APIs
Linter
BREAKING CHANGES
-
useNamingConvention and useFilenamingConvention now require identifiers to be in ASCII and without consecutive delimiters.
Set the
requireAscii
rule option tofalse
to allow non-ASCII identifiers.{ "linter": { "rules": { "style": { "useNamingConvention": { "options": { "requireAscii": false } } }, "nursery": { "useFilenamingConvention": { "options": { "requireAscii": false } } } } } }
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
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
-
Add rule noNamespaceImport, to report namespace imports:
import * as foo from "foo";
Contributed by @unvalley
-
Add partial support for
.astro
files. Biome is able to lint and fix the frontmatter of the Astro files. Contributed by @ematipico--- - delete a.b + a.b = undefined --- <div></div>
-
Add partial support for
.vue
files. Biome is able to lint and fix the script block of the Vue files. Contributed by @nhedger<script setup lang="ts"> - delete a.b + a.b = undefined <script> <template></template>
-
Add rule useNodeAssertStrict, which promotes the use of
node:assert/strict
overnode:assert
. Contributed by @ematipico
Enhancements
-
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; // LOG10E
Contributed 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
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> : T
Contributed 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
a
as 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
useForOf
to 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
noDelete
doesn't trigger when deleting a dataset:delete element.dataset.prop;
Contributed by @ematipico
Parser
Bug fixes
-
Fix #1728. Correctly parse the global declaration when the
{
token is on the line following theglobal
keyword.Now the following code is correctly parsed:
declare global { } declare module foo { global { } }
Contributed by @ah-yu
-
Fix #1730. Correctly parse
delete
expressions with operands that are not simple member expressions.delete(a.b); delete console.log(1); delete(() => {});
Contributed by @printfn
What's Changed
Other changes
- ci: update oudated actions by @ematipico in #1809
- docs: translate "differences-with-prettier" and "option-philosophy" for Simplified Chinese by @ikxin in #1810
- chore: remove funding file by @ematipico in #1816
- fix(cli): apply linter logic to CI command by @ematipico in #1804
- fix(core): allow invalid reference casting by @ematipico in #1817
- feat(lint): partial support for tagged templates by @ematipico in #1818
- docs: update vscode setting docs by @araphiel in #1828
- chore(lint/noReExportAll): add RuleSource and edit lint message by @unvalley in #1831
- docs(lint/useImportRestrictions): fix the rule source by @unvalley in #1832
- fix(website): show eslint-plugin-import-access link name by @mehm8128 in #1836
- feat(css_parser): CSS Parser property at rule by @bjoroen in #1838
- docs: improve documentation of
--config-path
by @hytromo in #1844 - docs: Update website for --config-path disabling default resolution method by @hytromo in #1847
- feat(website): improve formatter performance progress bar by @unvalley in #1840
- feat(linter): lint vue script blocks by @nhedger in #1842
- chore: add
togami2864
to maintainers team by @togami2864 in #1849 - fix: remove remaining semicolon from the autofix of noConsole/noConsoleLog by @togami2864 in #1850
- refactor(deserializable_macros): idiomatic attribute parsing by @Conaclos in #1851
- fix(website): make playground's control flow graph scrollable by @ah-yu in #1855
- refactor(lint/noFocusedTests): report
fdescribe
andfit
by @lucasweng in #1858 - feat(deserializable_macro): add
from
andtry_from
attributes by @Conaclos in #1853 - refactor(website): Upgrade dependencies and use
StarlightPage
component by @Yan-Thomas in #1854 - perf(cli): reduce memory footprint of diagnostic printer by @ematipico in #1857
- refactor:
noFocusedTests
code fix by @vasucp1207 in #1864 - fix(website): generate RSS feed again by @Yan-Thomas in #1868
- Copy button with code component from starlight by @eyubkh in #1866
- fix(website):
npm
install command by @Sec-ant in #1874 - fix(lint/useValidAnchor): fix progressively enhanced anchors are flagged by @vasucp1207 in #1870
- refactor(css_parser): Use tokens for checking end lists by @denbezrukov in #1852
- chore(css_parser): remove properties by @denbezrukov in #1877
New Contributors
- @ikxin made their first contribution in #1810
- @araphiel made their first contribution in #1828
- @yndajas made their first contribution in #1823
- @bjoroen made their first contribution in #1838
- @hytromo made their first contribution in #1844
Full Changelog: cli/v1.5.3-nightly.dca6a7a...cli/v1.5.3-nightly.69f9031