npm i -D oxlint
# ソースコードチェックのみ
npx oxlint .
# 自動修正
oxlint --fix .
対象となるファイルが0件の時でもエラーとしない
oxlint --fix --no-error-on-unmatched-pattern .
--no-error-on-unmatched-pattern は、対象となるファイルが選択されなかった(マッチしなかった)場合に oxlint がエラー終了(終了コード > 0)するのを防ぐCLIオプションです
package.json にコマンドを記述しておきます。
"scripts": {
"lint": "oxlint . --disable-unicorn-plugin",
"lint:fix": "oxlint --disable-unicorn-plugin --fix .",
},
npx oxlint --rules
// oxlint
"oxc.enable": true,
"oxc.typeAware": true,
npm i -D oxfmt
// 設定ファイルの作成
code .oxfmtrc.jsonc
.oxfmtrc.jsonc
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"printWidth": 80
}
npx oxfmt --check