All versions since 2.6.6
2.6.6
Patch Changes
-
#12887
da0422eThanks @dyc3! - Added the new nursery rulenoArrayMethodsOnArguments. It reports calls to array methods on theargumentsobject, which isn’t an array, so these calls throw aTypeErrorwhen the code runs.function sum() {return arguments.reduce((total, value) => total + value, 0);} -
#12877
cd9e10fThanks @dyc3! - Added the nursery rulenoConstantComparisons, which reports&&and||conditions that can never be true, are always true, or contain a check with no effect.if (statusCode <= 400 && statusCode > 500) {} -
#12876
a7c9586Thanks @dyc3! - Added the nursery rulenoErasingOperation, which disallows operations with0that always result in zero: multiplying by0, a bitwise AND with0, and dividing0by a number. The other value in these operations has no effect on the result, which usually means the code has a mistake.const total = price * 0; -
#12841
e954f55Thanks @dyc3! - Added the nursery rulenoNegatedArrayPredicate, which reports negated calls toArray#some()andArray#every()and suggests moving the negation into the callback function.// Invalid: use `array.every((item) => !isUnicorn(item))` instead.const isMissing = !array.some((item) => isUnicorn(item)); -
#12888
15039f7Thanks @dyc3! - Added the new nursery rulenoNumberArgumentOutOfRange, which reports number literal arguments oftoString(),toFixed(),toExponential()andtoPrecision()that are outside the range the method accepts. These calls throw aRangeErrorat runtime.value.toString(64); -
#12889
1cd7520Thanks @dyc3! - Added the nursery rulenoSharedBranchCode, which reports code that is repeated at the start or end of every branch of anifstatement. That code runs no matter which branch is taken, so it can be moved before or after theifstatement.if (condition) {doSomething();cleanup();} else {doSomethingElse();cleanup();} -
#12842
d47fcfdThanks @dyc3! - Added the new nursery rulenoSubtractionComparison, which reports subtracting two values only to compare the difference with0, and suggests comparing the values directly.if (a - b > 0) {} -
#12866
7c1cd5fThanks @dyc3! - Added the nursery rulenoSvelteIgnoredUnsubscribe, which reports calls to a store’ssubscribe()method when the returned function is ignored. Without that function, the subscription can never be stopped, which causes a memory leak.<script>import { count } from "./stores.js";count.subscribe((value) => console.log(value));</script> -
#12890
6b73fcfThanks @dyc3! - Added the new nursery rulenoUninvokedArrayCallback, which reports array methods such asmap()andforEach()called with a callback on an array that only has empty slots. The callback never runs in this case.const list = new Array(5).map(() => createElement()); -
#12886
3bb18d8Thanks @dyc3! - Added the nursery ruleuseNextScriptForGoogleAnalytics, which reports<script>elements that load Google Analytics or Google Tag Manager. Use theGoogleAnalyticsandGoogleTagManagercomponents from@next/third-parties/googleinstead, which load these scripts after the page becomes interactive.<script async src="https://www.googletagmanager.com/gtag/js?id=G-XYZ" />The rule belongs to the
nextdomain. -
#12309
0538e30Thanks @dyc3! - Added the new nursery ruleusePackageJsonCpu, which reportspackage.jsonfiles that have nocpufield. Thecpufield lists the processor types that the package supports.The following
package.jsonfile satisfies the rule:{"name": "my-package","version": "1.0.0","cpu": ["x64", "arm64"]} -
#12310
191111dThanks @dyc3! - Added the nursery ruleusePackageJsonEngines, which reportspackage.jsonfiles that have noenginesfield.A
package.jsonpasses the rule once it declares the field:{"name": "my-package","engines": {"node": ">=20"}} -
#12986
cc929afThanks @dyc3! - Fixed #12954, where configuring rules in groups with more than 256 rules could enable or disable the wrong rule. -
#12931
fe9248eThanks @dyc3! - Improved the performance of linting. Each lint pass now spends less time stepping over syntax nodes that no enabled rule looks at. -
#12969
22d27e8Thanks @vibbix! - Improved the performance of CSS linting. Rules that compare selectors, such asnoDescendingSpecificityandnoDuplicateSelectors, now make fewer memory allocations. -
#12973
5a06df5Thanks @vibbix! - FixeduseGenericFontNamesreportingfont-familyinside@font-palette-values. There,font-familynames the font families the palette applies to, so it doesn’t take a generic family.@font-palette-values --palette {font-family: Bixa;override-colors: 0 red;} -
#12930
ce71284Thanks @dyc3! - Fixed #12073:useExhaustiveSwitchCasesnow reports non-exhaustive switches over values read fromfor...ofloops overArray.prototype.entries(),Map, andSet, and over properties of array elements indexed by anumbervariable.noMisusedPromisesnow also reports Promise-returning callbacks passed to array methods such asfindandevery. -
#12983
2987b54Thanks @ashokram-si! - Fixed #12957: Biome now correctly parses SCSS negative interpolation list items as separate values instead of an invalid subtraction operator.margin: -#{$s} - #{$s} - #{$s} auto;margin: -#{$s} -#{$s} -#{$s} auto;
2.6.7
Patch Changes
-
#12906
b3375d2Thanks @dyc3! - Added the nursery rulenoAsyncPromiseFinally, which reports async functions passed to a promise’s.finally()method. If such a function fails, its error replaces the original result or error of the promise.promise.finally(async () => {await cleanup();}); -
#12894
e24da6fThanks @dyc3! - Added the nursery rulenoDuplicateTypeConstituents, which reports types listed more than once in a union or intersection type, andundefinedin the type of an optional parameter.type T = string | number | string;function f(a?: string | undefined) {} -
#12899
6c15027Thanks @dyc3! - Added the nursery rulenoExcessiveSelectorComplexity, which limits how many IDs, type selectors, attribute selectors, pseudo-classes, universal selectors, compound selectors, and combinators a CSS selector can contain. It can also disallow chosen combinators, pseudo-classes, pseudo-elements, attributes, and attribute operators. The rule does nothing until an option is set.For example, with
"maxIds": 1, the following selector is reported:#main #sidebar {} -
#12897
0b8f429Thanks @dyc3! - Added the new nursery rulenoInvalidFetchOptions, which reports abodyin the options offetch()andnew Request()when the method isGETorHEAD. These calls throw aTypeErrorat runtime. When nomethodis given, the request usesGET.await fetch("/", { method: "GET", body: "foo=bar" }); -
#12926
9b6b9f4Thanks @dyc3! - Added the nursery rulenoNewArray, which reportsnew Array()calls with a single argument. Such a call creates an empty array of the given length when the argument is a number, and an array that holds the argument otherwise.const array = new Array(length); -
#12895
739440fThanks @dyc3! - Added the new nursery rulenoRedundantTypeConstituents, which reports members of union and intersection types that have no effect, such as a literal type next to its primitive type, orneverin a union.type Status = "active" | string; -
#12810
71ab61bThanks @dyc3! - Added the nursery rulenoSvelteAsyncStore, which disallows passing async functions to thewritable(),readable(), andderived()stores fromsvelte/store.import { writable } from "svelte/store";const user = writable(null, async (set) => {set(await fetchUser());}); -
#12917
37d9f41Thanks @dyc3! - Added the new nursery rulenoUnresolvedDefaultImport, which reports default imports from modules that have no default export. The rule is part of theprojectdomain.// foo.js only contains `export function foo() {}`import foo from "./foo.js"; -
#12892
f16842eThanks @dyc3! - Added the nursery rulenoUselessFallbackInSpread, which reports empty object fallbacks when spreading a value into an object. Spreadingnull,undefined, or another falsy value into an object adds no properties, so the fallback has no effect.const object = { ...(options || {}) }; -
#12785
c198be2Thanks @dyc3! - Added the new nursery rulenoUselessParameterPropertyAssignment, which reports constructor assignments such asthis.name = namewhennameis a parameter property. TypeScript already sets the property to the parameter’s value, so the assignment does nothing.class User {constructor(public name: string) {this.name = name;}} -
#12900
a4d1b0fThanks @dyc3! - Added the nursery rulenoUselessSpread, which reports spread syntax that has no effect. For example,[first, ...[second]]can be written as[first, second], andnew Set([...items])can be written asnew Set(items). -
#12902
d7d755bThanks @dyc3! - Added the nursery rulenoVueExposeAfterAwait, which reportsexpose()anddefineExpose()calls that come after anawaitin a Vue component’s setup code. These calls run too late, so a parent component might not receive the exposed properties.<script setup>await fetchUser();defineExpose({ reload });</script> -
#12596
d33e56eThanks @dyc3! - Added the nursery ruleuseAtomicUpdates, which reports assignments in async functions and generators that can be based on an outdated value because the function paused at anawaitoryieldafter reading it.let total = 0;async function addToTotal(getAmount) {total += await getAmount(); // reported} -
#12901
48e3572Thanks @dyc3! - Added the new nursery ruleuseConsistentBooleanName. It requires variables, parameters, and functions that hold or return a boolean to start with a prefix such asisorhas, and reports names with those prefixes that don’t hold or return a boolean.const completed = progress === 100;const hasName = "Sindre"; -
#12905
5b00387Thanks @dyc3! - Added the nursery ruleuseConsistentFontWeightNotation, which enforces writing font weights either as numbers or as the keywordsnormalandboldwhere possible. It checks thefont-weightandfontproperties, and its safe fix converts betweennormal/boldand400/700.a { font-weight: bold; } -
#12922
8d33c85Thanks @dyc3! - Added the nursery ruleuseConsistentTupleLabels, which reports tuple type elements without a label when other elements of the same tuple have one.type Point = [x: number, number]; -
#12925
7252cbdThanks @dyc3! - Added the new nursery ruleuseGlobalRegexInMatchAll, which reports calls tomatchAll()with a regular expression that doesn’t have thegflag. These calls throw aTypeErrorat runtime.text.matchAll(/pattern/); -
#12891
e781bc3Thanks @dyc3! - Added the nursery ruleuseGlobalRegexInReplaceAll, which reports regular expressions without thegflag passed toreplaceAll(). These calls throw aTypeErrorinstead of replacing text.withSpaces.replaceAll(/\s+/, ","); -
#12896
a968e1aThanks @dyc3! - Added the new nursery ruleuseValidCharacterComparison, which reports comparisons between a single character and a string that has more than one character. Such comparisons are alwaysfalse, or alwaystruewith!==and!=.text.charAt(0) === "ab"; -
#13085
7a795d0Thanks @ematipico! - Fixed withastro/compiler-rs#221 so Astro template expressions containing comment-only JSX expression children, such as<span>{<!-- x -->}</span>, parse without diagnostics. -
#12621
79ce388Thanks @latin-1! - Fixed #12413 and #12414:useSortedPropertiesnow sorts consecutive groups of properties independently, preserving the positions of nested rules, at-rules, and SCSS variable declarations. -
#13065
bd9faaeThanks @ematipico! - Fixed #5848: runninguseSortedKeysoruseSortedSelectionSetas an editor source action no longer corrupts nested objects or selection sets. -
#13056
98f4d53Thanks @ematipico! - Fixed #10607:noUndeclaredDependenciesno longer reports imports resolved through TypeScript’scompilerOptions.pathsmappings. -
#13033
7638393Thanks @GBra-4-669! - Fixed #12980: the CSS parser no longer panics on acomposesdeclaration whose value contains a non-identifier token, such ascomposes: 1px;. It reports a diagnostic instead. -
#12917
37d9f41Thanks @dyc3! - FixednoUnresolvedImports: it now reports default imports from modules that only forward exports withexport * from "...".export *never re-exports a default export, soimport foo from "./barrel.js"fails when./barrel.jscontains onlyexport * from "./foo.js". -
#12596
d33e56eThanks @dyc3! - FixednoUnreachableSuperignoring the default values of constructor parameters. Usingthisin a default value is now reported, because it runs beforesuper(), and callingsuper()in a default value is now recognized.class Child extends Parent {constructor(options = this.defaults()) { // reportedsuper(options);}} -
#12596
d33e56eThanks @dyc3! - FixednoUselessAssignmentignoring variables that are used in the iterated value of afor...oforfor...inloop, in the default values of a destructuring declaration or of parameters, or in the body of an arrow function written as a single expression. These variables are now checked too.function process(first, second) {let list = first; // reported: this value is never readlist = second;for (const item of list) {handle(item);}} -
#12805
2468384Thanks @vibbix! - Fixed #12332:noUnknownUnitno longer reports hex colors that start with a digit in SCSS custom properties or in unquoted legacy IEfiltervalues. The rule now accepts--accent: #4566a8;instead of reporting the unknown unita8. -
#12549
7fdb28fThanks @pkallos! - Fixed #10464:useNullishCoalescingno longer reports a ternary orifstatement that checks onlynullor onlyundefinedwhen the type can also be the other, because??would change its behavior. -
#12952
d1896a0Thanks @arendjr! - Addedgrit()queries to JavaScript plugins. A rule can now use a GritQL pattern to select the nodes passed torun()instead of listing syntax kinds withast().For example:
export const noConsole = defineRule({query: grit("`console.log($args)`"),run(element) {if (element.kind !== "JS_CALL_EXPRESSION") return;registerDiagnostic(element, "warning", "Unexpected console.log.");},});Usage of Grit patterns can be particularly useful when it would take several checks to verify the shape of a snippet that involves multiple AST nodes.
Grit sequence patterns call
run()for each matched node. Matching on leaf tokens is also supported for patterns, while patterns containing rewrites are rejected. Plugins using GritQL patterns should report diagnostics fromrun()as usual.Plugins using Grit queries can still request the semantic model as well:
export const rule = defineRule({query: grit("function $fn($args) { $body }", { semantic: true }),run(node, { model }) {// You can use `model` here similar to a query specified using `ast(..., { semantic: true })`.},}); -
#13022
81d0187Thanks @arendjr! - Fixed an issue where GritQL patterns wouldn’t match snippets if they contain a trailing list separator.For example, the pattern
`a, b`wouldn’t match the arguments infunction(a, b,), whereas now they do. -
#12999
ace98cfThanks @deepsingh132! - Fixed #12953: the Markdown formatter no longer removes the blank line between a blockquote that ends a list item and the block that follows it, matching Prettier. Removing that line could also move a following paragraph into the blockquote. The same applies to a list item that ends with a hard line break.- a> b#### Heading -
#13067
45c8c4dThanks @ematipico! - Added the nursery rulenoDisabledAttribute, which warns when buttons and other form controls use the nativedisabledattribute. A disabled control can’t be reached with the Tab key, so the rule suggestsaria-disabledorreadonlyinstead.<button disabled>Save</button><input type="email" disabled /> -
#12923
0668c8fThanks @dyc3! - Added the new nursery rulenoScssNullComparison. It reports comparisons tonullin Sass@ifand@else ifconditions, becausenullalready counts as false in a condition.a {@if $value == null {}} -
#12955
e1ef913Thanks @ematipico! - Fixed an issue where Biome could silently skip configured plugins. Biome now reports an error when those plugins are unavailable during analysis. -
#12997
419aa5dThanks @Riccardo-bit-cpu! - Fixed #12475:noSwitchDeclarationsno longer reportsvardeclarations insideswitchclauses, matching ESLint’sno-case-declarations. -
#12867
6a25d72Thanks @dyc3! - Added the nursery rulenoUselessQualifier, which reports namespace and enum names that are repeated before a member inside that same namespace or enum. Biome provides a fix that removes the repeated name.namespace Shapes {export type Point = { x: number; y: number };const origin: Shapes.Point = { x: 0, y: 0 };} -
#12050
60f4695Thanks @dor-sr! - Fixed #11933:useUnicodeRegexno longer offers to add theuflag to patterns that become invalid or change meaning in Unicode mode, such as/{/,/\-/or/[\d-z]/. The rule still reports them. -
#13035
478e056Thanks @dyc3! - Fixed #13026: the Markdown formatter no longer indents the rows of a table inside a blockquote when the table follows a paragraph of two or more lines. Previously, every run of the formatter indented the rows further until they were joined onto the header line.> First line of a paragraph,> second line of it.>> | A | B |> | --- | --- |> | x | y |> | --- | --- |> | x | y | -
#13066
f6cf28eThanks @arendjr! - Removed thesemantic()query function from the JavaScript plugin API. Pass{ semantic: true }toast()instead to provide the semantic model to a rule.export const rule = defineRule({query: semantic("JS_REFERENCE_IDENTIFIER"),run(node, { model }) {// Use `model` here.},});Becomes:
export const rule = defineRule({query: ast("JS_REFERENCE_IDENTIFIER", { semantic: true }),run(node, { model }) {// Use `model` here.},});This behaviour matches the
grit()query function, which also accepts the{ semantic: true }option. -
#12951
014b976Thanks @ematipico! - Fixed #10782:noUndeclaredClassesno longer appears to hang on projects with long component import chains. -
#13073
827e610Thanks @vibbix! - Fixed #13072: a comment before a SCSS map entry whose value is a parenthesized group no longer indents that group one level too deep. This matches Prettier 3.10 behavior now.$map: (/* comment */key: (a: 1,b: 2,),a: 1,b: 2,),); -
#12928
ae0e186Thanks @dyc3! - ImprovednoUselessStringConcat. The rule now reports literals joined after another value, such asfoo + "a" + "b", and fixes template literals with placeholders, so`Hello, ${name}` + "!"becomes`Hello, ${name}!`.The rule no longer reports strings that would join into text that looks like a placeholder, such as
"$" + "{name}", or into a directive such as"use strict". It also no longer reportsobj.foo * "a" + "b", which its fix used to change toobj.foo * "ab".The fix no longer changes the value of the string in two cases. It used to change
1 + 2 + "b" + "c"to"12bc"instead of1 + 2 + "bc". It used to change"\1" + "2"to"\12", which is a different escape sequence.The fix no longer joins literals that are on different lines when the concatenation ends with two literals on the same line. It also no longer puts a line break from a template literal into a string literal, which made the code invalid.
-
#13048
24734a8Thanks @ematipico! - Fixed #13028: Biome now keeps a paragraph in its outer block quote when a quote-only blank line closes a nested block quote.> > b>> > c> c -
#12967
bd0988eThanks @siketyan! - Fixed #12827:noDuplicateProperties,noDuplicateCustomProperties, andnoMissingVarFunctionnow check declarations at the top level of embedded CSS templates, such asstyled.div`...`. -
#13048
24734a8Thanks @ematipico! - Fixed #13029: the Markdown formatter now normalizes spaces inside inline and reference link text without removing whitespace-only text.something [ text ]( destination)something [ ]( destination)something [ text ](destination)something [ ](destination) -
#13021
05a1409Thanks @dyc3! - Fixed #12993: Svelte{@const}tags with TypeScript type annotations, such as{@const doubled: number = item * 2}, now parse and format in components with<script lang="ts">. -
#12968
ec0142bThanks @siketyan! - Fixed #12826: Biome now detects CSS in styled-components templates that use.attrs(), such asstyled.button.attrs({ type: "button" })`...`andstyled(Component).attrs(() => ({}))`...`, so they are formatted and linted likestyled.button`...`. -
#13048
24734a8Thanks @ematipico! - Fixed #13027: the Markdown formatter now preserves spaces around text after a code span that crosses block quote lines.> `a> b`c`d`> b` c `d` -
#13055
78c744aThanks @ematipico! - Fixed #13053: Biome now reports missing CLI paths as file-system errors without theINTERNALtag or advice that the path was ignored by configuration. File-system diagnostics now use specificfs/*categories, with underlying I/O errors categorized asfs/io. -
#12927
c6feec1Thanks @dyc3! - Added the nursery ruleuseCatchErrorName, which requires a specific name for caught errors intry...catchstatements and in the error handlers ofpromise.catch()andpromise.then(). The name defaults toerrorand can be changed with thenameoption.try {} catch (err) {} // `err` should be named `error` -
#12788
7f971edThanks @dyc3! - ExtendeduseWhileto reportfor (;;)loops and to fix them towhile (true). -
#12967
bd0988eThanks @siketyan! - FixednoMissingVarFunctionso it also checks declarations inside at-rules such as@pageand@font-face. For example,@page { margin: --page-margin; }is now reported when--page-marginis declared in:root. -
#13057
d9267a5Thanks @ematipico! - Fixed #10896 so Svelte<script generics>attributes containing object type constraints parse and format as TypeScript type parameters. -
#13048
24734a8Thanks @ematipico! - Fixed #13038: Biome now aligns wrapped task-list paragraphs with the text following the checkbox.- [ ] Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc variusmalesuada eros, faucibus dapibus odio rhoncus in.malesuada eros, faucibus dapibus odio rhoncus in.
2.6.8 Latest
Patch Changes
-
#13080
a68137dThanks @dyc3! - Added the nursery rulenoBufferConstructor, which disallows the deprecated Node.jsBuffer()andnew Buffer()constructors. UseBuffer.from(),Buffer.alloc(), orBuffer.allocUnsafe()instead.new Buffer(5); -
#12966
82651f5Thanks @dyc3! - Added the nursery rulenoConfusingArraySplice, which reportssplice()andtoSpliced()calls that replace a single element or insert at index-1.array.splice(index, 1, element); // use `array[index] = element` instead -
#12924
0a9d204Thanks @dyc3! - Added the nursery rulenoDynamicRequire, which disallowsrequire()calls whose module name is built at runtime. When thecheckDynamicImportsoption is enabled, the rule also checksimport()calls.require("./locales/" + language); -
#12907
6f2635aThanks @dyc3! - Added the nursery rulenoLateCurrentTargetAccess, which reports reads ofevent.currentTargetthat run after the browser has finished handling the event, whencurrentTargetisnull.element.addEventListener("click", async (event) => {await save();event.currentTarget.disabled = false;}); -
#12904
04f30c4Thanks @dyc3! - Added the nursery rulenoMisusedSpread, which uses type information to report spreads that produce unexpected results: strings spread into arrays or arguments, and promises, functions, maps, arrays, iterables, class instances, and classes spread into objects or JSX attributes.declare function getUser(): Promise<{ name: string }>;const user = { ...getUser() }; -
#12893
5d7ca32Thanks @dyc3! - Added the nursery rulenoTripleSlashReference, which reports/// <reference path="..." />comments and/// <reference types="..." />comments for packages that the file also imports. Thelib,path, andtypesoptions control which kinds of references are allowed./// <reference path="./globals.d.ts" /> -
#12561
746c421Thanks @dyc3! - Added the nursery rulenoVueAsyncComputed, which reports asynchronous code in Vue computed properties, such asasyncfunctions,await, promises,setTimeout(), andnextTick().<script>export default {computed: {async user() {return fetchUser(this.userId);},},};</script> -
#12964
149d729Thanks @dyc3! - Added the nursery rulenoVueDefineModelDefault, which disallows thedefaultoption in Vue’sdefineModel(). When a parent component passesundefinedwithv-model, the child component uses the default value while the parent keepsundefined, so the two components show different values.<script setup>const model = defineModel({ type: String, default: "" });</script> -
#13060
67bc9d5Thanks @dyc3! - Added the nursery rulenoVueDeprecatedFilter, which reports the filter syntax that Vue 3 removed.For example, the following template uses the
currencyfilter:<template><p>{{ price | currency }}</p></template> -
#12545
0bbe4f1Thanks @dyc3! - Added the new nursery rulenoVueDeprecatedVIs, which reports the deprecated Vuev-isdirective. Use theisattribute with avue:prefix instead.<template><div v-is="'MyComponent'"></div></template> -
#12580
3fdc987Thanks @dyc3! - Added the nursery rulenoVueExportInScriptSetup, which disallowsexportin Vue<script setup>blocks. Vue fails to compile a component when its<script setup>block exports a value. TypeScript type exports are allowed.<script setup>export const message = "Hello";</script> -
#13063
d4e90c8Thanks @dyc3! - Added the nursery rulenoYamlEmptyMapKeys, which reports YAML map entries whose key is missing, or has only a tag or an anchor. The rule is recommended.: value -
#13061
97aa183Thanks @dyc3! - Added the nursery rulenoYamlEmptyMapValues, which reports keys in YAML maps that have no value.name: -
#13062
6aad75fThanks @dyc3! - Added the new nursery rulenoYamlEmptySequenceEntries, which reports empty items in YAML lists.fruits:- apple-- banana -
#13082
c1c8c85Thanks @dyc3! - Added the nursery ruleuseCalledWith, which reportstoHaveBeenCalled(),toBeCalled(), andtoHaveBeenCalledOnce()assertions, because they don’t check the arguments that the function was called with. The rule belongs to thetestdomain.expect(sendEmail).toHaveBeenCalled(); -
#13075
acfeaf9Thanks @dyc3! - Added the nursery ruleuseExpectToHaveBeenCalled, which reports tests that compare the number of calls of a mock function to zero, and suggests usingtoHaveBeenCalled()instead.expect(sendEmail).toHaveBeenCalledTimes(0); -
#13076
cf5b1a6Thanks @dyc3! - Added the nursery ruleuseExpectToHaveBeenCalledTimes, which reports tests that check the length ofmock.callswithtoHaveLength(), and suggests usingtoHaveBeenCalledTimes()instead.expect(onSave.mock.calls).toHaveLength(1); -
#13020
5d28641Thanks @dyc3! - Added the new nursery ruleusePackageJsonValidLicense, which reports alicensefield inpackage.jsonthat isn’t a valid license. The rule accepts SPDX license identifiers and expressions,UNLICENSED, and references to a license file such asSEE LICENSE IN LICENSE.md.For example, the rule reports the following
package.jsonfile becauseGPL3isn’t an SPDX license identifier:{"name": "my-package","license": "GPL3"} -
#13079
058d7a1Thanks @dyc3! - Added the nursery ruleuseSpyOn, which reports properties that are overwritten withjest.fn()orvi.fn(). Overwriting a property loses its original value, whilejest.spyOn()andvi.spyOn()keep it so it can be restored after the test.Date.now = jest.fn(() => 10); -
#13081
be58f67Thanks @dyc3! - Added the nursery ruleuseTopLevelRequire, which reportsrequire()calls that aren’t at the top level of the module, such as calls inside functions, blocks, ortrystatements.function readFile(filename, callback) {const fs = require("fs");fs.readFile(filename, callback);} -
#13054
4d81f0dThanks @dyc3! - Added the nursery ruleuseValidNamespaceImports, which reports names read from a namespace import that the imported module doesn’t export. It also reports assignments to members of a namespace import, and namespace imports of modules that have no exports.import * as utils from "./utils.js";utils.subtract(2, 1); // `./utils.js` doesn't export `subtract` -
#13058
ae251e4Thanks @dyc3! - Added the new nursery ruleuseVueConsistentVOnHandlerStyle, which enforces one style of event handler in Vuev-ondirectives. By default, it prefers the name of a method, and an inline function where a method name can’t be used.<template><button @click="save()">Save</button></template> -
#12965
c33c03dThanks @dyc3! - Added the nursery ruleuseVueRegisteredComponentNameCasing, which requires the names of components registered in thecomponentsoption of a Vue component to use one casing style. By default, names must be in PascalCase. Thecasingoption switches the rule to camelCase or kebab-case.<script>export default {components: {"todo-item": TodoItem,},};</script> -
#12145
596a2b1Thanks @ematipico! - Added type narrowing for unwritten locallet/constvariables and parameters aftertypeof, equality, nullish, and truthiness checks. Type-aware rules now use these refinements in branches, short-circuit expressions, and after early returns, includingnoUnnecessaryConditionsandnoFloatingPromises. Types such as{}no longer imply that a value is always truthy. -
#12935
e506ff1Thanks @dyc3! - Improved the performance of the rulesnoRedeclareandnoUnsafeDeclarationMerging.biome lintwith Biome’s default rules is now about 3% to 5% faster on large projects, and up to 11% faster on some TypeScript projects. -
#13181
e1556aeThanks @dyc3! - Fixed the HTML formatter printing a comment twice when it ends the line of an element’s opening tag. For example,<div><!-- comment -->followed by<i>x</i></div>on the next line is now formatted as:<div><!-- comment --><div><!-- comment --><i>x</i></div> -
#13130
1b350edThanks @dyc3! - Fixed #13107: the unsafe fix ofnoDistractingElementsnow removes the whole element, including its closing tag and children, instead of only the opening tag. The fix is no longer offered when removing the element would produce invalid code, such asconst Ticker = () => <marquee>News</marquee>;. -
#13054
4d81f0dThanks @dyc3! - FixednoUnresolvedImportsreporting names that a module re-exports from a CommonJS module or from a file that isn’t JavaScript, such asexport { foo } from "./legacy.cjs". The rule now also reports default imports from a module that only re-exports another module withexport * from, becauseexport * fromdoesn’t forward the default export. -
#12602
d5da394Thanks @dyc3! - Fixed #12600:biome lint --suppressnow adds suppression comments for diagnostics emitted by plugins, such as// biome-ignore lint/plugin/noFoo: ignored using `--suppress`. -
#13097
3be9e3dThanks @ashokram-si! - Fixed #13064: ThenoUnknownTypeSelectorrule now correctly accepts the valid<selectedcontent>HTML element used in customizable select controls. -
#13181
e1556aeThanks @dyc3! - Fixed #13167: The HTML formatter no longer deletes comments that follow a Svelte block delimiter on the same line, such as{#if},{:else}, or{#each}. For example,{#if a}<!-- comment --><i>x</i>{/if}is now formatted as:{#if a}<i>x</i><!-- comment --><i>x</i>{/if} -
#12845
e3ab04dThanks @dyc3! - Fixed the location of Tailwind CSS diagnostics reported on unquoted object keys. Inclsx({ shadow: active }), diagnostics now highlightshadowinstead of starting one character later athadow:. -
#13098
d3be626Thanks @ashokram-si! - Fixed #13084: TheuseThisInClassMethodsrule now correctly recognizesthiswhen used inside parameter default values for methods, setters, and class fields. -
#13131
a788cacThanks @dyc3! - Fixed #13129: the fix ofuseArrowFunctionno longer produces invalid code when the function is in the initializer of aforstatement and returns aninexpression. The arrow function body is now wrapped in parentheses.// Beforefor (let has = function (k) { return k in cache; }; ;) {}// After the fixfor (let has = (k) => (k in cache); ;) {} -
#12840
8908627Thanks @dyc3! - Fixed #12796:useMathMinMaxno longer reports comparisons with abigintwritten as an expression, such as-1nor2n ** 62n - 1n, or with aconstvariable initialized with one. Its unsafe fix turned these comparisons intoMath.min()orMath.max()calls, which throw aTypeErrorwhen given abigint.const MAX = 2n ** 62n - 1n;const clamp = (x) => (x > MAX ? MAX : x); -
#13152
61924f6Thanks @dyc3! - FixednoVueWatchAfterAwait,noVueLifecycleAfterAwaitandnoVueRestrictedCallAfterAwait, which now also check thesetup()function passed as the first argument ofdefineComponent(). The following code is now reported:import { defineComponent, onMounted } from "vue";defineComponent(async (props) => {await load();onMounted(() => {});}, { props: ["id"] });When
defineComponent()receives both a function and an options object, these rules now ignore thesetupoption, because Vue runs the function instead. -
#13152
61924f6Thanks @dyc3! -noVueDuplicateKeysnow checks the properties returned by asetup()method of an options object, soreturn { foo }conflicts with a prop, data property, method or computed property namedfoo. -
#13152
61924f6Thanks @dyc3! - The Vue emit rules now read events declared with a function type, as indefineEmits<(e: "change", value: string) => void>(), and event names written as template literals without substitutions, as inemit(`change`).noVueUndeclaredEmits,noVueUnusedEmitDeclarations,useVueSingleEventPayloadanduseVueEmitValidatorpreviously skipped events declared in these forms.noVueShadowNativeEventsnow checksthis.$emit()only wherethisis the component, and no longer reports$emit()called through a variable that holdsthis, as inconst vm = this; vm.$emit("click"). -
#12947
a54965dThanks @machadinhos! - Added the nursery rulenoDrizzleDbObjectInsideTransaction, which reports a Drizzle ORM instance used inside its own transaction callback instead of the transaction object.await db.transaction(async (tx) => {await db.insert(users).values({ name: "John" });}); -
#13123
e7c8297Thanks @ematipico! - Fixed #12176: type-aware rules now select the matching overload of a method declared several times in an interface or object type. For example,useAwaitThenableno longer reportsawait app.listen({ port: 0 })on a Fastify server, and still reportsawait app.listen({ port: 0 }, callback). -
#12059
87784c7Thanks @dyc3! - FixednoUnsafePlusOperandstreating the negation of abigintvalue as anumber. Code such as-value + 1n, wherevalueis declared asbigint, is no longer reported for mixingnumberandbigint. -
#13151
be372b5Thanks @dyc3! - Fixed Vue lint rules such asuseVueVModelanduseVueVOnExacttreating MathML elements like<math>and<mi>as components. Biome now recognizes the MathML Core elements as native elements, and in Vue, Svelte, and Astro files it treats known hyphenated elements such as<annotation-xml>and the SVG<font-face>as native elements instead of components. -
#12059
87784c7Thanks @dyc3! - Type inference now evaluates conditional types such asT extends U ? X : Y, includinginferand distribution over unions, instead of treating them as a union of both branches. This also applies to built-in types such asExclude,Extract,ReturnType,Parameters, andAwaited, which improves the accuracy of type-aware rules such asnoFloatingPromises.type Unwrap<T> = T extends Promise<infer U> ? U : T;// Previously inferred as `unknown | Promise<number>`, now as `number`.type Value = Unwrap<Promise<number>>; -
#12602
d5da394Thanks @dyc3! - Biome now reports an error when a GritQL plugin file name contains invalid characters that could conflict with Biome suppressions. -
#12838
81d8d28Thanks @dyc3! - Added the nursery rulenoTailwindRestrictedClassesfor JavaScript and HTML. It reports the Tailwind CSS classes and variants listed in its options with a custom message, and can replace them with a configured class or variant.{"linter": {"rules": {"nursery": {"noTailwindRestrictedClasses": {"level": "error","options": {"classes": {"bg-green-500": { "message": "Use the success color.", "use": "bg-success" },"float-*": "Use flexbox or grid for layout."}}}}}}}<div className="hover:bg-green-500 float-left" />; // both classes are reported -
#12932
68e6887Thanks @dyc3! - Improved the performance of linting files that have no suppression comments by up to 61%. -
#13136
dcb1eabThanks @dyc3! - Improved the performance of linting JavaScript and HTML files when Tailwind rules are enabled. -
#13094
ae66383Thanks @dyc3! - Fixed #12994: the HTML formatter no longer moves a word onto its own line when it follows an inline element or{expression}that starts a line. Formatting such text is now stable after one pass.<span>Showing the first {shown} of{total}references{total} references</span> -
#13162
854ff15Thanks @Punisheroot! - Fixed #13125:noUselessThisAliasno longer reports aliases used in instance and static class field initializers, where replacing the alias withthischanges which object is accessed. -
#12059
87784c7Thanks @dyc3! - Fixed type inference for the intersection of a primitive type and one of its literal types, such asstring & "a", which Biome inferred asneverinstead of"a". Type-aware rules such asuseExhaustiveSwitchCasesandnoFloatingPromisesnow see the literal, so the following switch is reported for missing the"a"case.type Kind = ("a" & string) | "b";function handle(kind: Kind) {switch (kind) {case "b":break;}} -
#12551
ca039a1Thanks @pkallos! - Fixed #9842:useNullishCoalescingno longer skips||and||=inside a call to a locally declaredBooleanwhenignoreBooleanCoercionis enabled.
Copyright (c) 2023-present Biome Developers and Contributors.