github biomejs/biome @biomejs/biome@2.6.6
Biome CLI v2.6.6

one hour ago

2.6.6

Patch Changes

  • #12887 da0422e Thanks @dyc3! - Added the new nursery rule noArrayMethodsOnArguments. It reports calls to array methods on the arguments object, which isn't an array, so these calls throw a TypeError when the code runs.

    function sum() {
      return arguments.reduce((total, value) => total + value, 0);
    }
  • #12877 cd9e10f Thanks @dyc3! - Added the nursery rule noConstantComparisons, 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 a7c9586 Thanks @dyc3! - Added the nursery rule noErasingOperation, which disallows operations with 0 that always result in zero: multiplying by 0, a bitwise AND with 0, and dividing 0 by 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 e954f55 Thanks @dyc3! - Added the nursery rule noNegatedArrayPredicate, which reports negated calls to Array#some() and Array#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 15039f7 Thanks @dyc3! - Added the new nursery rule noNumberArgumentOutOfRange, which reports number literal arguments of toString(), toFixed(), toExponential() and toPrecision() that are outside the range the method accepts. These calls throw a RangeError at runtime.

    value.toString(64);
  • #12889 1cd7520 Thanks @dyc3! - Added the nursery rule noSharedBranchCode, which reports code that is repeated at the start or end of every branch of an if statement. That code runs no matter which branch is taken, so it can be moved before or after the if statement.

    if (condition) {
      doSomething();
      cleanup();
    } else {
      doSomethingElse();
      cleanup();
    }
  • #12842 d47fcfd Thanks @dyc3! - Added the new nursery rule noSubtractionComparison, which reports subtracting two values only to compare the difference with 0, and suggests comparing the values directly.

    if (a - b > 0) {}
  • #12866 7c1cd5f Thanks @dyc3! - Added the nursery rule noSvelteIgnoredUnsubscribe, which reports calls to a store's subscribe() 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 6b73fcf Thanks @dyc3! - Added the new nursery rule noUninvokedArrayCallback, which reports array methods such as map() and forEach() 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 3bb18d8 Thanks @dyc3! - Added the nursery rule useNextScriptForGoogleAnalytics, which reports <script> elements that load Google Analytics or Google Tag Manager. Use the GoogleAnalytics and GoogleTagManager components from @next/third-parties/google instead, 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 next domain.

  • #12309 0538e30 Thanks @dyc3! - Added the new nursery rule usePackageJsonCpu, which reports package.json files that have no cpu field. The cpu field lists the processor types that the package supports.

    The following package.json file satisfies the rule:

    {
      "name": "my-package",
      "version": "1.0.0",
      "cpu": ["x64", "arm64"]
    }
  • #12310 191111d Thanks @dyc3! - Added the nursery rule usePackageJsonEngines, which reports package.json files that have no engines field.

    A package.json passes the rule once it declares the field:

    {
      "name": "my-package",
      "engines": {
        "node": ">=20"
      }
    }
  • #12986 cc929af Thanks @dyc3! - Fixed #12954, where configuring rules in groups with more than 256 rules could enable or disable the wrong rule.

  • #12931 fe9248e Thanks @dyc3! - Improved the performance of linting. Each lint pass now spends less time stepping over syntax nodes that no enabled rule looks at.

  • #12969 22d27e8 Thanks @vibbix! - Improved the performance of CSS linting. Rules that compare selectors, such as noDescendingSpecificity and noDuplicateSelectors, now make fewer memory allocations.

  • #12973 5a06df5 Thanks @vibbix! - Fixed useGenericFontNames reporting font-family inside @font-palette-values. There, font-family names 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 ce71284 Thanks @dyc3! - Fixed #12073: useExhaustiveSwitchCases now reports non-exhaustive switches over values read from for...of loops over Array.prototype.entries(), Map, and Set, and over properties of array elements indexed by a number variable.

    noMisusedPromises now also reports Promise-returning callbacks passed to array methods such as find and every.

  • #12983 2987b54 Thanks @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

Full Changelog: https://github.com/biomejs/biome/compare/@biomejs/biome@2.6.5...@biomejs/biome@2.6.6

Don't miss a new biome release

NewReleases is sending notifications on new releases.