Vitus Labs
Tools Lint

Tools Lint

Shared Biome configuration for consistent formatting and linting across the vitus-labs ecosystem.

@vitus-labs/tools-lint provides a shareable Biome configuration preset for JavaScript, TypeScript, JSON, and CSS. It enforces consistent formatting and strict linting rules while allowing per-project overrides.

Installation

npm install @vitus-labs/tools-lint

Usage

Extend the shared config in your project's biome.json:

{
  "$schema": "https://biomejs.dev/schemas/2.4.7/schema.json",
  "extends": ["@vitus-labs/tools-lint/biome"]
}

Run linting:

# Check all files
biome check .

# Auto-fix issues
biome check . --fix

# Format only
biome format .

Formatting Rules

JavaScript / TypeScript

SettingValueExample
Quote styleSingle'hello'
JSX quotesDouble<Button type="submit" />
SemicolonsAs neededconst x = 1 (no trailing ;)
Trailing commasAll{ a, b, c, }
Bracket spacingYes{ a } not {a}
Arrow parensAlways(x) => x not x => x
Indent2 spaces
Line width80 chars
Line endingsLFUnix-style

JSON

SettingValue
Trailing commasNone (spec-compliant)
Indent2 spaces

CSS

SettingValue
QuotesSingle
Indent2 spaces
LintingEnabled

Linting Rules

Rules are organized by category. The preset enables Biome's recommended baseline plus custom overrides.

Correctness

RuleSeverityDescription
noUnusedVariableserrorRemove unused variables
noUnusedImportserrorRemove unused imports
noUndeclaredVariableserrorCatch undefined variable references
useHookAtTopLevelerrorEnforce React Rules of Hooks

Style

RuleSeverityDescription
noParameterAssignerrorPrevent function parameter reassignment
useConsistentArrayTypeerrorEnforce Type[] shorthand over Array<Type>
noNonNullAssertionwarnFlag value! non-null assertions
useDefaultParameterLastoffAllows any parameter ordering
noUnusedTemplateLiteraloffAllows template syntax for strings
useFilenamingConventionoffFlexible file naming
useNamingConventionoffNo variable naming conventions enforced

Complexity

RuleSeverityDescription
noExcessiveCognitiveComplexitywarnFlag overly complex logic
useFlatMaperrorUse .flatMap() over .map().flat()
noForEachoff.forEach() is allowed

Suspicious

RuleSeverityDescription
noExplicitAnyoffany type is allowed
noArrayIndexKeywarnFlag array index as React key
noConsolewarnFlag console usage
noEmptyBlockStatementswarnFlag empty {} blocks

Security

RuleSeverityDescription
noDangerouslySetInnerHtmlerrorPrevent XSS via dangerouslySetInnerHTML

Accessibility

RuleSeverityDescription
useAltTexterrorRequire alt on <img>
useAnchorContenterrorRequire text in <a> elements
useButtonTypewarnRequire type on <button>

Performance

RuleSeverityDescription
noAccumulatingSpreadoffAllows {...a, ...b} patterns

Nursery (Experimental)

RuleSeverityDescription
noShadowwarnFlag variable shadowing

Global Variables

The preset declares build-time injected globals to prevent linter errors:

VariablePurpose
__BROWSER__Runtime platform flag
__NATIVE__Runtime platform flag
__NODE__Runtime platform flag
__WEB__Runtime platform flag
__CLIENT__Client-side execution flag
__VERSION__Build version injection
__VITUS_LABS_STORIES__Storybook environment flag

Import Organization

The preset enables automatic import organization:

"assist": {
  "actions": {
    "source": {
      "organizeImports": "on"
    }
  }
}

Triggered via biome check --fix — sorts imports alphabetically and removes duplicates.

Overriding Rules

Each project can extend and override specific rules without affecting others. Biome deep-merges rule objects:

{
  "extends": ["@vitus-labs/tools-lint/biome"],
  "javascript": {
    "globals": ["vi", "describe", "it", "expect"]
  },
  "linter": {
    "rules": {
      "suspicious": {
        "noConsole": "off"
      },
      "nursery": {
        "noShadow": "off"
      }
    }
  }
}

Common overrides:

ContextOverrideWhy
CLI toolsnoConsole: "off"Console output is intentional
Test filesAdd vi, describe, it, expect to globalsVitest global APIs
Legacy codenoShadow: "off"Many valid shadowing cases
Content sitesnoDangerouslySetInnerHtml: "warn"CMS/markdown rendering

On this page