Skip to content

build: use biome as formatter

Rodrigo Muino Tomonari requested to merge github/fork/anonrig/add-biome into main

Since ESLint is deprecating formatter rules, I propose using Biome as the formatter.

This is pretty much in progress. I'm not sure if Biome supports all existing rules.

Fixes https://github.com/nodejs/node/issues/50449

Todos

  • Add Biome to Github workflow
  • Update Makefile
  • Add Biome as a dependency

Feature parity

eol-last

image

image

linebreak-style (planned but not yet implemented, however git can automatically convert these for you in the .gitattributes file, like this)

no-extra-parens

biome acts like the all eslint option, node currently uses the functions one which is a subset of all

image

no-multi-spaces

image

image

no-multiple-empty-lines (biome only supports the max: 1 eslint option, node uses max: 2)

image

image

no-tabs (set the biome formatter setting indentStyle to "space", doesnt work within comments)

image

image

no-trailing-spaces

image

image

no-whitespace-before-property

image

image

object-curly-newline (click to see explanation)

biome will keep the braces in the same line if the object is empty

if you are destructuring, it will try to keep it in the same line unless that would exceed the defined lineWidth

if the object is not empty, it will keep the linebreak (or lack of linebreak) the user provided in most cases

image

image

object-curly-spacing

image

image

one-var-declaration-per-line

image

image

operator-linebreak (tries to keep on the same line unless it exceeds lineWidth, if not it matches the "after" option which node uses)

image

image

padding-line-between-statements (click to see explanation)

node uses the { blankLine: 'always', prev: 'function', next: 'function' } config for the option, which (i guess) makes eslint always add a blank newline if two functions are declarated in a row. biome doesn't add a blank newline unless you already had added one

image

image

quote-props (node uses the "consistent" eslint option, biome matches the "as-needed" option)

image

image

quotes' avoidEscape feature

image

image

image

rest-spread-spacing

image

image

space-before-blocks

image

image

space-before-function-paren (works almost the same as node's config except biome matches the "always" eslint option for anonymous functions)

image

image

space-in-parens

image

image

space-infix-ops

image

image

space-unary-ops

image

image

image

spaced-comment planned but not yet supported

image

image

Merge request reports

Loading