feat(oxlint-config-smarthr): Oxlint のための共通設定パッケージを追加#1239
Conversation
eslint-config-smarthr の oxlint 版として、プロダクト横断で共有する oxlint 設定パッケージを追加する。初期段階のため private: true。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
private: true を解除し、release-please の設定に追加することで マージ時に v0.0.1 として npm にリリースされるようにする。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
release-please が自動管理するため手動追加を取り消す。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… off 明示的な rules が categories より優先されるため、 correctness カテゴリを off にする必要はない。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tsgo が必要なため、typeAware は各プロダクト側で設定する責務とする。 README に type-aware linting の設定方法を追記。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jsPlugins 経由で動作するため、コメントアウトを解除して eslint-config-smarthr のデフォルト値 (warn) で有効化する。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| commonjs: true, | ||
| es2016: true, | ||
| }, | ||
| rules: { |
There was a problem hiding this comment.
eslint-config-smarthr 側と限りなく同じです。ビルトイン化されたプラグインの詳細設定まで完璧に同じとは言い切れないですが‥…。
https://github.com/kufu/tamatebako/blob/748b46c97c3ea2b15e59c1b90e53fa3769960ca3/packages/oxlint-config-smarthr/index.js
PR 上で oxlint-config-smarthr のプレビューリリースを 公開し、ローカル環境でのデバッグを可能にする。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- typescript/dot-notation を type-aware 必須のためデフォルトから除外 - unicorn プラグインを削除(使用ルールなし) - previewRelease ワークフローに paths フィルタを追加 - README の plugins 再宣言について補足コメントを追加 - repository.url を SSH 形式に統一 - LICENSE の Copyright 年を 2026 に修正 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
commit: |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- no-shadow の不要な配列記法を修正 - TypeScript override での severity 変更理由をコメントで補足 - no-unused-vars が correctness カテゴリで有効である旨をコメント追加 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
config をインポートしてオブジェクトとして評価できることを確認する。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
vitest の smoke test を oxlint --print-config に置き換え。 設定ファイルの構文エラーやルール名の typo を検出できる。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: '.node-version' | ||
| - run: pnpx pkg-pr-new publish packages/oxlint-config-smarthr |
There was a problem hiding this comment.
📝 smarthr-ui パッケージで昨年から導入しているプレリリースの仕組みを、tamatebako でも使いたく導入しています。とりあえず影響範囲を最小にするために本パッケージでのみにしてますが、トリガーのオプションを調整することで任意のパッケージで使用できるはずです。
typescript プラグインが JS ルールの無効化を自動で処理するため、 手動の overrides は不要。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
eslint-config-smarthr と揃えて { fix: true } オプションを追加。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| */ | ||
| const config = { | ||
| plugins: ['typescript', 'import', 'react', 'jsx-a11y'], | ||
| jsPlugins: ['eslint-plugin-smarthr'], |
There was a problem hiding this comment.
📝 名前の通り、plugins は Rust で書かれたビルトインのプラグインで、jsPlugins は ESLint プラグインです。
eslint-config-smarthr が扱っているカスタムルールのうち、eslint-plugin-smarthr だけは組み込まれていない(それはそう) ので、JSのまま読み込む形になります。
| この共有設定には `options.typeAware` は含まれていません。 | ||
| TypeScript の型情報を利用するルール(`typescript/dot-notation` など)を有効にするには、追加パッケージをインストールし、設定ファイルを調整してください。 |
There was a problem hiding this comment.
📝 ここの扱いはちょっと迷ったけど、tsgo に依存する必要があり、まだ必須とするには速い気がしてるのでこの形にしてます。 TypeScript 7 が出たらもうこのパッケージに入れちゃって良いかも。
ESLint / oxlint 併用期間中にルール変更の同期漏れを防ぐため、 両設定ファイルに相互参照のコメントを追加。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| "directory": "packages/oxlint-config-smarthr" | ||
| }, | ||
| "scripts": { | ||
| "test": "oxlint --config index.js --print-config > /dev/null" |
There was a problem hiding this comment.
📝 単体テスト的なものですが、eslint-config-smarthr 側でやっているスナップショットの取得は、Oxlint がバイナリで動いてる都合再現できなかったので、設定ファイルの出力ができるかどうかだけを見ています。
少なくとも構文ミスや、存在しないプラグインの参照といったミスがある場合は失敗するようになってます。
|
@s-sasaki-0529 eslint-config版も並行運用していることもありますし、実際のプロダクトで導入してみてもらって確認、という流れが早そうな気がしています。 |
|
@AtsushiM 弊プロダクトで、pkg-pr-new を使った動作確認までは済んでいるので、一旦 v0.1.0 リリース後にそのまま本導入して、開発プロセス上の不都合が生じなそうなことが見えてきたら全体共有していこうとおもいます! |
なに
oxlint-config-smarthrパッケージを新たに追加します。なぜ
Oxlint では、ESLint プラグインをそのまま使用することができるます。
各プロダクトが ESLint から Oxlint にスムーズに移行するために、eslint-config-smarthr と互換性のある、Oxlint 向け設定ファイルを、oxlint-config-smarthr として提供します。
どうやった
設定ファイルの内容は、現状の eslint-config-smarthr の設定を概ね引き継ぎつつ、Oxlint 本体に組み込まれたカスタムルール (eslint-config-react など) は、設定から除外しています
確認方法
動作自体は、担当プロダクトの方の oxlint 移行で、本パッケージを取り込んで意図通りに扱えることを確認しています。
設定ファイルをfmfmして大きな認識ズレがなければ、v0.1.0 としてリリースさせてください。