0.0.2 • Published 1 year ago

@onehoax/biome v0.0.2

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

Description

This package serves as the base biome rules for javascript projects.
It can easily be extended/overridden.
Its dependencies are fixed for stability and should be upgraded with a tool like Renovate.

Installation

  1. Uninstall any linting/formatting related packages (eslint, prettier, etc.)

  2. Install the following as dev dependencies:

    npm install -D @onehoax/biome

Configuration

  1. Remove existing linting/formatting config files

  2. Create a biome.js on the project's root directory and place the following contents inside:

    {
      "extends": ["@onehoax/biome/base"]
    }

Overriding configs

@onehoax/biome/base exports a JSON object with biome options; you can extend/override these options by adding more options to your biome.js file:

{
  "extends": ["@onehoax/biome/base"],
  "files": {
    "include": ["..."],
    "ignore": ["..."]
  },
  "linter": {
    "rules": {
      ...
    }
  },
  ...
}

Run

Add the following script to your package.json:

{
  ...,
  "scripts": {
    ...,
    "biome:check": "pnpm biome check ./",
    "biome:format": "pnpm biome format --write ./",
    "biome:lint": "pnpm biome lint --write ./",
    "biome:fix": "pnpm biome check --write ./"
  },
  ...
}

All the commands run against the files specied in the config (this package specifies ["./src/**/*.js", "./test/**/*.js"]).

  • pnpm run biome:check -> runs formatter, linter and import sorting to the requested files; only reports
  • pnpm run biome:fix -> runs formatter, linter and import sorting to the requested files; writes changes
  • pnpm run biome:format -> runs formatter to the requested files; writes changes
  • pnpm run biome:lint -> runs linter to the requested files; writes changes

Future Goals

The goal is to integrate the formatting into commit workflow and the CI/CD pipelines.

References

TODO

0.0.2

1 year ago

0.0.1

1 year ago