フロントエンド開発の先端を突っ走るNext.js
next.js アプリの初期化( npx create-next-app@latest <アプリ名> ) または pnpm create next-app@latest <アプリ名> または bun create next-app <アプリ名> )

Next.js に biome をインストールする

● biome のインストール

npm install --save-dev --save-exact @biomejs/biome

● biome.json の自動生成

npx @biomejs/biome init

package.json に追加する

"lint:biome": "biome lint -- apply ./src",
"format": "biome format ./src --write",
"check": "biome check --apply ./src"

● biomeの設定

デフォルトから設定を追加した方がいいところを記述していきます。

・定義されていない変数を使っているときにエラーを出す

"rules": {
  "recommended": true,
  "correctness": {
    "noUndeclaredVariables": "error"
  }
}

・シングルクォーテーションを使う

{
  "javascript": {
    "formatter": {
      "quoteStyle": "single",
      "jsxQuoteStyle": "single"
    }
  }
}
No.2633
11/13 17:06

edit