Analyzer
Enhancements
- Implement css suppression action. Contributed by @togami2864
- Add support of comments in
turbo.json
. Contributed by @Netail
CLI
New features
- Add
--graphql-linter-enabled
option, to control whether the linter should be enabled or not for GraphQL files. Contributed by @ematipico - The option
--max-diagnostics
now accept anone
value, which lifts the limit of diagnostics shown. Contributed by @ematipico
Enhancements
-
When a
--reporter
is provided, and it's different from the default one, the value provided by via--max-diagnostics
is ignored and the limit is lifted. Contributed by @ematipico -
biome init
now generates a new config file with more options set.
This change intends to improve discoverability of the options and to set the more commonly used options to their default values.
Contributed by Conaclos
Bug fixes
biome lint --write
now takes--only
and--skip
into account (#3470). Contributed by Conaclos
Configuration
- Add support for loading configuration from
.editorconfig
files (#1724). Contributed by @dyc3
Configuration supplied in.editorconfig
will be overridden by the configuration inbiome.json
. Support is disabled by default and can be enabled by adding the following to your formatter configuration inbiome.json
:{ "formatter": { "useEditorconfig": true } }
Formatter
Enhancements
-
Add parentheses for nullcoalescing in ternaries.
This change aligns on Prettier 3.3.3.
This adds clarity to operator precedence.- foo ? bar ?? foo : baz; + foo ? (bar ?? foo) : baz;
Contributed by @Conaclos
Bug fixes
-
Keep the parentheses around
infer
declarations in type unions and type intersections (#3419). Contributed by @Conaclos -
Keep parentheses around a
yield
expression inside a type assertion.Previously, Biome removed parentheses around some expressions that require them inside a type assertion.
For example, in the following code, Biome now preserves the parentheses.function* f() { return <T>(yield 0); }
Contributed by @Conaclos
-
Remove parentheses around expressions that don't need them inside a decorator.
Biome now matches Prettier in the following cases:
class { - @(decorator) + @decorator method() {} }, class { - @(decorator()) + @decorator() method() {} }, class { @(decorator?.()) method() {} },
Contributed by @Conaclos
-
Keep parentheses around objects preceded with a
@satisfies
comment.In the following example, parentheses are no longer removed.
export const PROPS = /** @satisfies {Record<string, string>} */ ({ prop: 0, });
Contributed by @Conaclos
Linter
New features
-
Add support for GraphQL linting. Contributed by @ematipico
-
Add nursery/noDynamicNamespaceImportAccess. Contributed by @minht11
-
noUndeclaredVariables no longer reports a direct reference to an enum member (#2974).
In the following code, the
A
reference is no longer reported as an undeclared variable.enum E { A = 1, B = A << 1, }
Contributed by @Conaclos
-
Add nursery/noIrregularWhitespace. Contributed by @michellocana
-
Implement
noIrreguluarWhitespace
for CSS. Contributed by @DerTimonius -
Add nursery/useTrimStartEnd. Contributed by @chansuke
Enhancements
-
noInvalidUseBeforeDeclaration now reports direct use of an enum member before its declaration.
In the following code,
A
is reported as use before its declaration.enum E { B = A << 1, A = 1, }
Contributed by @Conaclos
-
useFilenamingConvention now supports unicase letters.
unicase letters have a single case: they are neither uppercase nor lowercase.
Biome now accepts filenames in unicase.
For example, the filename안녕하세요
is now accepted.We still reject a name that mixes unicase characters with lowercase or uppercase characters.
For example, the filenameA안녕하세요
is rejected.This change also fixes #3353.
Filenames consisting only of numbers are now accepted.Contributed by @Conaclos
-
useFilenamingConvention now supports Next.js/Nuxt/Astro dynamic routes (#3465).
Next.js, SolidStart, Nuxt, and Astro support dynamic routes such as
[...slug].js
and[[...slug]].js
.Biome now recognizes this syntax.
slug
must contain only alphanumeric characters.Contributed by @Conaclos
-
useExportType no longer report empty
export
(#3535).An empty
export {}
allows you to force TypeScript to consider a file with no imports and exports as an EcmaScript module.
Whileexport type {}
is valid, it is more common to useexport {}
.
Users may find it confusing that the linter asks them to convert it toexport type {}
.
Also, a bundler should be able to removeexport {}
as well asexport type {}
.
So it is not so useful to reportexport {}
.Contributed by @Conaclos
-
noUnusedVariables now checks TypeScript declaration files.
This allows to report a type that is unused because it isn't exported.
Global declarations files (declarations files without exports and imports) are still ignored.Contributed by @Conaclos
Bug fixes
-
Don't request alt text for elements hidden from assistive technologies (#3316). Contributed by @robintown
-
Fix [#3149] crashes that occurred when applying the
noUselessFragments
unsafe fixes in certain scenarios. Contributed by @unvalley -
noExcessiveNestedTestSuites
: Fix another edge case where the rule would alert on heavily nested zod schemas. Contributed by @dyc3 -
noExtraNonNullAssertion
no longer reports a single non-null assertion enclosed in parentheses (#3352). Contributed by @Conaclos -
useAdjacentOverloadSignatures
no longer reports a#private
class member and a public class member that share the same name (#3309).The following code is no longer reported:
class C { #f() {} g() {} f() {} }
Contributed by @Conaclos
-
useNamingConvention now accepts applying custom convention on abstract classes. Contributed by @Conaclos
-
useNamingConvention no longer suggests an empty fix when a name doesn't match strict Pascal case (#3561).
Previously the following code led
useNamingConvention
to suggest an empty fix.
The rule no longer provides a fix for this case.type AAb = any
Contributed by @Conaclos
-
useNamingConvention no longer provides fixes for global TypeScript declaration files.
Global TypeScript declaration files have no epxorts and no imports.
All the declared types are available in all files of the project.
Thus, it is not safe to propose renaming only in the declaration file.Contributed by @Conaclos
Parser
Bug fixes
- Fix #3287 nested selectors with pseudo-classes. Contributed by @denbezrukov
- Fix #3349 allow CSS multiple ampersand support. Contributed by @denbezrukov
.class {
&& {
color: red;
}
}
- Fix #3410 by correctly parsing break statements containing keywords.
Contributed by @ah-yu
out: while (true) { break out; }
What's Changed
Other changes
- fix(codegen): create output directory if it doesn't exist by @dyc3 in #3389
- refactor(codegen): generate most functions on
LanguageKind
with a macro by @dyc3 in #3380 - chore(grit): add auto-wrap + integrate with
search
command by @arendjr in #3288 - refactor(formatter_test): refactor
TestFormatLanguage
trait by @ah-yu in #3395 - feat(css_parser): introduce grit metavariable by @ah-yu in #3340
- feat(lint): add rule
useStrictMode
by @ematipico in #3370 - refactor(js_semantic): use range start to identify the declaration in read/write by @Conaclos in #3404
- chore(grit): add Grit testing infrastructure by @arendjr in #3406
- refactor(js_semantic): wrap scope id for niche optimization and clarity by @Conaclos in #3408
- refactor(js_analyze): improve restricted regex error meesages by @Conaclos in #3412
- refactor(js_semantic): minor changes by @Conaclos in #3416
- fix: fix typo in URL for noEvolvingTypes rule in diagnostics categories by @ynishimura in #3413
- fix(grit): correct calculation of line and column numbers by @arendjr in #3409
- fix(deserialize): unescape JSON strings by @Conaclos in #3414
- refactor(js_semantic): reduce semantic data size and make some cleanup by @Conaclos in #3417
- fix(biome-css-parser): incorrect option name in hint when using
:global
in CSS module by @shulaoda in #3420 - docs(js_semantic): update docs and comments by @Conaclos in #3421
- feat(yaml): more comprehensive grammar by @dyc3 in #3400
- fix(css_parser): fix Parser is no longer progressing #3284 by @denbezrukov in #3433
- fix(deps): update dependency prettier to v3.3.3 by @renovate in #3436
- chore(deps): update github-actions by @renovate in #3435
- chore(deps): update dependency dprint to v0.47.2 by @renovate in #3434
- chore(deps): update dependency eslint to v9.7.0 by @renovate in #3437
- ci: add script to correctly update packages during the release by @ematipico in #3423
- feat(lint): add
useConsistentCurlyBraces
by @dyc3 in #3182 - feat(lint/noStaticElementInteractions): add rule by @ryo-ebata in #2981
- chore: tidy-up licenses by @ematipico in #3438
- feat(graphql_parser): separate binding and reference nodes by @vohoanglong0107 in #3427
- fix(grit): fix matching array types by @arendjr in #3445
- fix(grit): match object literal by @arendjr in #3447
- fix(grit): leaf node normalization by @arendjr in #3448
- refactor: replace
biome_rowan::*
type into biome type by @chansuke in #3431 - chore: add new bronze sponsor by @ematipico in #3449
- chore(grit): compact snapshot range by @arendjr in #3455
- fix(lint/useConsistentCurlyBraces): specify correct language type by @chansuke in #3452
- chore: fix rules check snippet to emit an error code by @ematipico in #3458
- fix(js_analyze): handle shorthand property renaming by @Conaclos in #3454
- fix(lint/useHookAtTopLevel): don't flag jest function calls that look like hooks by @dyc3 in #3415
- fix(grit): improved diagnostics by @arendjr in #3456
- chore: update pnpm and remove workaround by @SuperchupuDev in #3467
- feat: noValueAtRule css lint rule by @rishabh3112 in #3293
- refactor(core): register syntax rules via visitor by @ematipico in #3471
- feat(graphql_semantic): build semantic model from AST by @vohoanglong0107 in #3378
- chore: add myself as maintainer by @dyc3 in #3480
- chore(deps): update rust crate lazy_static to 1.5.0 by @renovate in #3490
- chore(deps): update rust crate bitflags to 2.6.0 by @renovate in #3489
- chore(deps): update pnpm to v9.6.0 by @renovate in #3488
- chore(deps): update softprops/action-gh-release action to v2.0.8 by @renovate in #3487
- chore(deps): update rust crate tokio to 1.38.1 by @renovate in #3486
- chore(deps): update @biomejs packages by @renovate in #3485
- fix: noCommentText does not work when any other text is a child(#3298) by @ryo-ebata in #3446
- refactor(core): register rules using visitor pattern by @ematipico in #3483
- chore(deps): update dependency typescript to v5.5.4 by @renovate in #3502
- chore(deps): update docker/login-action action to v3.3.0 by @renovate in #3503
- chore(deps): update pnpm/action-setup action to v4 by @renovate in #3505
- fix(js_formater): strip useless quotes by @suxin2017 in #3492
- chore(deps): update rust crate similar to 2.6.0 by @renovate in #3504
- chore(deps): update rust crate dashmap to 5.5.3 by @renovate in #3507
- chore(deps): update rust crate ignore to 0.4.22 by @renovate in #3508
- chore(deps): update rust crate bpaf to 0.9.12 by @renovate in #3506
- chore(js_formatter): update prettier compat reports by @Conaclos in #3514
- chore: add silver sponsor by @ematipico in #3517
- chore: new bronze sponsor by @ematipico in #3519
- refactor: consistently use
cast
,cast_ref
andtry_cast
by @Conaclos in #3520 - refactor: remove try_cast_node by @Conaclos in #3521
- refactor(js_formatter): reduce copy by taking ownership in
needs_parentheses_with_parent
by @Conaclos in #3526 - docs: update contributing guidelines according to previous changes by @YuriyBl in #3527
- refactor(js_formatter): remove
NeedsParentheses::needs_parentheses_aith_parent
by @Conaclos in #3528 - refactor(biome_deserialize): use
enumflags2
by @RiESAEX in #3529 - chore(deps): update rust crate serde_json to 1.0.121 by @renovate in #3539
- chore(deps): update dependency eslint to v9.8.0 by @renovate in #3540
- chore(deps): update codspeedhq/action action to v2.4.4 by @renovate in #3538
- chore(deps): update @biomejs packages by @renovate in #3537
- fix(formatter): prevent line break when comment follows end of attributes, irrespective of bracketSameLine value by @satojin219 in #3534
- refactor(js_formatter): move
NeedsParentheses
trait tobiome_js_syntax
by @Conaclos in #3541 - fix(js_formatter): add parens to match Prettier by @Conaclos in #3552
- chore(js_formatter): ignore files with only bogus nodes for generating prettier compat reports by @Conaclos in #3553
- feat(js_parser): support metavariables by @arendjr in #3548
- fix(js_formatter): normalize keys then check if quotes are needed by @Conaclos in #3558
- chore: config Dockerfile.benchmark in gitattributes by @o-az in #3516
- refactor(formatter): improve string normalization by @Conaclos in #3564
- fix(cli): apply offsets for htmlish js file sources by @dyc3 in #3494
- feat(grit): implement variable matching by @arendjr in #3575
New Contributors
- @ynishimura made their first contribution in #3413
- @shulaoda made their first contribution in #3420
- @ryo-ebata made their first contribution in #2981
- @rishabh3112 made their first contribution in #3293
- @YuriyBl made their first contribution in #3527
- @RiESAEX made their first contribution in #3529
- @satojin219 made their first contribution in #3534
- @o-az made their first contribution in #3516
Full Changelog: cli/v1.8.4-nightly.a579bf7...cli/v1.8.4-nightly.bd1d0c6