CLI v1.9.5-nightly.c0cccb2
Pre-releaseAnalyzer
Bug fixes
- Fix CSS parser case error,
@-moz-document url-prefix(https://example.com)
and@-moz-document domain(example.com)
are now valid. Contributed by @eryue0220 - Fix #4258, where fixed css parse error with @-moz-document url-prefix(). Contributed by @eryue0220
CLI
Bug fixes
-
Don't parse the files that don't end with the json extension as JSON files in the
.vscode
directory (#4391). Contributed by @Conaclos -
biome migrate eslint
now correctly resolves scoped package namedeslint-config
with a path.
Contributed by @Conaclos -
biome migrate eslint
now correctly handles shared ESLint configuration that don't follow the ESLint naming convention (#4528).ESLint recommends that a package that exports a shared configuration be prefixed with
eslint-config-
or simply namedeslint-config
.
This is only a recommendation.
Packages that export shared configurations can have arbitrary names.
Biome is now able to load any package.Contributed by @Conaclos
Formatter
- Fix #4413, where the GraphQL formatter adds a new line at the start of block comments on Windows. Contributed by @vohoanglong0107
Bug fixes
-
Fix #4121, don't ident a CSS selector when has leading comments. Contributed by @fireairforce
-
Fix #4334, don't insert trailing comma on type import statement. Contributed by @fireairforce
-
Fix #3229, where Biome wasn't idempotent when block comments were placed inside compound selectors. Contributed by @ematipico
-
Fix #4026, don't move comments in
grid-template
. Contributed by @fireairforce -
Fix #4533, don't throw error when pseudeo class after a webkit scrollbar pseudeo element.
The follow code will not report:
::-webkit-scrollbar-thumb:hover {}
Contributed by @fireairforce
Linter
New features
-
Add noUselessUndefined. Contributed by @unvalley
-
useFilenamingConvention accepts a new option
match
(#4105).You can now validate filenames with a regular expression.
For instance, you can allow filenames to start with%
:{ "linter": { "rules": { "style": { "useFilenamingConvention": { "level": "warn", "options": { "match": "%?(.+?)[.](.+)", "filenameCases": ["camelCase"] } } } } } }
If the regular expression captures strings, the first capture is considered to be the name of the file, and the second one to be the extensions (dot-separated values).
The name of the file and the extensions are checked againstfilenameCases
.
Given the previous configuration, the filename%index.d.ts
is valid because the first captureindex
is incamelCase
and the second captured.ts
include dot-separated values inlowercase
.
On the other hand,%Index.d.ts
is not valid because the first captureIndex
is inPascalCase
.Note that specifying
match
disallows any exceptions that are handled by the rule by default.
For example, the previous configuration doesn't allow filenames to be prefixed with underscores,
a period or a plus sign.
You need to include them in the regular expression if you still want to allow these exceptions.Contributed by @Conaclos
-
useFilenamingConvention and useNamingConvention
match
options now accept case-insensitive and case-sensitive groups.By default, the regular expression in
match
is case-sensitive.
You can now make it case-insensitive by using a case-insensitive group(?i:)
.
For example, the regular expression(?i:a)
matchesa
andA
.Contributed by @Conaclos
-
noUndeclaredVariables now provides the
checkTypes
option (#3998).noUndeclaredVariables
is inspired by the no-undef ESLint rule. It reports all references that are not bound to any declarations within a module.
Node.js, JavaScript and TypeScript globals are ignored.
Biome provides thejavascript.globals
option to list additional globals that should be ignored by the rule.In TypeScript projects, developers often use global declaration files to declare global types.
Biome is currently unable to detect these global types.
This creates many false positives fornoUndeclaredVariables
.TypeScript is better suited to perform this kind of check.
As proof of this, TypeScript ESLint doesn't provide any rule that extends theno-undef
ESLint rule.This is why we introduce today a new option
checkTypes
which, when it is set tofalse
, ignores undeclared type references.
Given the following configuration...{ "linter": { "rules": { "correctness": { "noUndeclaredVariables": { "level": "error", "options": { "checkTypes": false } } } } } }
...
UndeclaredType
is not reported by the rule.export default function(): UndeclaredType {}
We plan to turn off the option by default in Biome 2.0
Also, this will bring the Biome rule closer to the no-undef ESLint rule.Contributed by @Conaclos
-
Add noGlobalDirnameFilename. Contributed by @unvalley
Enhancements
-
useExportType
anduseImportType
now ignore TypeScript declaration files (#4416). Contributed by @Conaclos -
useArrayLiterals now provides a code fix.
- const xs = new Array(); + const xs = [];
The code fix is currently marked as unsafe.
We plan to make it safe in a future release of Biome.Contributed by @Conaclos
-
noUnusedImports
now reports empty named imports and suggests its removal (#3574).The rule now suggests the removal of empty named imports such as:
- import {} from "mod";
Contributed by @Conaclos
-
noUnusedImports
now keeps comments separated from the import with a blank line (#3401).Here is an example:
// Orphan comment - // Header comment - import {} from "mod";
Contributed by @Conaclos
-
useValidTypeof
now accepts comparisons with variables.Previously, the rule required to compare a
typeof
expression against anothertypeof
expression or a valid string literal.
We now accept more cases, notably comparison against a variable:if (typeof foo === bar) { // ... }
Contributed by @Conaclos
-
noUnknownProperty now accepts more known CSS properties (#4549).
- ['anchor-default', 'anchor-scroll', 'inset-area', 'position-animation', 'position-fallback', 'position-fallback-bounds', 'position-try-options'] + ['anchor-scope', 'interpolate-size', 'line-fit-edge', 'masonry', 'masonry-auto-tracks', 'masonry-direction', 'masonry-fill', 'masonry-flow', 'masonry-slack', 'masonry-template-areas', 'masonry-template-tracks', 'position-anchor', 'position-area', 'position-try-fallbacks', 'position-visibility', 'scroll-start-target', 'text-box', 'view-transition-class', 'view-transition-group']
This change replaces deprecated properties, improving CSS validation.
Contributed by @lucasweng
Bug fixes
-
noControlCharactersInRegex no longer panics when it encounters an unterminated unicode escape sequence (#4565). Contributed by @Conaclos
-
useArrayLiterals now reports all expressions using the
Array
constructors.Previously, the rule reported only use of the
Array
constructor in expressions statements.// This was reported new Array(); // This was not reported const xs = new Array();
Contributed by @Conaclos
-
useArrowFunction now preserves directives (#4530).
Previously the rule removed the directives when a function expression was turned into an arrow function.
The rule now correctly keeps the directives.- const withDirective = function () { + const withDirective = () => { "use server"; return 0; }
Contributed by @Conaclos
-
noUndeclaredVariables is now able to bind read of value to a type-only import in ambient contexts (#4526).
In the following code,
A
is now correctly bound to the type-only import.
Previously,A
was reported as an undeclared variable.import type { A } from "mod"; declare class B extends A {}
Contributed by @Conaclos
-
noUnusedVariables no longer reports top-level variables in a global declaration file as unused. Contributed by @Conaclos
-
useNamingConvention no longer suggests renaming top-level variables in a global declaration file. Contributed by @Conaclos
-
noMisleadingCharacterClass no longer panics on malformed escape sequences that end with a multi-byte character (#4587). Contributed by @Conaclos
-
noUnusedImports no longer reports used values imported as types in an external module ([#3895])(#3895). Contributed by @Conaclos
-
Fixed a panic related to bogus import statements in
useExhaustiveDependencies
(#4568) Contributed by @dyc3 -
Fix #4323, where
lint/a11y/useSemanticElement
accidentally showed recommendations forrole="searchbox"
instead ofrole="search"
Parser
Bug fixes
-
Fix #4317, setter parameter can contain a trailing comma, the following example will now parsed correctly:
export class DummyClass { set input( value: string, ) {} }
Contributed by @fireairforce
-
Fix #3836, css parser allow multiple semicolons after a declaration, the following example will now parsed correctly:
.foo { color: red;; }
Contributed by @fireairforce
-
Fix #342, js parser handle unterminated
JSX_STRING_LITERAL
properlyfunction Comp() { return ( <a rel="
-
Fix #342, js parser is no longer progressing for an invalid object
member name:({ params: { [paramName: string]: number } = {} })
Contributed by @denbezrukov
-
Fix #342, "expected a declaration as guaranteed by is_at_ts_declare_statement" error for declare interface:
declare interface
Contributed by @denbezrukov
-
Don't panic when a multi-byte character is found in a unicode escape sequence (#4564). Contributed by @Conaclos
-
Don't panic when a declare statement is followed by an unexpected token.(#4562). Contributed by @fireairforce
What's Changed
Other changes
- fix(deps): update dependency happy-dom to v15.10.1 [security] by @renovate in #4480
- fix(deps): update dependency happy-dom to v15.10.2 [security] by @renovate in #4482
- refactor(aria): move properties to aria-metdata by @Conaclos in #4481
- refactor(aria): generate role metadata by @Conaclos in #4488
- fix(js_analyze): skip
noAutofocus
check if eligible by @seeintea in #4475 - fix(linter): improve diagnostic for
noConstructorReturn
by @arendjr in #4492 - feat(aria-data): add DPub and Graphics modules by @Conaclos in #4497
- chore(deps): update rust crate insta to 1.41.1 by @renovate in #4503
- chore(deps): update rust crate tokio to 1.41.1 by @renovate in #4504
- docs(linter): include advice on the singleton pattern with
noConstructorReturn
by @arendjr in #4510 - chore(deps): update codspeedhq/action action to v3.1.0 by @renovate in #4500
- chore(deps): update rust crate anyhow to 1.0.93 by @renovate in #4499
- chore(deps): update dependency @typescript-eslint/eslint-plugin to v8.13.0 by @renovate in #4501
- refactor(aria): use aria metadata to find equivalent HTML element by @Conaclos in #4495
- chore(deps): update rust docker tag to v1.82.0 by @renovate in #4505
- chore(deps): update dependency eslint to v9.14.0 - autoclosed by @renovate in #4502
- refactor(js_syntax): minor clean up by @Conaclos in #4513
- refactor(useValidAutocomplete): use Ast query instead of Aria by @Conaclos in #4516
- feat(grit): add more formatting nodes by @ematipico in #4515
- fix(deps): update @biomejs packages by @renovate in #4506
- refactor(aria): add AriaRole::from_roles by @Conaclos in #4521
- feat(grit): complete formatting of all nodes by @ematipico in #4520
- feat(grit): add range formatting by @ematipico in #4525
- feat(useExplicitType): implement support for methods and functions wi… by @kaykdm in #4535
- fix(json_parser): fix broken
JsonParserOptions::from(&JsonFileSource)
implementation by @cr7pt0gr4ph7 in #4540 - refactor(js_syntax): add
TsDeclarationModule
node by @Conaclos in #4546 - feat(rules_check): validate the option examples for rules by @cr7pt0gr4ph7 in #4542
- chore(deps): update rust crate serde_json to 1.0.133 by @renovate in #4558
- chore(deps): update rust:1.82.0 docker digest to d9c3c6f by @renovate in #4555
- docs: improve
README.md
's structure by @okineadev in #4550 - chore(deps): update pnpm to v9.13.2 by @renovate in #4561
- chore(deps): update rust crate serde to 1.0.215 by @renovate in #4556
- fix(deps): update @biomejs packages by @renovate in #4559
- fix(biome_js_analyze): use consistent code action markup for noAria*/useAria* by @cr7pt0gr4ph7 in #4571
- chore(deps): update dependency @typescript-eslint/eslint-plugin to v8.14.0 by @renovate in #4560
- fix(js_semantic): scope for TsDeclarationModule by @Conaclos in #4580
- chore: add arendjr to lead team by @arendjr in #4581
- feat: translation of the @biomejs/biome package readme into Russian by @e965 in #4582
- refactor(js_semantic): reduce BindingInfo size by @Conaclos in #4589
- fix: added a missing link to the English README in the Russian translation by @e965 in #4591
- refactor(biome_console): add blanket implementation of
biome_console::fmt::Display
forBox<_>
by @cr7pt0gr4ph7 in #4599 - feat: 🌍 add Ukrainian translation of README.md by @okineadev in #4573
New Contributors
- @seeintea made their first contribution in #4475
- @cr7pt0gr4ph7 made their first contribution in #4540
- @okineadev made their first contribution in #4550
- @e965 made their first contribution in #4582
Full Changelog: cli/v1.9.5-nightly.ff02a0b...cli/v1.9.5-nightly.c0cccb2