github biomejs/biome cli/v1.8.4-nightly.d079e53
CLI v1.8.4-nightly.d079e53

pre-release26 days ago

Analyzer

Enhancements

CLI

New features

  • Add --graphql-linter-enabled option, to control whether the linter should be enabled or not for GraphQL files. Contributed by @ematipico

  • The option --max-diagnostics now accept a none value, which lifts the limit of diagnostics shown. Contributed by @ematipico

    • Add a new reporter --reporter=gitlab, that emits diagnostics for using the GitLab Code Quality report.

      [
        {
          "description": "Use === instead of ==. == is only allowed when comparing against `null`",
          "check_name": "lint/suspicious/noDoubleEquals",
          "fingerprint": "6143155163249580709",
          "severity": "critical",
          "location": {
            "path": "main.ts",
            "lines": {
              "begin": 4
            }
          }
        }
      ]

      Contributed by @NiclasvanEyk

  • Add new options to the lsp-proxy and start commands:

    • --log-path: a directory where to store the daemon logs. The commands also accepts the environment variable BIOME_LOG_PATH.
    • --log-prefix-name: a prefix that's added to the file name of the logs. It defaults to server.log. The commands also accepts the environment variable BIOME_LOG_PREFIX_NAME.

    @contributed by @ematipico

Enhancements

  • When a --reporter is provided, and it's different from the default one, the value provided by via --max-diagnostics is ignored and the limit is lifted. Contributed by @ematipico

  • biome init now generates a new config file with more options set.
    This change intends to improve discoverability of the options and to set the more commonly used options to their default values.
    Contributed by @Conaclos

  • The --verbose flag how reports the list of files that were evaluated, and the list of files that were fixed.
    The evaluated files are the those files that can be handled by Biome, files that are ignored, don't have an extension or have an extension that Biome can't evaluate are excluded by this list.
    The fixed files are those files that were handled by Biome and changed. Files that stays the same after the process are excluded from this list.

     VERBOSE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
      ℹ Files processed:
    
      - biome/biome.json
      - biome/packages/@biomejs/cli-win32-arm64/package.json
      - biome/packages/tailwindcss-config-analyzer/package.json
    
     VERBOSE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    
      ℹ Files fixed:
    
      - biome/biome/packages/tailwindcss-config-analyzer/src/generate-tailwind-preset.ts

    Contributed by @ematipico

