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;
What's Changed
- test(cli): fix flaky symlink test by @dyc3 in #12929
- fix(type_inference): remove lowering override for Array type by @dyc3 in #12930
- perf(rowan): skip childless nodes and avoid segment copies in the kind-filtered walk by @dyc3 in #12931
- chore: fix skill in Zed by @arendjr in #12949
- refactor: extract JS extent detection into biome_js_extent by @ematipico in #12830
- feat(markdown_parser): parse MDX ESM blocks and expressions by @ematipico in #12831
- feat(markdown_parser): parse MDX JSX tags by @ematipico in #12832
- docs: improve Biome description in README by @Netail in #12978
- chore(deps): update dependency vite to v7.3.7 [security] by @renovate[bot] in #12491
- fix(deps): update dependency happy-dom to v21 [security] by @renovate[bot] in #12641
- chore(deps): update rust crate globset to 0.4.21 by @renovate[bot] in #12848
- chore(deps): update rust crate jiff to 0.2.39 by @renovate[bot] in #12448
- chore(deps): update rust crate schemars to 1.2.3 by @renovate[bot] in #12452
- fix(lint/css): skip @font-palette-values in useGenericFontNames by @vibbix in #12973
- chore(deps): update rust crate libc to 0.2.191 by @renovate[bot] in #12449
- perf(css_semantic): store selector ranges and borrow resolved selectors by @vibbix in #12969
- fix(css_parser): correctly parse SCSS negative interpolation list items by @ashokram-si in #12983
- feat(lint): add noNegatedArrayPredicate by @dyc3 in #12841
- feat(lint): add noSubtractionComparison by @dyc3 in #12842
- feat(lint): add noSvelteIgnoredUnsubscribe by @dyc3 in #12866
- feat(lint): add noErasingOperation by @dyc3 in #12876
- feat(lint): add noConstantComparisons by @dyc3 in #12877
- feat(lint): add useNextScriptForGoogleAnalytics by @dyc3 in #12886
- feat(lint): add noArrayMethodsOnArguments by @dyc3 in #12887
- feat(lint): add noNumberArgumentOutOfRange by @dyc3 in #12888
- feat(lint): add noSharedBranchCode by @dyc3 in #12889
- feat(lint): add noUninvokedArrayCallback by @dyc3 in #12890
- feat(lint): add usePackageJsonCpu by @dyc3 in #12309
- feat(lint): add usePackageJsonEngines by @dyc3 in #12310
- chore: update rule metadata by @dyc3 in #12921
- fix(configuration): avoid overflowing rule indices by @dyc3 in #12986
- ci: release by @github-actions[bot] in #12938
New Contributors
- @ashokram-si made their first contribution in #12983
Full Changelog: https://github.com/biomejs/biome/compare/@biomejs/biome@2.6.5...@biomejs/biome@2.6.6