Socket
Socket
Sign inDemoInstall

@biomejs/biome

Package Overview
Dependencies
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@biomejs/biome - npm Package Versions

1
57

1.3.0

Diff

Changelog

Source

1.3.0 (2023-10-19)

Analyzer

Enhancements
  • Import sorting is safe to apply now, and it will be applied when running check --apply instead of check --apply-unsafe.

  • Import sorting now handles Bun imports bun:<name>, absolute path imports /<path>, and Node's subpath imports #<name>. See our documentation for more details. Contributed by @Conaclos

CLI

Bug fixes
  • Fix #319. The command biome lint now shows the correct options. Contributed by @ematipico
  • Fix #312. Running biome --version now exits with status code 0 instead of 1. Contributed by @nhedger
  • Fix a bug where the extends functionality doesn't carry over organizeImports.ignore. Contributed by @ematipico
  • The CLI now returns the original content when using stdin and the original content doesn't change. Contributed by @ematipico
New features
  • Add support for BIOME_BINARY environment variable to override the location of the binary. Contributed by @ematipico

  • Add option --indent-width, and deprecated the option --indent-size. Contributed by @ematipico

  • Add option --javascript-formatter-indent-width, and deprecated the option --javascript-formatter-indent-size. Contributed by @ematipico

  • Add option --json-formatter-indent-width, and deprecated the option --json-formatter-indent-size. Contributed by @ematipico

  • Add option --daemon-logs to biome rage. The option is required to view Biome daemon server logs. Contributed by @unvalley

  • Add support for logging. By default, Biome doesn't log anything other than diagnostics. Logging can be enabled with the new option --log-level:

    biome format --log-level=info ./src
    

    There are four different levels of logging, from the most verbose to the least verbose: debug, info, warn and error. Here's how an INFO log will look like:

    2023-10-05T08:27:01.954727Z  INFO  Analyze file ./website/src/playground/components/Resizable.tsx
      at crates/biome_service/src/file_handlers/javascript.rs:298 on biome::worker_5
      in Pulling diagnostics with categories: RuleCategories(SYNTAX)
      in Processes formatting with path: "./website/src/playground/components/Resizable.tsx"
      in Process check with path: "./website/src/playground/components/Resizable.tsx"
    

    You can customize how the log will look like with a new option --log-kind. The supported kinds are: pretty, compact and json.

    pretty is the default logging. Here's how a compact log will look like:

    2023-10-05T08:29:04.864247Z  INFO biome::worker_2 Process check:Processes linting:Pulling diagnostics: crates/biome_service/src/file_handlers/javascript.rs: Analyze file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx" categories=RuleCategories(LINT)
    2023-10-05T08:29:04.864290Z  INFO biome::worker_7 Process check:Processes formatting: crates/biome_service/src/file_handlers/javascript.rs: Format file ./website/src/playground/components/Tabs.tsx path="./website/src/playground/components/Tabs.tsx" path="./website/src/playground/components/Tabs.tsx"
    2023-10-05T08:29:04.879332Z  INFO biome::worker_2 Process check:Processes formatting:Pulling diagnostics: crates/biome_service/src/file_handlers/javascript.rs: Analyze file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx" categories=RuleCategories(SYNTAX)
    2023-10-05T08:29:04.879383Z  INFO biome::worker_2 Process check:Processes formatting: crates/biome_service/src/file_handlers/javascript.rs: Format file ./website/src/playground/components/Resizable.tsx path="./website/src/playground/components/Resizable.tsx" path="./website/src/playground/components/Resizable.tsx"
    
Enhancements
  • Deprecated the environment variable ROME_BINARY. Use BIOME_BINARY instead. Contributed by @ematipico
  • Biome doesn't check anymore the presence of the .git folder when VCS support is enabled. Contributed by @ematipico
  • biome rage doesn't print the logs of the daemon, use biome rage --daemon-logs to print them. Contributed by @unvalley

Configuration

New features
  • Add option formatter.indentWidth, and deprecated the option formatter.indentSize. Contributed by @ematipico

  • Add option javascript.formatter.indentWidth, and deprecated the option javascript.formatter.indentSize. Contributed by @ematipico

  • Add option json.formatter.indentWidth, and deprecated the option json.formatter.indentSize. Contributed by @ematipico

  • Add option include to multiple sections of the configuration

    • files.include;
    • formatter.include;
    • linter.include;
    • organizeImports.include; When include and ignore are both specified, ignore takes precedence over include
  • Add option overrides, where users can modify the behaviour of the tools for certain files or paths.

    For example, it's possible to modify the formatter lineWidth, and even quoteStyle for certain files that are included in glob path generated/**:

    {
      "formatter": {
        "lineWidth": 100
      },
      "overrides": [
        {
          "include": ["generated/**"],
          "formatter": {
            "lineWidth": 160
          },
          "javascript": {
            "formatter": {
              "quoteStyle": "single"
            }
          }
        }
      ]
    }
    

    Or, you can disable certain rules for certain path, and disable the linter for other paths:

    {
      "linter": {
        "enabled": true,
        "rules": {
          "recommended": true
        }
      },
      "overrides": [
        {
          "include": ["lib/**"],
          "linter": {
            "rules": {
              "suspicious": {
                "noDebugger": "off"
              }
            }
          }
        },
        {
          "include": ["shims/**"],
          "linter": {
            "enabled": false
          }
        }
      ]
    }
    

Bug fixes

  • Fix #343, extends was incorrectly applied to the biome.json file. Contributed by @ematipico

Editors

Bug fixes
  • Fix #404. Biome intellij plugin now works on Windows. Contributed by @victor-teles

  • Fix #402. Biome format on intellij plugin now recognize biome.json. Contributed by @victor-teles

Formatter

Enhancements
  • Use OnceCell for the Memoized memory because that's what the RefCell<Option> implemented. Contributed by @denbezrukov

Linter

Promoted rules

The following rules are now recommended:

New features
  • Add noEmptyCharacterClassInRegex rule. The rule reports empty character classes and empty negated character classes in regular expression literals. Contributed by @Conaclos

  • Add noMisleadingInstantiator rule. The rule reports the misleading use of the new and constructor methods. Contributed by @unvalley

  • Add noUselessElse rule. The rule reports else clauses that can be omitted because their if branches break. Contributed by @Conaclos

  • Add noUnusedImports rule. The rule reports unused imports and suggests removing them. Contributed by @Conaclos

    noUnusedVariables reports also unused imports, but don't suggest their removal. Once noUnusedImports stabilized, noUnusedVariables will not report unused imports.

  • Add useShorthandAssign rule. The rule enforce use of shorthand operators that combine variable assignment and some simple mathematical operations. For example, x = x + 4 can be shortened to x += 4. Contributed by @victor-teles

  • Add useAsConstAssertion rule. The rule enforce use of as const assertion to infer literal types. Contributed by @unvalley

  • Add noMisrefactoredShorthandAssign rule. The rule reports shorthand assigns when variable appears on both sides. For example x += x + b Contributed by @victor-teles

  • Add noApproximativeNumericConstant rule. Contributed by @nikeee

Add noInteractiveElementToNoninteractiveRole rule. The rule enforces the non-interactive ARIA roles are not assigned to interactive HTML elements. Contributed by @nissy-dev

  • Add useAriaActivedescendantWithTabindex rule. The rule enforces that tabIndex is assigned to non-interactive HTML elements with aria-activedescendant. Contributed by @nissy-dev

  • Add noUselessLoneBlockStatements rule. The rule reports standalone blocks that don't include any lexical scoped declaration. Contributed by @emab

  • Add noInvalidNewBuiltin rule. The rule reports use of new on Symbol and BigInt. Contributed by @lucasweng

Enhancements
Bug fixes

Fix #294. noConfusingVoidType no longer reports false positives for return types. Contributed by @b4s36t4

Fix #313. noRedundantUseStrict now keeps leading comments.

Fix #383. noMultipleSpacesInRegularExpressionLiterals now provides correct code fixes when consecutive spaces are followed by a quantifier. Contributed by @Conaclos

Fix #397. useNumericLiterals now provides correct code fixes for signed numbers. Contributed by @Conaclos

  • Fix 452. The linter panicked when it met a malformed regex (a regex not ending with a slash).

  • Fix #104. We now correctly handle types and values with the same name.

  • Fix #243 a false positive case where the incorrect scope was defined for the infer type in rule noUndeclaredVariables. Contributed by @denbezrukov

  • Fix #322, now noSelfAssign correctly handles literals inside call expressions.

  • Changed how noSelfAssign behaves. The rule is not triggered anymore on function calls. Contributed by @ematipico

Parser

  • Enhance diagnostic for infer type handling in the parser. The 'infer' keyword can only be utilized within the ' extends' clause of a conditional type. Using it outside this context will result in an error. Ensure that any type declarations using 'infer' are correctly placed within the conditional type structure to avoid parsing issues. Contributed by @denbezrukov

  • Add support for parsing trailing commas inside JSON files:

    {
      "json": {
        "parser": {
          "allowTrailingCommas": true
        }
      }
    }
    

    Contributed by @nissy-dev

VSCode

dominionl
published 1.2.2-nightly.ee2e2ab •

dominionl
published 1.2.2-nightly.1e3fc94 •

dominionl
published 1.2.2 •

Changelog

Source

1.2.2 (2023-09-16)

CLI

Bug fixes
  • Fix a condition where import sorting wasn't applied when running biome check --apply
dominionl
published 1.2.1 •

Changelog

Source

1.2.1 (2023-09-15)

Configuration

  • Fix an edge case where the formatter language configuration wasn't picked.
  • Fix the configuration schema, where json.formatter properties weren't transformed in camel case.
dominionl
published 1.2.0 •

Changelog

Source

1.2.0 (2023-09-15)

CLI

New features
  • Add new options to customize the behaviour the formatter based on the language of the file
    • --json-formatter-enabled
    • --json-formatter-indent-style
    • --json-formatter-indent-size
    • --json-formatter-line-width
    • --javascript-formatter-enabled
    • --javascript-formatter-indent-style
    • --javascript-formatter-indent-size
    • --javascript-formatter-line-width
Bug fixes
  • Fix a bug where --errors-on-warning didn't work when running biome ci command.

Configuration

New features
  • Add new options to customize the behaviour of the formatter based on the language of the file
    • json.formatter.enabled
    • json.formatter.indentStyle
    • json.formatter.indentSize
    • json.formatter.lineWidth
    • javascript.formatter.enabled
    • javascript.formatter.indentStyle
    • javascript.formatter.indentSize
    • javascript.formatter.lineWidth

Linter

Promoted rules

New rules are incubated in the nursery group. Once stable, we promote them to a stable group. The following rules are promoted:

New rules
  • Add noConfusingVoidType rule. The rule reports the unusual use of the void type. Contributed by @shulandmimi
Removed rules
  • Remove noConfusingArrow

    Code formatters, such as prettier and Biome, always adds parentheses around the parameter or the body of an arrow function. This makes the rule useless.

    Contributed by @Conaclos

Enhancements
  • noFallthroughSwitchClause now relies on control flow analysis to report most of the switch clause fallthrough. Contributed by @Conaclos

  • noAssignInExpressions no longer suggest code fixes. Most of the time the suggestion didn't match users' expectations. Contributed by @Conaclos

  • noUselessConstructor no longer emits safe code fixes. Contributed by @Conaclos

    All code fixes are now emitted as unsafe code fixes. Removing a constructor can change the behavior of a program.

  • useCollapsedElseIf now only provides safe code fixes. Contributed by @Conaclos

  • noUnusedVariables now reports more cases.

    The rule is now able to ignore self-writes. For example, the rule reports the following unused variable:

    let a = 0;
    a++;
    a += 1;
    

    The rule is also capable of detecting an unused declaration that uses itself. For example, the rule reports the following unused interface:

    interface I {
      instance(): I
    }
    

    Finally, the rule now ignores all TypeScript declaration files, including global declaration files.

    Contributed by @Conaclos

Bug fixes
  • Fix #182, making useLiteralKeys retains optional chaining. Contributed by @denbezrukov

  • Fix #168, fix useExhaustiveDependencies false positive case when stable hook is on a new line. Contributed by @denbezrukov

  • Fix #137, fix noRedeclare false positive case with TypeScript module declaration:

    declare module '*.gif' {
        const src: string;
    }
    
    declare module '*.bmp' {
        const src: string;
    }
    

    Contributed by @denbezrukov

  • Fix #258, fix noUselessFragments the case where the rule removing an assignment. Contributed by @denbezrukov

  • Fix #266, where complexity/useLiteralKeys emitted a code action with an invalid AST. Contributed by @ematipico

  • Fix #105, removing false positives reported by noUnusedVariables.

    The rule no longer reports the following used variable:

    const a = f(() => a);
    

    Contributed by @Conaclos

VSCode

Enhancements
  • Improve server binary resolution when using certain package managers, notably pnpm.

    The new strategy is to point to node_modules/.bin/biome path, which is consistent for all package managers.

dominionl
published 1.1.2-nightly.9c28238 •

dominionl
published 1.1.2 •

Changelog

Source

1.1.2 (2023-09-07)

Editors

Bug fixes
  • Fix a case where an empty JSON file would cause the LSP server to crash. Contributed by @ematipico

Linter

Enhancements
  • useNamingConvention now accepts import namespaces in PascalCase and rejects export namespaces in CONSTANT_CASE.

    The following code is now valid:

    import * as React from "react";
    

    And the following code is now invalid:

    export * as MY_NAMESPACE from "./lib.js";
    

    Contributed by @Conaclos

  • noUselessConstructor now ignores decorated classes and decorated parameters. The rule now gives suggestions instead of safe fixes when parameters are annotated with types. Contributed by @Conaclos

