Changelog
Version 2.6.10 Latest
Patch Changes
-
#13387
00e98fcThanks @dyc3! - Added the nursery rulenoAmd, which reports AMDdefine()andrequire()calls that load modules from a list, so they can be replaced withimportstatements.define(["a", "b"], function (a, b) {}); -
#13357
9407920Thanks @dyc3! - Added the nursery rulenoArrayReduce, which disallows thereduce()andreduceRight()array methods in favor of loops and methods such asmap()andfilter(). Calls whose function only returns a single arithmetic, comparison, or bitwise operation, such as(total, item) => total + item, are allowed.const counts = words.reduce((counts, word) => {counts[word] = (counts[word] ?? 0) + 1;return counts;}, {}); -
#13358
d82324eThanks @dyc3! - Added the nursery rulenoBreakInNestedLoop, which reportsbreakstatements without a label inside nested loops and insideswitchstatements in loops. Enable thecheckContinueoption to also reportcontinuestatements without a label.for (const item of items) {for (const child of item.children) {break; // reported}} -
#13488
674687aThanks @dyc3! - Added the nursery rulenoCollectionBracketAccess. It reports square brackets used on aMap,Set,WeakMap, orWeakSet, which read or change a property of the object instead of one of its entries.const map = new Map();map["foo"] = "bar"; -
#13477
de81ca9Thanks @dyc3! - Added the nursery rulenoConvexCollectInQuery, which reports Convex database queries that load every matching document with.collect(). Use.take()or.paginate()instead.const messages = await ctx.db.query("messages").collect(); -
#13323
fae973fThanks @dyc3! - Added the nursery rulenoConvexDuplicateIndexes, which reports Convex database indexes whose fields are the first fields of another index on the same table. The rule is part of theconvexdomain.defineTable({ author: v.string(), channel: v.string() }).index("by_author", ["author"]) // reported.index("by_author_and_channel", ["author", "channel"]); -
#13481
4de1a09Thanks @dyc3! - Added the nursery rulenoConvexOldRegisteredFunctionSyntax, which reports Convex queries, mutations, and actions registered with a plain function instead of an object. The object syntax lets you declare anargsvalidator.export const list = query(async (ctx) => {return await ctx.db.query("messages").collect();}); -
#13325
e7dab31Thanks @dyc3! - Added the new nursery rulenoConvexProcessEnvto theconvexdomain. It reports uses ofprocess.envin theconvexfolder of a package, and recommends reading environment variables from the typedenvobject exported by_generated/serverinstead. Its unsafe fix replacesprocess.envwithenvand adds the import.convex/giphy.ts const apiKey = process.env.GIPHY_KEY; -
#13324
6609054Thanks @dyc3! - Added the nursery rulenoConvexQueryFilter, which reports.filter()calls on Convex database queries. The database reads every document in the query before.filter()drops the ones that don’t match, so.withIndex()or filtering the collected results in code is preferred. The rule belongs to theconvexdomain.const messages = await ctx.db.query("messages").filter((q) => q.eq(q.field("author"), args.author)).collect(); -
#13476
cfec26aThanks @dyc3! - Added the nursery rulenoConvexTimeOrRandomInQueries, which reports Convex queries that read the current time or generate random values. Convex caches query results, so these values can be outdated or stay the same between calls.export const pickWinner = query({handler: async (ctx) => {const entries = await ctx.db.query("entries").collect();return entries[Math.floor(Math.random() * entries.length)];},}); -
#13300
1001924Thanks @dyc3! - Added the nursery rulenoConvexTopOfHourCrons, which reports Convex cron jobs scheduled at the start of the hour, the busiest time for most apps.crons.hourly("cleanup", { minuteUTC: 0 }, internal.tasks.cleanup); -
#13482
0466735Thanks @dyc3! - Added the nursery rulenoConvexWrongRuntimeImports, which reports files in a Convexconvexfolder that run in the Convex runtime but import a file with the"use node"directive.// convex/payments.ts, where convex/stripe.ts starts with "use node"import { formatAmount } from "./stripe"; -
#13371
adae706Thanks @dyc3! - Added the nursery rulenoDuplicateExports. It reports a module or TypeScript namespace that exports the same name more than once, or has more than one default export. It also reports twoexport * fromstatements that export the same name from different declarations. The rule belongs to theprojectdomain.export const foo = 1;function bar() {}export { bar as foo }; -
#13395
3f1f7ceThanks @dyc3! - Added the nursery rulenoDuplicateIfBranches, which reports branches of anifstatement that run the same code as the branch right before them.if (value === "a") {doThing();} else if (value === "b") {doThing();} -
#13504
ae4791fThanks @dyc3! - Added the nursery rulenoMixedReturns, which reports functions where somereturnstatements return a value and others don’t, including functions that can reach the end of their body after returning a value elsewhere.function doSomething(condition) {if (condition) {return true;}} -
#13366
48da9c2Thanks @dyc3! - Added the nursery rulenoMutableExports. It reports exported variables declared withletorvar, which other modules see change whenever they are reassigned.export let count = 1; -
#13505
72c3a7eThanks @dyc3! - Added the nursery rulenoNegatedComparison, which reports equality comparisons that are negated as a whole and suggests the opposite operator instead.const isDifferent = !(a === b); // use `a !== b` instead -
#13282
5201ae5Thanks @dyc3! - Added the nursery rulenoOuterScopeInIsolatedFunctions, which reports uses of variables,this, andsuperfrom outside a function that runs apart from the code around it, such as a function passed tomakeSynchronous()or marked with an@isolatedcomment.const url = "https://example.com";makeSynchronous(async () => {const response = await fetch(url); // `url` doesn't exist where the function runsreturn response.text();}); -
#13474
100d4d7Thanks @dyc3! - Added the nursery rulenoTailwindLegacyImportantfor JavaScript and HTML. It reports Tailwind CSS classes that put the!important modifier at the start, as Tailwind CSS v3 did, and moves the!to the end of the class name.<div className="!flex hover:!bg-red-500" />; // use `flex!` and `hover:bg-red-500!` -
#13224
19fb503Thanks @dyc3! - Added the new nursery rulenoTanstackQueryUnstableDeps, which reports the object returned by a TanStack Query hook, such asuseQueryoruseMutation, when it is used directly as a dependency ofuseEffect,useMemo, oruseCallback. This object can be a new object on every render, so React treats the dependencies as changed on every render.const mutation = useMutation({ mutationFn });const callback = useCallback(() => mutation.mutate("hello"), [mutation]); -
#13371
adae706Thanks @dyc3! - Added the nursery rulenoUselessReExportAll. It reportsexport * froma module that has no named exports, which exports nothing. The rule belongs to theprojectdomain.// foo.js only has a default export.export * from "./foo.js"; -
#12560
1413bf8Thanks @dyc3! - Added the nursery rulenoVueComputedPropertyCall, which disallows calling a Vue computed property whose value is not a function. Calling such a value throws an error when the code runs.<script>export default {computed: {total() {return 42;},},methods: {log() {console.log(this.total()); // reported},},};</script> -
#13322
025c012Thanks @dyc3! - Added the nursery rulenoVueContentOutsideBlock, which reports text and code placed outside of the top-level blocks of a Vue component. Vue drops this content, so it never renders or runs.For example,
console.log(1);below is reported:<template><div>Hello</div></template>console.log(1);<script>export default {};</script> -
#13369
7940a3fThanks @dyc3! - Added the nursery ruleuseConsistentDefaultExportStyle, which enforces whether default-exported functions and classes are declared inside theexport defaultstatement or declared separately and exported by name.function foo() {}export default foo; // reported -
#13248
b7a3678Thanks @dyc3! - Added the nursery ruleuseConsistentExistenceIndexCheck, which reports checks such asindex < 0,index >= 0, andindex > -1on the result ofindexOf(),lastIndexOf(),findIndex(), orfindLastIndex(), and suggests comparing with-1instead.const index = list.indexOf(item);if (index < 0) {} -
#13305
4bcb0eeThanks @dyc3! - Added the nursery ruleuseConvexAccessControl, which reports exported Convex queries, mutations and actions whose handler doesn’t call an access control function, such asrequireUser(ctx). The rule belongs to theconvexdomain.import { mutation } from "./_generated/server";export const send = mutation({args: {},handler: async (ctx) => {await ctx.db.insert("messages", { body: "hello" });},}); -
#13475
1cb1e56Thanks @dyc3! - Added the nursery ruleuseConvexArgsValidator, which requires Convex queries, mutations, and actions to define anargsvalidator, so that Convex checks the arguments of every call before the handler runs.export const list = query({handler: async (ctx) => {return await ctx.db.query("tasks").collect();},}); -
#13473
88aa8a5Thanks @dyc3! - Added the nursery ruleuseConvexExplicitTableIds, which reports Convexdb.get(),db.patch(),db.replace(), anddb.delete()calls that don’t pass the table name as the first argument.const message = await ctx.db.get(messageId); -
#13503
764aba8Thanks @dyc3! - Added the nursery ruleuseCustomErrorDefinition, which enforces a consistent way of defining custom error classes. It reports error classes whose name doesn’t start with an uppercase letter and end withError, that don’t set theirnameproperty to the class name, that assignthis.messageinstead of passing the message tosuper(), or that don’t forward anoptionsparameter to a built-in error.class FooError extends Error {constructor(message) {super();this.message = message;}} -
#13365
6bdb1ffThanks @dyc3! - Added the nursery ruleuseElseIf. It reports anifstatement that follows anotherifstatement and compares the same variable or property against a different value, since only one of them can match. The rule offers an unsafe fix that addselsebefore the secondifstatement.if (status === "loading") {}if (status === "error") {} -
#13351
73a0cb6Thanks @dyc3! - Added the nursery ruleuseNegativeIndex, which reports index arguments ofslice(),at(),subarray(),splice(), andtoSpliced()that subtract a number from.length, and suggests a negative index instead.foo.at(foo.length - 1); // reported: write `foo.at(-1)` instead -
#13306
74c72aeThanks @dyc3! - Added the nursery ruleuseSetMethods, which reports code that combines or comparesSets by copying them into arrays, and suggests the matchingSetmethod, such asunion(),intersection(),difference(),isSubsetOf(), orisDisjointFrom().const a = new Set([1, 2]);const b = new Set([2, 3]);new Set([...a, ...b]);[...a].filter((value) => b.has(value));[...a].every((value) => b.has(value));a.intersection(b).size === 0; -
#13326
c3bd8baThanks @dyc3! - Added the nursery ruleuseTanstackQueryQueryOptions, which reports TanStack Query options that setqueryKeyorqueryFnwhere the query is used, and query keys that are written by hand in query client methods. Creating the options once withqueryOptions()keeps the key and the function of a query together.import { useQuery, useQueryClient } from "@tanstack/react-query";function Todo({ id }) {const query = useQuery({ queryKey: ["todo", id], queryFn: () => fetchTodo(id) });const queryClient = useQueryClient();const refresh = () => queryClient.invalidateQueries({ queryKey: ["todo", id] });} -
#13431
c8e0488Thanks @ematipico! - Improved the performance of commands that process files, such asbiome check,biome lintandbiome formatbetween 14% and 18%. -
#13367
addf04aThanks @dyc3! - Fixed #13320:noUnnecessaryConditionsno longer reports loops whose condition is the literaltrue, such aswhile (true) {},do {} while (true), andfor (; true;) {}. -
#13608
c1ac8a0Thanks @ematipico! - Fixed #13574: the Tailwind CSS rules no longer make Biome scan the whole project. Whentailwind.stylesheetis set, Biome reads only that stylesheet and the files it imports. It now reports an error if the stylesheet is missing, outside the project folder, or force-ignored byfiles.includes.useTailwindSortedClasses,noTailwindRawColors,noTailwindRestrictedClasses, andnoTailwindConflictingClassesno longer belong to theprojectdomain. -
#13571
7ac32bdThanks @dyc3! - Fixed #13511: Biome no longer skips indexing a project located inside a directory that the scanner ignores by default. These are meant to be places where the scanner should not look for files, but if a project is explicitly located inside one, it should still be indexed. -
#13484
c12cd1cThanks @dyc3! - FixednoFloatingPromisesreporting promises that are handled through a method named by a string literal. The following code is no longer reported:declare const promise: Promise<number>;promise["then"]((value) => value, () => {});promise["catch"](() => {}); -
#12903
16aaa88Thanks @yeliex! - Added the nursery ruleuseConsistentBooleanProps. When enabled, it requires<Foo bar={true} />by default. Setmodeto"implicit"to require the shorthand<Foo bar />. -
#13540
f1259d2Thanks @dyc3! - Fixed #13538: Tailwind classes with an arbitrary value that calls a function whose name starts with--, such asw-[--spacing(80)]ortext-[--alpha(red/50%)], are parsed correctly again.useTailwindSortedClassesno longer treats them as unknown classes or moves them to the front. -
#13420
c199c75Thanks @ematipico! - Fixed a bug where the Biome Scanner would index the same dependencies innode_modulesmore than once. This would result a slightly faster scanner. -
#13468
a98859cThanks @ematipico! - Improved the performance of formatting JavaScript and TypeScript code. -
#12681
6dbca4cThanks @NavpreetSSidhu! - Fixed #12625:noComponentHookFactoriesno longer reports a capitalised object property inside a function unless its function renders JSX or calls a hook.function methods(player) {return { Next: () => player.next() };} -
#13575
644c81aThanks @carlosrobert0! - Fixed #12991: the CSS parser no longer panics on a stray)in an@layerprelude, such as@layer)or@layer a b){}. It now reports a parse error and recovers. -
#12550
6b63f72Thanks @atharv1205! - Fixed the formatter output changing on a second run for logical chains. The formatter now flattens a parenthesized right operand with the same logical operator and more than two operands into the surrounding chain on the first pass. Previously, the operands of the removed group stayed together and the next format changed the output again.return (aaaaaaaaaaaaaaaaaaaa &&bbbbbbbbbbbbbbbbbbbbbbb &&cccccccccccccccccccc && dddddddddddddddddddddd &&cccccccccccccccccccc &&dddddddddddddddddddddd &&eeeeeeeeeeeeeeeeeeeeeeeee); -
#13498
4755be1Thanks @dyc3! - Fixed #13396: the Markdown formatter no longer duplicates an HTML comment at the start of an HTML block on every format when the HTML formatter is enabled.<!-- foo --><!-- foo -->*bar*<!-- foo -->*bar* -
#13497
8f3c808Thanks @dyc3! - Fixed #13397: the Markdown formatter no longer turns a paragraph into a heading when a lazy continuation line looks like a setext heading underline. The formatter adds the block quote prefix or list indentation to such a line, so it now escapes the line’s first marker.> foobar===> bar> \=== -
#13499
e2fff80Thanks @dyc3! - Fixed #13466: the Markdown formatter no longer merges a whitespace-only line in a fenced code block inside a list item with the next line. The line is now printed as an empty line, and the next line keeps its indentation.1. Item:```shellecho aecho becho b``` -
#13496
fb8cedeThanks @dyc3! - Fixed #13408: the Markdown parser now keeps the content of a fenced code block in a list item inside a block quote when a tab follows the>marker. Previously the code block ended after its opening fence, and the formatter moved the code out of the block.> - ```text> hello> ``` -
#13495
8a89af1Thanks @dyc3! - Fixed #13386: the Markdown parser no longer reports a false “Expected a list item” diagnostic when a list inside a block quote ends with a fenced code block or heading and a list item outside the quote follows a blank line.- > - ```text> hello> ```- > - ```text> there> ``` -
#13289
b6b42d7Thanks @srikar2130! - Fixed part of #13165: the CSS formatter no longer double-indents the arguments of a functional pseudo-class in a nested selector without a leading combinator, such as&:has(...)or.a:not(...). -
#13528
66386c5Thanks @dyc3! - Fixed #13525:noProcessGlobalno longer offers a fix for accesses through the global object, such asglobalThis.processorwindow["process"]. Adding an import doesn’t change what these accesses refer to, sobiome lint --writeno longer loops on them. -
#13528
66386c5Thanks @dyc3! - Fixed #13527: the fix ofnoProcessGlobalnow adds theprocessimport at the top level of the module instead of inside a TypeScript namespace. -
#13491
cc402faThanks @2tsoftwareapp! - Fixed #13428, wherenoUntrustedLicensesreported valid SPDX license expressions with the+(“or later”) operator (such asApache-2.0+andMPL-2.0+) as untrusted. -
#13160
b56e180Thanks @dyc3! - Fixed #13108:noUnusedExpressionsno longer reportssatisfiesexpressions used as statements, such asshape satisfies never;for exhaustiveness checks. -
#13514
aef78f6Thanks @Yshuro! - Fixednode_semvercaret range expansion for^0.0.0and^0.0so that they match the expected upper bounds (<0.0.1and<0.1.0, respectively) when resolvingpackage.jsonversion ranges. -
#13405
771de3eThanks @dyc3! - Fixed #13392:useNullishCoalescingno longer reportsflag || otherwhenflagis a parameter whose default value removesundefinedfrom its type, such asflag: boolean | undefined = false. -
#13281
b6c1d06Thanks @GBra-4-669! - Fixed #13280: the suppression parser no longer panics on non-ASCII whitespace. -
#12945
18975d9Thanks @vibbix! - FixednoUnknownTypeSelectorreportingfromandtorules directly inside SCSS mixins and@includeblocks that Sass places inside@keyframes:@mixin frames {from { opacity: 0; }to { opacity: 1; }}@keyframes fade {@include frames;} -
#13520
f733558Thanks @dyc3! - Fixed #11942:useArrayLiteralsno longer offers a fix forArray(...args),Array(x, ...args), and other calls whose spread arguments may expand to a single argument. The rule still reports them, but rewritingArray(...args)to[...args]changes the result whenargsis a single number. -
#13522
41a4f06Thanks @dyc3! - Fixed #13331: the safe fix ofuseImportTypewith theseparatedTypestyle no longer turns a default import used as a value intoimport type. For example,import spec, { type A, B } from "./mod"now keepsspecas a value import. -
#13559
dc7e82aThanks @MaxWang007! - Fixed #13548: the unsafe fix ofuseLiteralKeysnow escapes"and'when it turns a computed key into a string literal.['a"b']and[`a"b`]are rewritten to"a\"b"instead of invalid syntax. A computed key that contains a raw line break is left unchanged. -
#13565
32ada57Thanks @diluuuu10! - Fixed #13546: Fixed a false positive inuseNamedCaptureGroupby correctly handling escaped parentheses in RegExp strings. -
#13560
735dddcThanks @diluuuu10! - Fixed #13547: Updated theuseUnifiedTypeSignaturesunsafe fix to wrap function types in parentheses when merging them into a union type, preventing invalid TypeScript syntax. -
#13485
f50b262Thanks @dyc3! - Improved type inference forPromise. Biome now knows every static member that the TypeScript standard library declares for it, and the types of theresolveandrejectcallbacks passed to anew Promise()executor. For example,noFloatingPromisesnow reports the unhandled Promise created byPromise.withResolvers():Promise.withResolvers().promise; -
#13506
87ad81bThanks @dyc3! - Fixed #13380:useNumberNamespaceno longer offers a fix whenNumberis shadowed by a local binding, because the fix changed the runtime behavior of the code. The rule still reports the global. -
#13502
ee1f211Thanks @dyc3! - Fixed #11938:noUselessUndefinedInitializationno longer offers a fix forvardeclarations. Removing= undefinedfrom avardeclaration inside a loop or from a redeclaration changed the behavior of the program, becausevar x;doesn’t reset the variable. -
#13501
b11b273Thanks @dyc3! - Fixed a false positive inuseTanstackQueryExhaustiveDependencies: the rule no longer reports the variable that holds the query key when the query function reads it. Previously, the fix added the variable to its own value.function useTodo(id, queryClient) {const queryKey = ["todo", id];return useQuery({queryKey,queryFn: () =>fetchTodo(id).then((todo) => {queryClient.setQueryData(queryKey, todo); // No longer reported.return todo;}),});} -
#13595
d15af62Thanks @dyc3! - Fixed #10716:biome migratenow migrates"recommended": trueto"preset": "recommended"regardless of the whitespace and comments around the value. Previously, configurations such as{ "recommended": true }were migrated to"preset": "none", which disabled the recommended rules. -
#12635
2936d85Thanks @NavpreetSSidhu! - Fixed #12626:usePlaywrightValidDescribeCallbackno longer reports calls to adescribefunction declared in the same file. -
#13484
c12cd1cThanks @dyc3! - FixednoFloatingPromisesandnoMisusedPromisesnot recognizing thePromiseLikethat the methods of aPromiseLikevalue return. For example,noFloatingPromisesnow reports the following code:declare const thenable: PromiseLike<number>;thenable.then((value) => value); -
#13618
505a73fThanks @avens19! - Fixed #13588: rules that scan the project, such asnoFloatingPromises, are faster in projects with many dependencies. The CLI no longer prepares to watch dependency folders when it doesn’t watch the project. -
#12865
7166077Thanks @carlosrobert0! - Fixed #5172: the JUnit reporter now includes formatting diagnostics, sobiome checkandbiome formatlist the affected files. Test cases are now grouped into one<testsuite>per file. -
#13270
2d30ad9Thanks @dyc3! - Added the new nursery rulenoScssDeprecatedColorFunctions. It reports the deprecated Sass functions that read one channel of a color, such asred(),color.hue()andopacity(), and suggestscolor.channel()instead.a {opacity: opacity($brand);} -
#13218
840b293Thanks @dyc3! - Fixed #13088:useHeadingContentnow recognizesset:htmlandset:textas heading content inside Astro template expressions. -
#13567
6ea6489Thanks @dyc3! - Fixed #13563: Applying the unsafe fix ofnoConsoleno longer hangs when aconsolecall is used as a value, such as in a variable declaration, a function argument, or a ternary. The rule still reports these calls, but doesn’t offer a fix for them.const result = ok && console.log("x"); -
#13483
e3987d2Thanks @dyc3! - Fixed #13421: in Astro templates and in projects that depend onsolid-js, the rulesuseFocusableInteractive,noPositiveTabindex,noNoninteractiveTabindex,useAriaActivedescendantWithTabindex, andnoAriaHiddenOnFocusablenow recognize the lowercasetabindexattribute on JSX elements, and their diagnostics and fixes suggesttabindexinstead oftabIndex.The following code is no longer reported in a Solid project or inside an Astro template expression:
<div role="button" tabindex={0} onClick={() => {}} /> -
#13418
4de11d2Thanks @ematipico! - Fixed a bug where Biome couldn’t properly parse Svelte{#each}blocks when some syntax was used to define the keys. -
#13597
7a56cf9Thanks @dyc3! - Fixed #13588, a regression where Biome accidentally followed symbolic links insidenode_modules. -
#13521
3ad6f36Thanks @github-actions! - Updated the Baseline data of theuseBaselinerule. The rule now reports CSS features according to their latest Baseline status. -
#12587
e97ca39Thanks @kristoferma! - Fixed #10987:useErrorCausenow finds thecausein the last argument of a custom error class whose second argument isn’t an object, such asnew ErrorWithCode("message", "E_CODE", { cause: err }). Built-in errors keep their usual options position, which is the third argument forAggregateError:new AggregateError(errors, "message", { cause: err })is now valid, andnew AggregateError(errors, { cause: err })is now reported, because that object is the message and the cause is lost. -
#13430
b465622Thanks @dyc3! - Added the nursery rulenoVueRestrictedComponentOptions, which reports Vue component options that are listed in itscomponentOptionsoption.For example, with
"componentOptions": ["init", ["props", "*", "twoWay"]], the following component is reported twice:<script>export default {init() {},props: {name: { type: String, twoWay: true },},};</script>
© 2023-present Biome developers and contributors.