@biomejs/biome
Advanced tools
Changelog
1.4.1 (2023-11-30)
package.json
, tsconfig.json
, etc.Fix some accidental line breaks when printing array expressions within arrow functions and other long lines #917. Contributed by @faultyserver
Match Prettier's breaking strategy for ArrowChain
layouts #934.
Contributed by @faultyserver
Fix double-printing of leading comments in arrow chain expressions #951. Contributed by @faultyserver
noSvgWithoutTitle
should skip elements that
have aria-hidden
attributes. Contributed by @vasucp1207Address #924
and #920. noUselessElse
now ignores else
clauses that follow at least one if
statement that doesn't break early. Contributed by @Conaclos
For example, the following code is no longer reported by the rule:
function f(x) {
if (x < 0) {
// this `if` doesn't break early.
} else if (x > 0) {
return x;
} else {
// This `else` block was previously reported as useless.
}
}
Fix #918. useSimpleNumberKeys no longer repports false positive on comments. Contributed by @kalleep
Fix #953. noRedeclare no longer reports type parameters with the same name in different mapped types as redeclarations. Contributed by @Conaclos
Fix #608. useExhaustiveDependencies no longer repports missing dependencies for React hooks without dependency array. Contributed by @kalleep
Changelog
1.4.0 (2023-11-27)
Remove the CLI options from the lsp-proxy
, as they were never meant to be passed to that command. Contributed by
@ematipico
Add option --config-path
to lsp-proxy
and start
commands. It's now possible to tell the Daemon server to
load biome.json
from a custom path. Contributed by @ematipico
Add option --diagnostic-level
. It lets users control the level of diagnostics printed by the CLI. Possible values
are: "info"
, "warn"
, and "hint"
. Contributed by @simonxabris
Add option --line-feed
to the format
command. Contributed by @SuperchupuDev
Add option --bracket-same-line
to the format
command. Contributed by @faultyserver
Add option --bracket-spacing
to the format
command. Contributed by @faultyserver
format
, now it returns a non-zero exit code when if there pending diffs. Contributed by @ematipicoAdd the configuration formatter.lineFeed
. It
allows changing the type of line endings. Contributed by @SuperchupuDev
Add the
configuration javascript.formatter.bracketSameLine
.
It allows controlling whether ending >
of a multi-line JSX element should be on the last attribute line or
not. #627. Contributed by @faultyserver
Add the
configuration javascript.formatter.bracketSpacing
.
It allows controlling whether spaces are inserted around the brackets of object
literals. #627. Contributed by @faultyserver
Fix #832, the formatter no longer keeps an unnecessary trailing comma in type parameter lists. Contributed by @Conaclos
- class A<T,> {}
+ class A<T> {}
Fix #301, the formatter should not break before the in
keyword.
Contributed by @ematipico
The following rules are now recommended:
The following rules are now deprecated:
Add noDefaultExport which disallows export default
.
Contributed by @Conaclos
Add noAriaHiddenOnFocusable which reports hidden and focusable elements. Contributed by @vasucp1207
Add noImplicitAnyLet that reports variables declared
with let
and without initialization and type annotation. Contributed by @TaKO8Ki and @b4s36t4
Add useAwait that reports async
functions that don't use an await
expression.
Add useValidAriaRole. Contributed by @vasucp1207
Add useRegexLiterals that suggests turning call to the regex constructor into regex literals. COntributed by @Yuiki
Fix #639 by ignoring unused TypeScript's mapped key. Contributed by @Conaclos
Fix #565 by handling several infer
with the same name in extends
clauses of TypeScript's conditional types. Contributed by @Conaclos
Fix #653. noUnusedImports
now correctly removes the entire line where the unused import
is. Contributed by @Conaclos
Fix #607 useExhaustiveDependencies
, ignore optional chaining,
Contributed by @msdlisper
Fix #676, by using the correct node for the "noreferrer"
when
applying the code action. Contributed by @ematipico
Fix #455. The CLI can now print complex emojis to the console correctly.
Fix #727. noInferrableTypes
now correctly keeps type annotations when the initialization expression is null
. Contributed by @Conaclos
Fix #784, noSvgWithoutTitle
fixes false-positives to aria-label
and reports svg's role attribute is implicit. Contributed by @unvalley
Fix #834 that made noUselessLoneBlockStatements reports block statements of switch clauses. Contributed by @vasucp1207
Fix #783 that
made noUselessLoneBlockStatements reports block
statements of try-catch
structures. Contributed by @hougesen
Fix #69 that
made correctness/noUnnecessaryContinue incorrectly reports
a continue
used to break a switch clause. Contributed by @TaKO8Ki
Fix #664 by improving the diagnostic of style/useNamingConvention when double capital are detected in strict camel case mode. Contributed by @vasucp1207
Fix #643 that erroneously parsed the option of complexity/useExhaustiveDependencies. Contributed by @arendjr
<const T,>() => {}
as a JSX tag
instead of an arrow function when both TypeScript and JSX are enabled.Changelog
1.3.3 (2023-10-31)
void
type is used in a generic type parameter. Contributed by @unvalleyoverrides
behave. Now ignore
and include
apply or not the override pattern, so they override each other.
Now the options inside overrides
override the top-level options.overrides
are run. The properties ignore
and include
have different semantics and only apply/not apply
an override. Contributed by @ematipicoApply the correct layout when the right hand of an assignment expression is an await
expression or a yield
expression. Contributed by @ematipico
Fix #303, where nested arrow functions didn't break. Contributed by @victor-teles
Fix #175 which made noRedeclare report index signatures using the name of a variable in the parent scope.
Fix #557 which
made noUnusedImports report imported types used in typeof
expression. Contributed by @Conaclos
Fix #576 by removing some erroneous logic in noSelfAssign. Contributed by @ematipico
Fix #861 that made noUnusedVariables always reports the parameter of a non-parenthesize arrow function as unused.
Fix #595 by updating unsafe-apply logic to avoid unexpected errors in noUselessFragments. Contributed by @nissy-dev
Fix #591 which made noRedeclare report type parameters with identical names but in different method signatures. Contributed by @Conaclos
Support more a11y roles and fix some methods for a11y lint rules Contributed @nissy-dev
Fix #609 useExhaustiveDependencies
, by removing useContext
, useId
and useSyncExternalStore
from the known hooks. Contributed by @msdlisper
Fix useExhaustiveDependencies
, by removing useContext
, useId
and useSyncExternalStore
from the known hooks.
Contributed by @msdlisper
Fix #871 and #610.
Now useHookAtTopLevel
correctly handles nested functions. Contributed by @arendjr
The options of the rule useHookAtTopLevel
are deprecated and will be removed in Biome 2.0. The rule now determines
the hooks using the naming convention set by React.
{
"linter": {
"rules": {
"correctness": {
+ "useHookAtTopLevel": "error",
- "useHookAtTopLevel": {
- "level": "error",
- "options": {
- "hooks": [
- {
- "name": "useLocation",
- "closureIndex": 0,
- "dependenciesIndex": 1
- },
- { "name": "useQuery", "closureIndex": 1, "dependenciesIndex": 0 }
- ]
- }
- }
}
}
}
}
Changelog
1.3.1 (2023-10-20)
rage
command, now it doesn't print info about running servers. Contributed by @ematipicoFix #548 which made noSelfAssign panic.
Fix #555, by correctly map globals
into the workspace.
Changelog
1.3.0 (2023-10-19)
Import sorting is safe to apply now, and it will be applied when running check --apply
instead
of check --apply-unsafe
.
Import sorting now handles Bun imports bun:<name>
, absolute path imports /<path>
,
and Node's subpath imports #<name>
.
See our documentation for more details. Contributed by @Conaclos
biome lint
now shows the correct options.
Contributed by @ematipicobiome --version
now exits with status code 0
instead of 1
. Contributed by @nhedgerextends
functionality doesn't carry over organizeImports.ignore
. Contributed by @ematipicostdin
and the original content doesn't change. Contributed by
@ematipicoAdd support for BIOME_BINARY
environment variable to override the location of the binary. Contributed by @ematipico
Add option --indent-width
, and deprecated the option --indent-size
. Contributed by @ematipico
Add option --javascript-formatter-indent-width
, and deprecated the option --javascript-formatter-indent-size
.
Contributed by @ematipico
Add option --json-formatter-indent-width
, and deprecated the option --json-formatter-indent-size
. Contributed by
@ematipico
Add option --daemon-logs
to biome rage
. The option is required to view Biome daemon server logs. Contributed by
@unvalley
Add support for logging. By default, Biome doesn't log anything other than diagnostics. Logging can be enabled with
the new option --log-level
:
biome format --log-level=info ./src
There are four different levels of logging, from the most verbose to the least verbose: debug
, info
, warn
and error
. Here's how an INFO
log will look like:
2023-10-05T08:27:01.954727Z INFO Analyze file ./website/src/playground/components/Resizable.tsx
at crates/biome_service/src/file_handlers/javascript.rs:298 on biome::worker_5
in Pulling diagnostics with categories: RuleCategories(SYNTAX)
in Processes formatting with path: "./website/src/playground/components/Resizable.tsx"
in Process check with path: "./website/src/playground/components/Resizable.tsx"
You can customize how the log will look like with a new option --log-kind
. The supported kinds
are: pretty
, compact
and json
.
pretty
is the default logging. Here's how a compact
log will look like:
2023-10-05T08:29:04.864247Z INFO biome::worker_2 Process check:Processes linting:Pulling diagnostics: crates/biome_service/src/file_handlers/javascript.rs: Analyze file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx" categories=RuleCategories(LINT)
2023-10-05T08:29:04.864290Z INFO biome::worker_7 Process check:Processes formatting: crates/biome_service/src/file_handlers/javascript.rs: Format file ./website/src/playground/components/Tabs.tsx path="./website/src/playground/components/Tabs.tsx" path="./website/src/playground/components/Tabs.tsx"
2023-10-05T08:29:04.879332Z INFO biome::worker_2 Process check:Processes formatting:Pulling diagnostics: crates/biome_service/src/file_handlers/javascript.rs: Analyze file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx" categories=RuleCategories(SYNTAX)
2023-10-05T08:29:04.879383Z INFO biome::worker_2 Process check:Processes formatting: crates/biome_service/src/file_handlers/javascript.rs: Format file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx"
ROME_BINARY
. Use BIOME_BINARY
instead. Contributed by @ematipico.git
folder when VCS support is enabled. Contributed by @ematipicobiome rage
doesn't print the logs of the daemon, use biome rage --daemon-logs
to print them. Contributed by
@unvalleyAdd option formatter.indentWidth
, and deprecated the option formatter.indentSize
. Contributed by @ematipico
Add option javascript.formatter.indentWidth
, and deprecated the option javascript.formatter.indentSize
.
Contributed by @ematipico
Add option json.formatter.indentWidth
, and deprecated the option json.formatter.indentSize
. Contributed by
@ematipico
Add option include
to multiple sections of the configuration
files.include
;formatter.include
;linter.include
;organizeImports.include
;
When include
and ignore
are both specified, ignore
takes precedence over include
Add option overrides
, where users can modify the behaviour of the tools for certain files or paths.
For example, it's possible to modify the formatter lineWidth
, and even quoteStyle
for certain files that are
included in glob path generated/**
:
{
"formatter": {
"lineWidth": 100
},
"overrides": [
{
"include": ["generated/**"],
"formatter": {
"lineWidth": 160
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}
]
}
Or, you can disable certain rules for certain path, and disable the linter for other paths:
{
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"overrides": [
{
"include": ["lib/**"],
"linter": {
"rules": {
"suspicious": {
"noDebugger": "off"
}
}
}
},
{
"include": ["shims/**"],
"linter": {
"enabled": false
}
}
]
}
extends
was incorrectly applied to the biome.json
file.
Contributed by @ematipicoFix #404. Biome intellij plugin now works on Windows. Contributed by @victor-teles
Fix #402. Biome format
on intellij plugin now recognize biome.json.
Contributed by @victor-teles
OnceCell
for the Memoized memory because that's what the RefCell<Option>
implemented. Contributed by
@denbezrukovThe following rules are now recommended:
Add noEmptyCharacterClassInRegex rule. The rule reports empty character classes and empty negated character classes in regular expression literals. Contributed by @Conaclos
Add noMisleadingInstantiator rule. The rule reports the
misleading use of the new
and constructor
methods. Contributed by @unvalley
Add noUselessElse rule.
The rule reports else
clauses that can be omitted because their if
branches break.
Contributed by @Conaclos
Add noUnusedImports rule. The rule reports unused imports and suggests removing them. Contributed by @Conaclos
noUnusedVariables reports also unused imports, but don't suggest their removal. Once noUnusedImports stabilized, noUnusedVariables will not report unused imports.
Add useShorthandAssign rule. The rule enforce use of shorthand operators that combine variable assignment and some simple mathematical operations. For example, x = x + 4 can be shortened to x += 4. Contributed by @victor-teles
Add useAsConstAssertion rule.
The rule enforce use of as const
assertion to infer literal types.
Contributed by @unvalley
Add noMisrefactoredShorthandAssign rule.
The rule reports shorthand assigns when variable appears on both sides. For example x += x + b
Contributed by @victor-teles
Add noApproximativeNumericConstant rule. Contributed by @nikeee
Add noInteractiveElementToNoninteractiveRole rule. The rule enforces the non-interactive ARIA roles are not assigned to interactive HTML elements. Contributed by @nissy-dev
Add useAriaActivedescendantWithTabindex
rule. The rule enforces that tabIndex
is assigned to non-interactive HTML elements with aria-activedescendant
.
Contributed by @nissy-dev
Add noUselessLoneBlockStatements rule. The rule reports standalone blocks that don't include any lexical scoped declaration. Contributed by @emab
Add noInvalidNewBuiltin rule.
The rule reports use of new
on Symbol
and BigInt
. Contributed by @lucasweng
The following rules have now safe code fixes:
noAccumulatingSpread makes more check in order to reduce potential false positives. Contributed by @Vivalldi
noConstAssign now provides an unsafe code fix that
replaces const
with let
. Contributed by @vasucp1207
noExcessiveComplexity default complexity
threshold is now 15
. Contributed by @arendjr
noPositiveTabindexValue now provides an unsafe code fix that
set to 0
the tab index. Contributed by @vasucp1207
noUnusedLabels no longer reports unbreakable labeled statements. Contributed by @Conaclos
noUnusedVariables now reports unused TypeScript's type parameters. Contributed by @Conaclos
useAnchorContent now provides an unsafe code fix that removes the `aria-hidden`` attribute. Contributed by @vasucp1207
useValidAriaProps now provides an unsafe code fix that removes invalid properties. Contributed by @vasucp1207
noExcessiveComplexity
was renamed to noExcessiveCognitiveComplexity
Fix #294. noConfusingVoidType no longer reports false positives for return types. Contributed by @b4s36t4
Fix #313. noRedundantUseStrict now keeps leading comments.
Fix #383. noMultipleSpacesInRegularExpressionLiterals now provides correct code fixes when consecutive spaces are followed by a quantifier. Contributed by @Conaclos
Fix #397. useNumericLiterals now provides correct code fixes for signed numbers. Contributed by @Conaclos
Fix 452. The linter panicked when it met a malformed regex (a regex not ending with a slash).
Fix #104. We now correctly handle types and values with the same name.
Fix #243 a false positive case where the incorrect scope was defined
for the infer
type in rule noUndeclaredVariables.
Contributed by @denbezrukov
Fix #322, now noSelfAssign correctly handles literals inside call expressions.
Changed how noSelfAssign behaves. The rule is not triggered anymore on function calls. Contributed by @ematipico
Enhance diagnostic for infer type handling in the parser. The 'infer' keyword can only be utilized within the ' extends' clause of a conditional type. Using it outside this context will result in an error. Ensure that any type declarations using 'infer' are correctly placed within the conditional type structure to avoid parsing issues. Contributed by @denbezrukov
Add support for parsing trailing commas inside JSON files:
{
"json": {
"parser": {
"allowTrailingCommas": true
}
}
}
Contributed by @nissy-dev