Bug fixes

  • biome lint --write now takes --only and --skip into account (#3470). Contributed by @Conaclos

  • Fix #3368, now the reporter github tracks the diagnostics that belong to formatting and organize imports. Contributed by @ematipico

  • Fix #3545, display a warning, 'Avoid using unnecessary Fragment,' when a Fragment contains only one child element that is placed on a new line. Contributed by @satojin219

  • Migrating from Prettier or ESLint no longer overwrite the overrides field from the configuration (#3544). Contributed by @Conaclos

Configuration

  • Add support for loading configuration from .editorconfig files (#1724).

    Configuration supplied in .editorconfig will be overridden by the configuration in biome.json. Support is disabled by default and can be enabled by adding the following to your formatter configuration in biome.json:

    {
      "formatter": {
        "useEditorconfig": true
      }
    }

    Contributed by @dyc3

  • overrides from an extended configuration is now merged with the overrides of the extension.

    Given the following shared configuration biome.shared.json:

    {
      "overrides": [
        {
          "include": ["**/*.json"],
          // ...
        }
      ]
    }

    and the following configuration:

    {
      "extends": ["./biome.shared.json"],
      "overrides": [
        {
          "include": ["**/*.ts"],
          // ...
        }
      ]
    }

    Previously, the overrides from biome.shared.json was overwritten.
    It is now merged and results in the following configuration:

    {
      "extends": ["./biome.shared.json"],
      "overrides": [
        {
          "include": ["**/*.json"],
          // ...
        },
        {
          "include": ["**/*.ts"],
          // ...
        }
      ]
    }

    Contributed by @Conaclos

Editors

Bug fixes

  • Fix #3577, where the update of the configuration file was resulting in the creation of a new internal project. Contributed by @ematipico

Formatter

Enhancements

  • Add parentheses for nullcoalescing in ternaries.

    This change aligns on Prettier 3.3.3.
    This adds clarity to operator precedence.

    - foo ? bar ?? foo : baz;
    + foo ? (bar ?? foo) : baz;

    Contributed by @Conaclos

Bug fixes

  • Keep the parentheses around infer declarations in type unions and type intersections (#3419). Contributed by @Conaclos

  • Keep parentheses around a yield expression inside a type assertion.

    Previously, Biome removed parentheses around some expressions that require them inside a type assertion.
    For example, in the following code, Biome now preserves the parentheses.

    function* f() {
      return <T>(yield 0);
    }

    Contributed by @Conaclos

  • Remove parentheses around expressions that don't need them inside a decorator.

    Biome now matches Prettier in the following cases:

      class {
    -   @(decorator)
    +   @decorator
        method() {}
      },
      class {
    -   @(decorator())
    +   @decorator()
        method() {}
      },
      class {
        @(decorator?.())
        method() {}
      },

    Contributed by @Conaclos

  • Keep parentheses around objects preceded with a @satisfies comment.

    In the following example, parentheses are no longer removed.

    export const PROPS = /** @satisfies {Record<string, string>} */ ({
      prop: 0,
    });

    Contributed by @Conaclos

JavaScript APIs

Linter

New features

Enhancements

  • noInvalidUseBeforeDeclaration now reports direct use of an enum member before its declaration.

    In the following code, A is reported as use before its declaration.

    enum E {
      B = A << 1,
      A = 1,
    }

    Contributed by @Conaclos

  • useFilenamingConvention now supports unicase letters.

    unicase letters have a single case: they are neither uppercase nor lowercase.
    Biome now accepts filenames in unicase.
    For example, the filename 안녕하세요 is now accepted.

    We still reject a name that mixes unicase characters with lowercase or uppercase characters.
    For example, the filename A안녕하세요 is rejected.

    This change also fixes #3353.
    Filenames consisting only of numbers are now accepted.

    Contributed by @Conaclos

  • useFilenamingConvention now supports Next.js/Nuxt/Astro dynamic routes (#3465).

    Next.js, SolidStart, Nuxt, and Astro support dynamic routes such as [...slug].js and [[...slug]].js.

    Biome now recognizes this syntax. slug must contain only alphanumeric characters.

    Contributed by @Conaclos

  • useExportType no longer report empty export (#3535).

    An empty export {} allows you to force TypeScript to consider a file with no imports and exports as an EcmaScript module.
    While export type {} is valid, it is more common to use export {}.
    Users may find it confusing that the linter asks them to convert it to export type {}.
    Also, a bundler should be able to remove export {} as well as export type {}.
    So it is not so useful to report export {}.

    Contributed by @Conaclos

  • noUnusedVariables now checks TypeScript declaration files.

    This allows to report a type that is unused because it isn't exported.
    Global declarations files (declarations files without exports and imports) are still ignored.

    Contributed by @Conaclos

  • noBlankTarget now supports an array of allowed domains.

    The following configuration allows example.com and example.org as blank targets.

    "linter": {
      "rules": {
        "a11y": {
          "noBlankTarget": {
          "level": "error",
            "options": {
               "allowDomains": ["example.com", "example.org"]
              }
            }
          }
        }
      }

    Contributed by @Jayllyz

  • noNodejsModules now ignores type-only imports (#1674).

    The rule no longer reports type-only imports such as:

    import type assert from "assert";
    import type * as assert2 from "assert";

    Contributed by @Conaclos

  • noNodejsModules now ignores imports of a package which has the same name as a Node.js module. Contributed by @Conaclos

Bug fixes

  • Don't request alt text for elements hidden from assistive technologies (#3316). Contributed by @robintown

  • Fix [#3149] crashes that occurred when applying the noUselessFragments unsafe fixes in certain scenarios. Contributed by @unvalley

  • noExcessiveNestedTestSuites: Fix another edge case where the rule would alert on heavily nested zod schemas. Contributed by @dyc3

  • noExtraNonNullAssertion no longer reports a single non-null assertion enclosed in parentheses (#3352). Contributed by @Conaclos

  • noRedeclare no longer report redeclartions for lexically scoped function declarations #3664.

    In JavaScript strict mode, function declarations are lexically scoped:
    they cannot be accessed outside the block where they are declared.

    In non-strict mode, function declarations are hoisted to the top of the enclosing function or global scope.

    Previously Biome always hoisted function declarations.
    It now takes into account whether the code is in strict or non strict mode.

    Contributed by @Conaclos

  • noMultipleSpacesInRegularExpressionLiterals now correctly provides a code fix when unicode characters are used.

  • useAdjacentOverloadSignatures no longer reports a #private class member and a public class member that share the same name (#3309).

    The following code is no longer reported:

    class C {
      #f() {}
      g() {}
      f() {}
    }

    Contributed by @Conaclos

  • useNamingConvention now accepts applying custom convention on abstract classes. Contributed by @Conaclos

  • useNamingConvention no longer suggests an empty fix when a name doesn't match strict Pascal case (#3561).

    Previously the following code led useNamingConvention to suggest an empty fix.
    The rule no longer provides a fix for this case.

    type AAb = any

    Contributed by @Conaclos

  • useNamingConvention no longer provides fixes for global TypeScript declaration files.

    Global TypeScript declaration files have no epxorts and no imports.
    All the declared types are available in all files of the project.
    Thus, it is not safe to propose renaming only in the declaration file.

    Contributed by @Conaclos

  • suspicious/noControlCharactersInRegex now corretcly handle \u escapes in unicode-aware regexes.

    Previously, the rule didn't consider regex with the v flags as unicode-aware regexes.
    Moreover, \uhhhh was not handled in unicode-aware regexes.

    Contributed by @Conaclos

  • suspicious/noControlCharactersInRegex now reports control characters and escape sequence of control characters in string regexes. Contributed by @Conaclos

  • useSortedClasses lint error with Template literals (#3394). Contributed by @hangaoke1

Parser

Bug fixes

.class {
  && {
    color: red;
  }
}
  • Fix #3410 by correctly parsing break statements containing keywords.
    out: while (true) {
      break out;
    }
    Contributed by @ah-yu

What's Changed

Other changes

New Contributors

Full Changelog: cli/v1.8.4-nightly.bd1d0c6...cli/v1.8.4-nightly.d079e53

Don't miss a new biome release

NewReleases is sending notifications on new releases.