Analyzer
Enhancements
- Implement css suppression action. Contributed by @togami2864
- Add support of comments in
turbo.json
. Contributed by @Netail - Implement semantic model for CSS. Contributed by @togami2864
- Integrate CSS semantic model into the analyzer. Contributed by @togami2864
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-
Add a new reporter
--reporter=gitlab
, that emits diagnostics for using the GitLab Code Quality report.[ { "description": "Use === instead of ==. == is only allowed when comparing against `null`", "check_name": "lint/suspicious/noDoubleEquals", "fingerprint": "6143155163249580709", "severity": "critical", "location": { "path": "main.ts", "lines": { "begin": 4 } } } ]
Contributed by @NiclasvanEyk
-
-
Add new options to the
lsp-proxy
andstart
commands:--log-path
: a directory where to store the daemon logs. The commands also accepts the environment variableBIOME_LOG_PATH
.--log-prefix-name
: a prefix that's added to the file name of the logs. It defaults toserver.log
. The commands also accepts the environment variableBIOME_LOG_PREFIX_NAME
.
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 -
The
--verbose
flag how reports the list of files that were evaluated, and the list of files that were fixed.
The evaluated files are the those files that can be handled by Biome, files that are ignored, don't have an extension or have an extension that Biome can't evaluate are excluded by this list.
The fixed files are those files that were handled by Biome and changed. Files that stays the same after the process are excluded from this list.VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ℹ Files processed: - biome/biome.json - biome/packages/@biomejs/cli-win32-arm64/package.json - biome/packages/tailwindcss-config-analyzer/package.json VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ℹ Files fixed: - biome/biome/packages/tailwindcss-config-analyzer/src/generate-tailwind-preset.ts
Contributed by @ematipico
Bug fixes
-
biome lint --write
now takes--only
and--skip
into account (#3470). Contributed by @Conaclos -
Fix #3368, now the reporter
github
tracks the diagnostics that belong to formatting and organize imports. Contributed by @ematipico -
Fix #3545, display a warning, 'Avoid using unnecessary Fragment,' when a Fragment contains only one child element that is placed on a new line. Contributed by @satojin219
-
Migrating from Prettier or ESLint no longer overwrite the
overrides
field from the configuration (#3544). Contributed by @Conaclos
Configuration
-
Add support for loading configuration from
.editorconfig
files (#1724).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 } }
Contributed by @dyc3
-
overrides
from an extended configuration is now merged with theoverrides
of the extension.Given the following shared configuration
biome.shared.json
:{ "overrides": [ { "include": ["**/*.json"], // ... } ] }
and the following configuration:
{ "extends": ["./biome.shared.json"], "overrides": [ { "include": ["**/*.ts"], // ... } ] }
Previously, the
overrides
frombiome.shared.json
was overwritten.
It is now merged and results in the following configuration:{ "extends": ["./biome.shared.json"], "overrides": [ { "include": ["**/*.json"], // ... }, { "include": ["**/*.ts"], // ... } ] }
Contributed by @Conaclos
Editors
Bug fixes
- Fix #3577, where the update of the configuration file was resulting in the creation of a new internal project. Contributed by @ematipico
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
JavaScript APIs
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
-
Add nursery/noUselessEscapeInRegex.
Contributed by @Conaclos
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
-
noBlankTarget now supports an array of allowed domains.
The following configuration allows
example.com
andexample.org
as blank targets."linter": { "rules": { "a11y": { "noBlankTarget": { "level": "error", "options": { "allowDomains": ["example.com", "example.org"] } } } } }
Contributed by @Jayllyz
-
noNodejsModules now ignores type-only imports (#1674).
The rule no longer reports type-only imports such as:
import type assert from "assert"; import type * as assert2 from "assert";
Contributed by @Conaclos
-
noNodejsModules now ignores imports of a package which has the same name as a Node.js module. 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 -
noRedeclare no longer report redeclartions for lexically scoped function declarations #3664.
In JavaScript strict mode, function declarations are lexically scoped:
they cannot be accessed outside the block where they are declared.In non-strict mode, function declarations are hoisted to the top of the enclosing function or global scope.
Previously Biome always hoisted function declarations.
It now takes into account whether the code is in strict or non strict mode.Contributed by @Conaclos
-
noMultipleSpacesInRegularExpressionLiterals now correctly provides a code fix when unicode characters are used.
-
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
-
suspicious/noControlCharactersInRegex now corretcly handle
\u
escapes in unicode-aware regexes.Previously, the rule didn't consider regex with the
v
flags as unicode-aware regexes.
Moreover,\uhhhh
was not handled in unicode-aware regexes.Contributed by @Conaclos
-
suspicious/noControlCharactersInRegex now reports control characters and escape sequence of control characters in string regexes. Contributed by @Conaclos
-
useSortedClasses lint error with Template literals (#3394). Contributed by @hangaoke1
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
- chore(deps): update github-actions by @renovate in #3587
- chore(deps): update dependency @types/node to v20.14.14 by @renovate in #3586
- chore: add korean readme translation by @Procrustes5 in #3581
- chore(deps): update rust crate tokio to 1.39.2 by @renovate in #3592
- chore(deps): update rust docker tag to v1.80.0 by @renovate in #3593
- chore(deps): update rust crate indexmap to 2.3.0 by @renovate in #3590
- chore(deps): update rust crate serde_json to 1.0.122 by @renovate in #3589
- chore(deps): update rust crate regex to 1.10.6 by @renovate in #3588
- fix(lint/useNumberNamespace): show correct message for
Infinity
type by @errmayank in #3579 - chore: upgrade to Rust 1.80.0 by @ematipico in #3584
- feat(analyzer): assists by @ematipico in #3399
- chore(deps): update rust crate oxc_resolver to 1.10.2 by @renovate in #3591
- fix(grit): equivalence tests + minor fixes by @arendjr in #3595
- fix(grit): add code snippet bindings by @arendjr in #3601
- fix(grit): resolve
todo!
()s ingrit_resolved_pattern.rs
by @arendjr in #3603 - chore: ensure consistent naming for GitLab-related structs and types by @Yudai-Saito in #3607
- feat(css_semantic): build semantic model for css by @togami2864 in #3546
- refactor: remove
lazy_static
by @ematipico in #3611 - docs: remove the emtpty bullet on
biome_analyze/CONTRIBUTING.md
by @chansuke in #3614 - refactor: remove PlainIdentStyle by @Conaclos in #3618
- feat(css_semantic): handle @media and nested selectors correctly by @togami2864 in #3630
- chore: fix the rule template by @togami2864 in #3631
- chore: fix typo in registry by @K-tecchan in #3632
- chore(deps): update rust crates by @renovate in #3640
- chore: rename rule by @ematipico in #3645
- ci: use
cargo t
instead ofnextest
by @ematipico in #3646 - docs: correct diagnostic for rule by @ematipico in #3647
- chore(deps): update rust crate serde to 1.0.207 by @renovate in #3638
- chore(deps): update rust docker tag to v1.80.1 by @renovate in #3641
- feat(biome_rowan): make SyntaxSlots pub by @arialpew in #3652
- fix(graphql_analyzer): use the correct macro to declare rule by @vohoanglong0107 in #3654
- chore(deps): update @biomejs packages by @renovate in #3636
- chore: document options section in analyze contributions guide by @Jayllyz in #3655
- chore: update issue templates with reproduction by @ematipico in #3656
- fix(lint/sources): update sources renamed rules by @Jayllyz in #3658
- fix(lint/noStaticOnlyClass): prevent error on static classes that extend other classes by @errmayank in #3626
- chore(deps): update @biomejs packages by @renovate in #3680
- chore(deps): update rust crate indexmap to 2.4.0 by @renovate in #3681
- chore(deps): update rust:1.80.1 docker digest to 29fe437 by @renovate in #3676
- chore(deps): update rust crate serde to 1.0.208 - autoclosed by @renovate in #3677
- chore(deps): update rust crate tokio to 1.39.3 by @renovate in #3678
- feat(lsp): deprecate
biome.rename
in favor ofbiome.experimental.rename
by @nhedger in #3669 - chore: update biome_js_analyze/lint/complexity/use_optional_chain to use js tag instead of ts by @dwaneivan in #3683
- fix(deps): update rust crates by @renovate in #3679
- fix(noUselessCatch): fix code action panics by @Conaclos in #3684
- feat(css_semantic): store global declared css variables by @togami2864 in #3666
- fix(noUselessEscapeInRegex): don't report unescaped range sep at the end of a class by @Conaclos in #3687
- fix(noCommentText): don't report URIs by @Conaclos in #3688
- chore(deps): update rust crate serde_json to 1.0.125 by @renovate in #3639
- chore(deps): update actions/upload-artifact action to v4.3.6 by @renovate in #3637
New Contributors
- @Procrustes5 made their first contribution in #3581
- @errmayank made their first contribution in #3579
- @NiclasvanEyk made their first contribution in #3027
- @Yudai-Saito made their first contribution in #3607
- @hangaoke1 made their first contribution in #3472
- @arialpew made their first contribution in #3652
- @dwaneivan made their first contribution in #3683
Full Changelog: cli/v1.8.4-nightly.bd1d0c6...cli/v1.8.4-nightly.d079e53