dominionl
published 1.1.1 •

Changelog

Source

1.1.1 (2023-09-07)

Analyzer

Bug fixes
  • The diagnostic for // rome-ignore suppression comment should not be a warning. A warning could block the CI, marking a gradual migration difficult. The code action that changes // rome-ignore to // biome-ignore is disabled as consequence. Contributed by @ematipico
dominionl
published 1.1.0 •

Changelog

Source

1.1.0 (2023-09-06)

Analyzer

Enhancements
  • Add a code action to replace rome-ignore with biome-ignore. Use biome check --apply-unsafe to update all the comments. The action is not bulletproof, and it might generate unwanted code, that's why it's unsafe action. Contributed by @ematipico

CLI

Enhancements
  • Biome now reports a diagnostics when a rome.json file is found.
  • biome migrate --write creates biome.json from rome.json, but it won't delete the rome.json file. Contributed by @ematipico
Bug fixes
  • Biome uses biome.json first, then it attempts to use rome.json.
  • Fix a case where Biome couldn't compute correctly the ignored files when the VSC integration is enabled. Contributed by @ematipico

Configuration

Editors

Bug fixes
  • The LSP now uses its own socket and won't rely on Biome's socket. This fixes some cases where users were seeing multiple servers in the rage output.

Formatter

Enhancements
  • You can use // biome-ignore as suppression comment.
  • The // rome-ignore suppression is deprecated.

JavaScript APIs

Linter

New features
  • Add useCollapsedElseIf rule. This new rule requires merging an else and an if, if the if statement is the only statement in the else block. Contributed by @n-gude
Enhancements
  • useTemplate now reports all string concatenations.

    Previously, the rule ignored concatenation of a value and a newline or a backquote. For example, the following concatenation was not reported:

    v + "\n";
    "`" + v + "`";
    

    The rule now reports these cases and suggests the following code fixes:

    - v + "\n";
    + `${v}\n`;
    - v + "`";
    + `\`${v}\``;
    

    Contributed by @Conaclos

  • useExponentiationOperator suggests better code fixes.

    The rule now preserves any comment preceding the exponent, and it preserves any parenthesis around the base or the exponent. It also adds spaces around the exponentiation operator **, and always adds parentheses for pre- and post-updates.

    - Math.pow(a++, /**/ (2))
    + (a++) ** /**/ (2)
    

    Contributed by @Conaclos

  • You can use // biome-ignore as suppression comment.

  • The // rome-ignore suppression is deprecated.

Bug fixes
  • Fix #80, making noDuplicateJsxProps case-insensitive.

    Some frameworks, such as Material UI, rely on the case-sensitivity of JSX properties. For example, TextField has two properties with the same name, but distinct cases:

    <TextField inputLabelProps="" InputLabelProps=""></TextField>
    

    Contributed by @Conaclos

  • Fix #138

    noCommaOperator now correctly ignores all use of comma operators inside the update part of a for loop. The following code is now correctly ignored:

    for (
      let i = 0, j = 1, k = 2;
      i < 100;
      i++, j++, k++
    ) {}
    

    Contributed by @Conaclos

  • Fix rome#4713.

    Previously, useTemplate made the following suggestion:

    - a + b + "px"
    + `${a}${b}px`
    

    This breaks code where a and b are numbers.

    Now, the rule makes the following suggestion:

    - a + b + "px"
    + `${a + b}px`
    

    Contributed by @Conaclos

  • Fix rome#4109

    Previously, useTemplate suggested an invalid code fix when a leading or trailing single-line comment was present:

      // leading comment
    - 1 /* inner comment */ + "+" + 2 // trailing comment
    + `${// leading comment
    + 1 /* inner comment */}+${2 //trailing comment}` // trailing comment
    

    Now, the rule correctly handles this case:

      // leading comment
    - 1 + "+" + 2 // trailing comment
    + `${1}+${2}` // trailing comment
    

    As a sideeffect, the rule also suggests the removal of any inner comments.

    Contributed by @Conaclos

  • Fix rome#3850

    Previously useExponentiationOperator suggested invalid code in a specific edge case:

    - 1 +Math.pow(++a, 2)
    + 1 +++a**2
    

    Now, the rule properly adds parentheses:

    - 1 +Math.pow(++a, 2)
    + 1 +(++a) ** 2
    

    Contributed by @Conaclos

  • Fix #106

    noUndeclaredVariables now correctly recognizes some TypeScript types such as Uppercase.

    Contributed by @Conaclos

  • Fix rome#4616

    Previously noUnreachableSuper reported valid codes with complex nesting of control flow structures.

    Contributed by @Conaclos

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc