Use when applying Biome's linting capabilities, rule categories, and code quality enforcement to JavaScript/TypeScript projects.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
Expert knowledge of Biome's linting capabilities, rule categories, and code quality enforcement for JavaScript and TypeScript projects.
Biome's linter provides fast, comprehensive code quality checks with a focus on correctness, performance, security, and best practices. It's designed to catch common bugs and enforce consistent code patterns.
# Check files without fixing
biome check .
# Check and auto-fix
biome check --write .
# Check specific files
biome check src/**/*.ts
# CI mode (strict, fails on warnings)
biome ci .
# Verbose output
biome check --verbose .
# JSON output
biome check --json .
# Only lint (skip formatting)
biome lint .
# Apply safe fixes only
biome check --write --unsafe=false .
Rules for web accessibility and WCAG compliance:
{
"linter": {
"rules": {
"a11y": {
"recommended": true,
"noAccessKey": "error",
"noAriaHiddenOnFocusable": "error",
"noAutofocus": "warn",
"noBlankTarget": "error",
"noPositiveTabindex": "error",
"useAltText": "error",
"useAnchorContent": "error",
"useButtonType": "error",
"useValidAriaProps": "error"
}
}
}
}
Common violations:
Rules to reduce code complexity:
{
"linter": {
"rules": {
"complexity": {
"recommended": true,
"noBannedTypes": "error",
"noExcessiveCognitiveComplexity": "warn",
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noUselessConstructor": "error",
"noUselessEmptyExport": "error",
"noUselessFragments": "error",
"noUselessLabel": "error",
"noUselessRename": "error",
"noUselessSwitchCase": "error",
"noWith": "error"
}
}
}
}
Rules for code correctness and bug prevention:
{
"linter": {
"rules": {
"correctness": {
"recommended": true,
"noChildrenProp": "error",
"noConstAssign": "error",
"noConstantCondition": "error",
"noConstructorReturn": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "error",
"noInvalidConstructorSuper": "error",
"noNewSymbol": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedVariables": "error",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
}
}
}
}
Critical rules:
noUndeclaredVariables: Catch undeclared variablesnoUnusedVariables: Remove unused codenoConstAssign: Prevent const reassignmentnoUnreachable: Detect unreachable codeuseIsNan: Use isNaN() for NaN checksRules for performance optimization:
{
"linter": {
"rules": {
"performance": {
"recommended": true,
"noAccumulatingSpread": "warn",
"noDelete": "error"
}
}
}
}
Rules for security best practices:
{
"linter": {
"rules": {
"security": {
"recommended": true,
"noDangerouslySetInnerHtml": "error",
"noDangerouslySetInnerHtmlWithChildren": "error",
"noGlobalEval": "error"
}
}
}
}
Critical security rules:
Code style and consistency rules:
{
"linter": {
"rules": {
"style": {
"recommended": true,
"noArguments": "error",
"noCommaOperator": "error",
"noImplicitBoolean": "warn",
"noNegationElse": "warn",
"noNonNullAssertion": "warn",
"noParameterAssign": "error",
"noRestrictedGlobals": "error",
"noShoutyConstants": "warn",
"noUnusedTemplateLiteral": "error",
"noVar": "error",
"useBlockStatements": "warn",
"useCollapsedElseIf": "warn",
"useConst": "error",
"useDefaultParameterLast": "error",
"useEnumInitializers": "warn",
"useExponentiationOperator": "error",
"useFragmentSyntax": "error",
"useNumericLiterals": "error",
"useSelfClosingElements": "error",
"useShorthandArrayType": "error",
"useSingleVarDeclarator": "error",
"useTemplate": "warn",
"useWhile": "error"
}
}
}
}
Key style rules:
noVar: Use let/const instead of varuseConst: Prefer const for immutable bindingsnoNonNullAssertion: Avoid ! assertions in TypeScriptuseTemplate: Prefer template literalsRules for suspicious code patterns:
{
"linter": {
"rules": {
"suspicious": {
"recommended": true,
"noArrayIndexKey": "warn",
"noAssignInExpressions": "error",
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCommentText": "error",
"noCompareNegZero": "error",
"noConsoleLog": "warn",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDoubleEquals": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "warn",
"noExplicitAny": "warn",
"noExtraNonNullAssertion": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noLabelVar": "error",
"noMisleadingCharacterClass": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noSelfCompare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeNegation": "error",
"useDefaultSwitchClauseLast": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
}
}
}
Critical suspicious patterns:
noExplicitAny: Avoid any in TypeScriptnoConsoleLog: Remove console.log in productionnoDebugger: Remove debugger statementsnoDoubleEquals: Use === instead of ==noDuplicateObjectKeys: Catch duplicate keysMaximum strictness for high-quality codebases:
{
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"a11y": { "recommended": true },
"complexity": { "recommended": true },
"correctness": { "recommended": true },
"performance": { "recommended": true },
"security": { "recommended": true },
"style": { "recommended": true },
"suspicious": {
"recommended": true,
"noExplicitAny": "error",
"noConsoleLog": "error"
}
}
}
}
Start lenient and progressively tighten:
{
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "warn",
"noConsoleLog": "warn"
},
"style": {
"noVar": "error",
"useConst": "warn"
}
}
}
}
React configuration example:
{
"linter": {
"rules": {
"recommended": true,
"a11y": { "recommended": true },
"correctness": {
"recommended": true,
"noChildrenProp": "error"
},
"security": {
"noDangerouslySetInnerHtml": "error"
},
"suspicious": {
"noArrayIndexKey": "error"
}
}
}
}
Suppress specific violations:
// biome-ignore lint/suspicious/noExplicitAny: Legacy code
function legacyFunction(data: any) {
return data;
}
// biome-ignore lint/suspicious/noConsoleLog: Debug logging
console.log('Debug info');
// Multiple rules
// biome-ignore lint/suspicious/noExplicitAny lint/style/useConst: Migration
var config: any = {};
Ignore entire file:
/* biome-ignore-file */
// Legacy file, skip all linting
Ignore patterns in biome.json:
{
"files": {
"ignore": [
"**/generated/**",
"**/*.config.js",
"**/vendor/**"
]
}
}
"recommended": truebiome ci in pipelinesCreate shared rule sets for organization:
{
"extends": ["@company/biome-config"],
"linter": {
"rules": {
"suspicious": {
"noConsoleLog": "error"
}
}
}
}
Use overrides for different code areas:
{
"overrides": [
{
"include": ["src/**/*.ts"],
"linter": {
"rules": {
"suspicious": {
"noExplicitAny": "error"
}
}
}
},
{
"include": ["scripts/**/*.js"],
"linter": {
"rules": {
"suspicious": {
"noConsoleLog": "off"
}
}
}
}
]
}
Migrating from ESLint:
npm install -D @biomejs/biomenpx biome initnpx biome check . to see violationsnpx biome check --write .{
"scripts": {
"lint": "biome check .",
"lint:fix": "biome check --write .",
"lint:ci": "biome ci ."
}
}
Using husky:
{
"husky": {
"hooks": {
"pre-commit": "biome check --write --changed"
}
}
}
- name: Run Biome
run: npx biome ci .
If rule triggers incorrectly:
If linting is slow:
Verify: