Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Biome #58

Merged
merged 7 commits into from
Feb 19, 2024
Merged

Switch to Biome #58

merged 7 commits into from
Feb 19, 2024

Conversation

yndajas
Copy link
Member

@yndajas yndajas commented Feb 14, 2024

Today we discussed giving this shiny new linter/formatter a try instead of ESLint or Standard. By default, it doesn't care about all the things we had ESLint rules for, but we were having some issues with ESLint (and Standard) and I'm outvoted on being overly pedantic! This seems to be very quick, and the entire test suite runs very quick right now

Closes #57

@yndajas yndajas changed the title Switch to biome Switch to Biome Feb 14, 2024
This allows us to visualise the diff more easily in GitHub pull
requests, for instance (the `bun.lockb` file is a binary)
@yndajas yndajas force-pushed the switch-to-biome branch 2 times, most recently from 68e6725 to ac47135 Compare February 14, 2024 19:39
We'll add Biome to replace these in the next commit
Biome is a linter and formatter built in Rust (fast). We're going to try
this as an alternative to ESLint or Standard. It has an opinionated
default config, but we can extend it if we like. I've configured it so
that [all rules are turned
on](https://biomejs.dev/reference/configuration/#linterrulesall), except
the more experimental [nursery
rules](https://biomejs.dev/reference/configuration/#linterrulesgroup)

Using an exact version of the package is recommended: https://biomejs.dev/internals/versioning

The state names are converted to regular camelcase here. There appears
to be no particular default/convention for this, so following Biome's
default seems the most sensible:
https://stately.ai/blog/2024-01-23-state-machines-whats-in-a-name#what-style-should-that-name-be-in
By default, Bun will respect shebang lines in CLIs that indicate that
they should be executed with Node. We could force the use of Bun in CLIs
(like `eslint` and `stylelint`) using `--bun`, but this will sometimes
lead to unexpected behaviour. Playwright doesn't seem to work very well,
for instance

Meanwhile, using `nodenv` (which is fairly standard at dxw) without
specifying a `.node-version` can lead to errors like the following when
running CLIs that try to use it:

```
nodenv: node: command not found

The `node' command exists in these Node versions:
  16.17.0
  20.9.0
  20.10.0
  20.11.0
```

This adds a `.node-version` to fix this issue

See:
- https://bun.sh/docs/cli/run#bun
- https://bun.sh/docs/cli/bunx#shebangs
In `github.com/dxw` repos, we use [doc/architecture/decisions][] in 46
files, [doc/adr][] in 14 files, and [docs/decisions][] in 2 (both in
this repo)

We've used the `doc/architecture/decisions` on RODA and Approved
Premises externally (and probably other repos). `doc/adr` is the default
for [adr-tools][] and what we used on Accredited Programmes, but the
example override on `adr-tools` uses `doc/architecture/decisions`

This moves us to our most common pattern, adds the default ADR
generated by `adr-tools` backdated to the same date as our
previously-first ADR, and fixes the ADR numbering

[adr-tools]: https://github.com/npryce/adr-tools?tab=readme-ov-file
[doc/adr]: https://github.com/search?q=org:dxw+path:doc/adr&type=code
[doc/architecture/decisions]: https://github.com/search?q=org:dxw+path:doc/architecture&type=code
[docs/decisions]: https://github.com/search?q=org:dxw+path:docs/decisions&type=code
@yndajas yndajas force-pushed the switch-to-biome branch 2 times, most recently from 905adb7 to a3103c3 Compare February 14, 2024 21:04
These are VSCode extensions that support various pieces of tech we use
on this project: Biome, Bun, Playwright, and XState
Copy link
Contributor

@richpjames richpjames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this Ynda.
I think we should wait for @lookupdaily before merging but I am keen to stop talking about linting soon 😅

Copy link
Contributor

@lookupdaily lookupdaily left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets do it

@yndajas yndajas merged commit 1a7a0d8 into main Feb 19, 2024
3 checks passed
@yndajas yndajas deleted the switch-to-biome branch February 19, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants