github biomejs/biome cli/v1.4.1-nightly.d869a33
CLI v1.4.1-nightly.d869a33

Biome now scores 97% compatibility with Prettier and features more than 180 linter rules.

Analyzer

CLI

New features

  • Biome now shows a diagnostic when it encounters a protected file. Contributed by @ematipico

  • The command biome migrate now updates the $schema if there's an outdated version.

  • The commands format, lint, check and ci now accepts two new arguments: --changed and --since.
    Use these options when the VCS integration is enabled to process only the files that were changed.
    Contributed by @simonxabris

    biome format --write --changed
  • Introduced a new command called biome explain, which has the capability to display documentation for lint rules. Contributed by @kalleep

Bug fixes

  • Fix #1247, Biome now prints a warning diagnostic if it encounters files that can't handle. Contributed by @ematipico

    You can ignore unknown file types using the files.ignoreUnknown configuration in biome.json:

    {
      "files": {
        "ignoreUnknown": true
      }
    }

    Or the --files-ignore-unknown CLI option:

    biome format --files-ignore-unknown=true --write .
  • Fix #709 and #805 by correctly parsing .gitignore files. Contributed by @ematipico

  • Fix #1117 by correctly respecting the matching. Contributed by @ematipico

  • Fix #691 and #1190, by correctly apply the configuration when computing overrides configuration. Contributed by @ematipico

Configuration

New features

  • Users can specify git ignore patterns inside ignore and include properties, for example it's possible to allow list globs of files using the ! character:

    {
      "files": {
        "ignore": [
          "node_modules/**",
          "!**/dist/**" // this is now accepted and allow list files inside the `dist` folder
        ]
      }
    }

Editors

New features

  • The LSP registers formatting without the need of using dynamic capabilities from the client.

    This brings formatting services to the editors that don't support or have limited support for dynamic capabilities.

Formatter

Bug fixes

  • Fix #1169. Account for escaped strings when computing layout for assignments. Contributed by @kalleep

  • Fix #1220. Avoid duplicating comments in type unions for mapped, empty object, and empty tuple types. #1240 Contributed by @faultyserver

  • Fix #1356. Ensure if_group_fits_on_line content is always written in RemoveSoftLinesBuffers. #1357 Contributed by @faultyserver

  • Fix #1171. Correctly format empty statement with comment inside arrow body when used as single argument in call expression. Contributed by @kalleep

JavaScript APIs

Linter

New features

  • Add useExportType that enforces the use of type-only exports for names that are only types. Contributed by @Conaclos

      interface A {}
      interface B {}
      class C {}
    
    - export type { A, C }
    + export { type A, C }
    
    - export { type B }
    + export type { B }
  • Add useFilenamingConvention, that enforces naming conventions for JavaScript and TypeScript filenames. Contributed by @Conaclos

    By default, the rule requires that a filename be in camelCase, kebab-case, snake_case, or matches the name of an export in the file.
    The rule provides options to restrict the allowed cases.

  • Add useNodejsImportProtocol that enforces the use of the node: protocol when importing Node.js modules. Contributed by @2-NOW and @Conaclos

    - import fs from "fs";
    + import fs from "node:fs";
  • Add noNodejsModules, that disallows the use of Node.js modules. Contributed by @anonrig, @ematipico, and @Conaclos

  • Add noInvalidUseBeforeDeclaration that reports variables and function parameters used before their declaration. Contributed by @Conaclos

    function f() {
      console.log(c); // Use of `c` before its declaration.
      const c = 0;
    }

Enhancements

  • Address #959 and #1157. noEmptyInterface no longer reports empty interfaces that extend a type. Contributed by @Conaclos

    This allows supporting interface augmentation in external modules as demonstrated in the following example:

    interface Extension {
      metadata: unknown;
    }
    
    declare module "@external/module" {
      // Empty interface that extends a type.
      export interface ExistingInterface extends Extension {}
    }
  • Preserve more comments in the fix of useExponentiationOperator. Contributed by @Conaclos

    The rule now preserves comments that follow the (optional) trailing comma.

    For example, the rule now suggests the following code fix:

    - Math.pow(
    -    a, // a
    -    2, // 2
    -  );
    +
    +    a ** // a
    +    2 // 2
    +
  • The code action (fix) of noMultipleSpacesInRegularExpressionLiterals is now marked as safe. Contributed by @Conaclos

Bug fixes

  • Fix #1061. noRedeclare no longer reports overloads of export default function. Contributed by @Conaclos

    The following code is no longer reported:

    export default function(a: boolean): boolean;
    export default function(a: number): number;
    export default function(a: number | boolean): number | boolean {
    	return a;
    }
  • Fix #651, useExhaustiveDependencies no longer reports out of scope dependencies. Contributed by @kalleep

    The following code is no longer reported:

    let outer = false;
    
    const Component = ({}) => {
      useEffect(() => {
        outer = true;
      }, []);
    }
  • Fix #1191. noUselessElse now preserve comments of the else clause. Contributed by @Conaclos

    For example, the rule suggested the following fix:

      function f(x) {
        if (x <0) {
          return 0;
        }
    -   // Comment
    -   else {
          return x;
    -   }
      }

    Now the rule suggests a fix that preserves the comment of the else clause:

      function f(x) {
        if (x <0) {
          return 0;
        }
        // Comment
    -   else {
          return x;
    -   }
      }
  • Fix #728. useSingleVarDeclarator no longer outputs invalid code. Contributed by @Conaclos

  • Fix #1167. useValidAriaProps no longer reports aria-atomic as invalid. Contributed by @unvalley

Parser

BREAKING CHANGES

  • The representation of imports has been simplified. Contributed by @Conaclos

    The new representation is closer to the ECMAScript standard.
    It provides a single way of representing a namespace import such as import * as ns from "".
    It rules out some invalid states that was previously representable.
    For example, it is no longer possible to represent a combined import with a type qualifier such as import type D, { N } from "".

    See #1163 for more details.

Bug fixes

  • Fix #1077 where parenthesized identifiers in conditional expression were being parsed as arrow expressions. Contributed by @kalleep

    These cases are now properly parsed:

    JavasSript:

      a ? (b) : a => {};

    TypeScript:

      a ? (b) : a => {};

    JSX:

      bar ? (foo) : (<a>{() => {}}</a>);

What's Changed

Other changes

New Contributors

Full Changelog: cli/v1.4.1-nightly.22dd4e1...cli/v1.4.1-nightly.d869a33

Don't miss a new biome release

NewReleases is sending notifications on new releases.