noBunModules (JavaScript)
Language JavaScript (and super languages)
Summary
Section titled “Summary”- Rule available since:
v2.5.12 - Diagnostic Category:
lint/nursery/noBunModules - This rule doesn’t have a fix.
- The default severity of this rule is warning.
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noBunModules": "error" } } }}Description
Section titled “Description”Forbid the use of Bun builtin modules.
This can be useful for client-side web projects that don’t have access to those modules.
The rule doesn’t trigger if there are dependencies declared in the package.json that match
the name of a built-in Bun module.
Type-only imports are ignored.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”import { Database } from "bun:sqlite";code-block.js:1:26 lint/nursery/noBunModules ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This import references a Bun builtin module.
> 1 │ import { Database } from "bun:sqlite";
│ ^^^^^^^^^^^^
2 │
ℹ Bun builtin modules are unavailable outside the Bun runtime, so this import breaks client-side and other non-Bun environments.
ℹ Remove this import or replace it with a runtime-agnostic alternative.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
import { Database } from "custom-sqlite";import type { DatabaseOptions } from "bun:sqlite";Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.