- Fix #4323, where
lint/a11y/useSemanticElementaccidentally showed recommendations forrole="searchbox"instead ofrole="search"
Analyzer
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
.vscodedirectory (#4391). Contributed by @Conaclos -
biome migrate eslintnow correctly resolves scoped package namedeslint-configwith a path.
Contributed by @Conaclos -
biome migrate eslintnow 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
Configuration
Editors
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
JavaScript APIs
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.tsis valid because the first captureindexis incamelCaseand the second captured.tsinclude dot-separated values inlowercase.
On the other hand,%Index.d.tsis not valid because the first captureIndexis inPascalCase.Note that specifying
matchdisallows 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
matchoptions now accept case-insensitive and case-sensitive groups.By default, the regular expression in
matchis case-sensitive.
You can now make it case-insensitive by using a case-insensitive group(?i:).
For example, the regular expression(?i:a)matchesaandA.Contributed by @Conaclos
-
noUndeclaredVariables now provides the
checkTypesoption (#3998).noUndeclaredVariablesis 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.globalsoption 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-undefESLint rule.This is why we introduce today a new option
checkTypeswhich, when it is set tofalse, ignores undeclared type references.
Given the following configuration...{ "linter": { "rules": { "correctness": { "noUndeclaredVariables": { "level": "error", "options": { "checkTypes": false } } } } } }...
UndeclaredTypeis 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
-
useExportTypeanduseImportTypenow 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
-
noUnusedImportsnow 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
-
noUnusedImportsnow 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
-
useValidTypeofnow accepts comparisons with variables.Previously, the rule required to compare a
typeofexpression against anothertypeofexpression 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
Arrayconstructors.Previously, the rule reported only use of the
Arrayconstructor 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,
Ais now correctly bound to the type-only import.
Previously,Awas 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
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_LITERALproperlyfunction 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
- refactor(enovate): ignore hashbrown and grit by @Conaclos in #4604
- fix: fix translation links by @denbezrukov in #4603
- docs(biome_js_analyze): improve biome_analyze/CONTRIBUTING.md by @cr7pt0gr4ph7 in #4572
- refactor(aria): add abstractions for attribute lookup by @Conaclos in #4523
- perf(linter): use binary_search instead of contains by @togami2864 in #4446
- fix(deps): update rust crates by @renovate in #4406
- refactor(retsricted_glob): add
matches_directory_with_exceptionsby @Conaclos in #4608 - feat(noRestrictedImports): add import_names and allow_import_names settings by @cr7pt0gr4ph7 in #4596
- chore: move dyc3 to core contributors by @dyc3 in #4620
- chore(deps): update @biomejs packages by @renovate in #4627
- chore(deps): update dependency @typescript-eslint/eslint-plugin to v8.15.0 by @renovate in #4628
- chore(deps): update softprops/action-gh-release action to v2.1.0 by @renovate in #4631
- chore(deps): update pnpm to v9.14.2 by @renovate in #4630
- chore(deps): update dependency eslint to v9.15.0 by @renovate in #4629
Full Changelog: cli/v1.9.5-nightly.c0cccb2...cli/v1.9.5-nightly.81fdedb