@onehoax/biome v0.0.2
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
Uninstall any linting/formatting related packages (
eslint,prettier, etc.)Install the following as dev dependencies:
npm install -D @onehoax/biome
Configuration
Remove existing linting/formatting config files
Create a
biome.json 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 reportspnpm run biome:fix-> runs formatter, linter and import sorting to the requested files; writes changespnpm run biome:format-> runs formatter to the requested files; writes changespnpm 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
- Integrate as part commit workflow (
Huskyandpre-commit hooks) - Integrate as part of CI/CD
- Automate dependency upgrade dependencies with Renovate