Biome を使ってみる
   /   
 Astro と Svelte 製のサイトで、コードリンター&フォーマッターを Eslint・Prettier から Biome に変更しました。
サイトについて
- built with
- Astro
- Svelte • Cybernetically enhanced web apps
- ESLint - Pluggable JavaScript Linter
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- eslint-import-resolver-typescript
- eslint-plugin-import
- eslint-plugin-jsx-a11y
- eslint-plugin-astro
- eslint-plugin-svelte
- eslint-config-prettier
- svelte-eslint-parser
 
- Prettier · Opinionated Code Formatter
- prettier-plugin-astro
- prettier-plugin-svelte
 
 
.eslintrc.yml
extends:  - eslint:recommended  - plugin:astro/recommended  - plugin:svelte/recommended  # - plugin:jsx-a11y/recommended  # - plugin:import/recommended  # - plugin:import/typescript  - prettierparser: '@typescript-eslint/parser'parserOptions:  ecmaVersion: latest  sourceType: moduleoverrides:  - files:      - '*.astro'    parser: astro-eslint-parser    parserOptions:      parser: '@typescript-eslint/parser'      extraFileExtensions:        - .astro    rules: {}  - files:    - '*.svelte'    parser:  svelte-eslint-parser    parserOptions:      parser: '@typescript-eslint/parser'      extraFileExtensions:        - .svelte    rules: {}plugins:  - '@typescript-eslint'ignorePatterns:  - './dist/**/*'  - './node_modules/**/*'settings: {}rules: {  no-undef: off,  no-unused-vars: warn}.pretterrc.yml
trailingComma: es5tabWidth: 2semi: falsesingleQuote: trueplugins:  - prettier-plugin-astro  - prettier-plugin-svelteBiomeとは
Web開発のためのたった1つのツールチェーン format、lintなどが一瞬で完了します!
サイトトップで『高速』を謳っているが、確かに怖いくらいに速い。
設定
npm install --save-dev --save-exact @biomejs/biomenpx @biomejs/biome initfor GitHub
biome init で作成した biome.json に下を追加
{ "vcs": {  "enabled": true,  "clientKind": "git",  "useIgnoreFile": true }}for Astro
biome init で作成した biome.json に下を追加
{  "javascript": {    "globals": [      "Astro"    ]  }}for Svelte
biome init で作成した biome.json に下を追加した。Svelte では $:double = count * 2や$: {} といった様にドル記号を使った Reactive Declarations がある。これがルールに抵触するので、noUnusedLabels と noConfusingLabels を OFF にして、.svelte ではルールを上書きしている。
{ "overrides": [  {   "include": [    "*.svelte"   ],   "linter": {    "rules": {     "correctness": {      "noUnusedLabels": "off"     },     "suspicious": {      "noConfusingLabels": "off"     },     "style": {      "useConst": "off"     }    }   }  } ]}よかったところ、そうでもなかったところ
- よかったところ
- configファイル内の記述が単純になったところ
- 大量のプラグインが不要になったことろ
- 処理が非常に高速で一瞬で終わるところ
 
- そうでもなかったところ
- 特にない
- 強いて言えば、まだ日が浅いので便利なプラグインが少ないところ。必要であれば作るのみ
 
 
- 特にない
さいごに
Biome の登場からまだ日が浅く、Eslint とそのプラグインによる非常に便利な機能はまだ足りない。しかし、設定ファイルを簡素にでき、処理も高速など、できるだけ簡単・簡潔にコードを整えたい需要には丁度良いと感じました。
