Getting started

はじめに

プラグインを導入し、プリセットを選んで Oxlint を実行します。

インストール

Node.js 24 以降を使ってください。 TypeScript プロジェクトの開発用依存としてプラグインと Oxlint を導入します。

npm install --save-dev @totto2727/oxlint oxlint

設定

ESM の .oxlintrc.mjs にプリセットを設定します。

import { defineConfig } from 'oxlint'
import typescript from '@totto2727/oxlint/typescript'

export default defineConfig({ extends: [typescript] })

Effect には @totto2727/oxlint/effect、両グループには @totto2727/oxlint/preset を使います。 プリセットは native Ultracite baseline を含み、Oxlint で直接実行します。 Ultracite CLI や別の Ultracite プリセットは不要です。 React、type-aware ルール、Ultracite JavaScript plugins、oxfmt 統合は別途設定してください。

ルールを個別に選ぶ場合は .oxlintrc.json を使います。 この設定は native baseline を含みません。

{
  "jsPlugins": ["@totto2727/oxlint"],
  "rules": {
    "rules/require-import-extension": "error",
    "rules/consistent-import-extension": ["error", { "mode": "ts" }]
  }
}

default export のプラグインは rules/ 名前空間を使います。 名前付き export の typescriptRuleNames、effectRuleNames、compatibilityRuleNames は各グループのルール一覧です。 JavaScript 出力の import には mode js、TypeScript ソース実行には mode ts を使います。 欠けた拡張子は推測しません。 force-ts-extension を require-import-extension と consistent-import-extension に併用しないでください。

実行と確認

プリセットの設定を実行します。

npx oxlint --config .oxlintrc.mjs src
npx oxlint --config .oxlintrc.mjs --fix src

必要なら src をソースディレクトリに置き換えてください。 個別ルールの設定には --config .oxlintrc.json を使ってください。 コミット前に診断と修正を確認してください。 自動修正のあるルールだけがコードを変更します。 プリセットはテストとアプリケーションに同じルールを適用し、テスト専用の免除はありません。 必要な境界例外には、-- と具体的な理由を付けた oxlint-disable-next-line を使います。 TypeScript プリセット、Effect プリセット、Oxlint 設定リファレンスを参照してください。