| name | biomejs |
| description | Resolve BiomeJS linting errors and warnings with fix-forward approach (never ignore/suppress). Covers formatting, correctness, suspicious patterns, style, complexity, and performance rules. |
| license | MIT |
| compatibility | opencode |
| metadata | {"category":"linting","tool":"biome"} |
What I do
I help resolve all BiomeJS errors and warnings by fixing the root cause, never by adding ignore comments or
suppressions.
Core Principles
- NEVER use suppression comments - Do not use
// biome-ignore, // biome-ignore lint, or any suppression
directives
- Fix forward, not backward - Address the underlying issue rather than disabling the rule
- Prefer automated fixes - Use
biome check --write or biome lint --write when safe
- Manual fixes for unsafe changes - When Biome flags a change as unsafe, carefully implement the fix manually
- Understand the intent - Each rule exists to catch real issues; fix them properly
When to use me
- After running
biome check, biome lint, or biome format and seeing errors
- When CI fails due to Biome linting violations
- When refactoring code and needing to address Biome warnings
- When reviewing Biome output and unsure how to fix specific rules
How to resolve errors
Step 1: Run Biome to see all issues
biome check .
biome check src/components/
biome check --verbose .
Step 2: Apply safe fixes automatically
biome check --write .
biome lint --write .
biome format --write .
Step 3: Address remaining unsafe issues manually
For each remaining error, understand the rule and fix properly:
Rule Categories and Fix Strategies
Formatting Rules
Issues: Incorrect indentation, spacing, line breaks, quote style
Fix: Use biome format --write or adjust manually:
- Follow project's
biome.json formatter settings
- Use spaces/tabs consistently per config
- Maintain consistent line ending style
Correctness Rules (High Priority)
These catch actual bugs - always fix immediately:
noUnusedVariables - Remove unused variables/imports or use them
const unused = 5;
const used = 5;
console.log(used);
noUnreachable - Remove unreachable code after return/throw
function foo() {
return 1;
console.log("never reached");
}
function foo() {
return 1;
}
noUndeclaredVariables - Declare variables or import them
console.log(undeclaredVar);
const declaredVar = "value";
console.log(declaredVar);
noDebugger - Remove debugger statements before committing
function process() {
debugger;
return data;
}
function process() {
return data;
}
Suspicious Rules
These indicate likely bugs or problematic patterns:
noExplicitAny - Use specific types instead of any
function process(data: any) { ... }
interface Data { id: string; value: number }
function process(data: Data) { ... }
function process(data: unknown) {
if (typeof data === 'string') { ... }
}
noArrayIndexKey - Use stable unique IDs for React keys
items.map((item, index) => <div key={index} />)
items.map((item) => <div key={item.id} />)
noDoubleEquals - Use strict equality (=== !==)
if (value == null)
if (value === null || value === undefined)
if (value == null)
noConsoleLog - Remove or replace console.log statements
console.log("debug");
Style Rules
useTemplate - Use template literals instead of string concatenation
const message = "Hello, " + name + "!";
const message = `Hello, ${name}!`;
useConst - Use const for variables that don't change
let x = 5;
const x = 5;
useSingleVarDeclarator - Declare one variable per statement
const a = 1,
b = 2,
c = 3;
const a = 1;
const b = 2;
const c = 3;
useNamingConvention - Follow naming conventions
const my_variable = 1;
const MyVariable = 1;
const myVariable = 1;
const MY_CONSTANT = 1;
Complexity Rules
noForEach - Use for-of loops for better performance and control
array.forEach((item) => { ... });
for (const item of array) { ... }
noBannedTypes - Avoid problematic types (String, Number, Boolean, Object, {})
function process(obj: Object) { ... }
function process(obj: {}) { ... }
function process(obj: Record<string, unknown>) { ... }
interface Config { ... }
function process(obj: Config) { ... }
useSimplifiedLogicExpression - Simplify complex boolean logic
if (a === true) { ... }
if (b === false) { ... }
if (a) { ... }
if (!b) { ... }
Performance Rules
noAccumulatingSpread - Avoid spread in reduce (creates new objects each iteration)
array.reduce((acc, item) => ({ ...acc, [item.key]: item }), {});
const result = {};
for (const item of array) {
result[item.key] = item;
}
noDelete - Use undefined assignment or Map/Set instead of delete
delete obj.property;
obj.property = undefined;
const map = new Map();
map.set("key", value);
map.delete("key");
Configuration-Specific Issues
biome.json Not Found
Ensure biome.json or biome.jsonc exists in project root:
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
}
}
Import Organization
Run biome check --write to automatically organize imports. Manual organization:
- Group imports: external libs → internal absolute → relative
- Sort alphabetically within groups
- Remove unused imports
File-Specific Issues
Some issues require project-level thinking:
noGlobalAssign - Don't modify global objects
Array.prototype.custom = () => {};
window.globalVar = 1;
function customArrayMethod(array) { ... }
noRestrictedGlobals - Use allowed globals only
const name = "value";
const status = 200;
const userName = "value";
const httpStatus = 200;
Common Workflows
Before Committing Code
biome check .
biome check --write .
biome check --verbose .
CI/CD Integration
biome check .
biome check --error-on-warnings --reporter=github .
Debugging CI Failures Locally
When CI pipelines fail due to Biome errors, always replicate the issue locally first:
biome ci --reporter=github --diagnostic-level=error . --verbose
biome check --error-on-warnings --reporter=github .
Why run locally first?
- Faster iteration than waiting for CI
- Can use
--write flag to auto-fix issues locally
- Identifies environment-specific issues (e.g., Biome version mismatches, config resolution)
- Allows using
--verbose for detailed diagnostics
- Prevents commit noise from trial-and-error fixes
Common CI/Local discrepancies:
- Different Biome versions - Ensure local version matches CI:
bunx biome --version
- Config not found - CI might run from different working directory; use explicit
--config-path
- Line ending differences - Windows (CRLF) vs Linux (LF); configure
formatter.lineEnding in biome.json
- File paths - CI may check files you haven't modified; run on entire codebase locally:
biome check .
Steps to resolve CI failures:
- Run the same Biome command locally that failed in CI
- Apply fixes with
biome check --write . (or manual fixes for unsafe changes)
- Verify all issues resolved:
biome check .
- Commit and push changes
Large Refactors
biome format --write .
biome lint --write .
biome check --verbose src/specific-file.ts
Emergency Recovery
If you encounter Biome errors that block work:
-
Check if it's a configuration error
biome check --config-path=./biome.json --verbose
-
Ensure Biome is up to date
npm update @biomejs/biome
yarn upgrade @biomejs/biome
-
Validate biome.json syntax
npx @biomejs/biome migrate --write
-
Check for file encoding issues
- Ensure files are UTF-8 encoded
- Check for BOM markers that might confuse parser
Remember
✅ DO:
- Fix the underlying issue
- Use
biome check --write for safe fixes
- Remove unused code
- Add proper types
- Simplify complex expressions
- Follow project conventions
❌ NEVER:
- Add
// biome-ignore comments
- Use
// biome-ignore lint suppressions
- Disable rules globally to avoid fixing issues
- Commit code with intentional Biome violations
Getting More Help
For specific rule documentation: