@book000/eslint-config 1.15.43 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/copilot-instructions.md +33 -73
- package/CLAUDE.md +3 -29
- package/index.mjs +190 -2
- package/package.json +1 -1
- package/test.mjs +12 -0
- package/AGENTS.md +0 -70
- package/GEMINI.md +0 -78
|
@@ -1,82 +1,42 @@
|
|
|
1
|
-
# GitHub Copilot
|
|
1
|
+
# GitHub Copilot レビュー指示
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@book000/eslint-config` は npm に公開される共有 ESLint flat config パッケージです。
|
|
4
|
+
コードレビュー時は以下の観点を優先してください。
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
- 主な機能: ESLint flat config に基づいた TypeScript / JavaScript プロジェクト向けのルール定義
|
|
7
|
-
- 対象ユーザー: book000 の個人プロジェクト開発者
|
|
6
|
+
## リポジトリ構成
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
- `index.mjs`: 公開される ESLint flat config 本体 (エントリポイント)。
|
|
9
|
+
- `test.mjs`: `index.mjs` のルール挙動を検証するカスタムテストスクリプト。
|
|
10
|
+
- 実行環境: pnpm 11.10.0 / ESM (`.mjs`)。
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
- コミットメッセージは [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) に従う。`<description>` は日本語で記載。
|
|
13
|
-
- ブランチ命名は [Conventional Branch](https://conventional-branch.github.io) に従う。`<type>` は短縮形 (feat, fix) を使用。
|
|
14
|
-
- 日本語と英数字の間には半角スペースを入れる。
|
|
15
|
-
|
|
16
|
-
## 技術スタック
|
|
17
|
-
|
|
18
|
-
- 言語: JavaScript (ES Modules), TypeScript (設定対象)
|
|
19
|
-
- ESLint: Flat Config (eslint.config.mjs 形式)
|
|
20
|
-
- パッケージマネージャー: pnpm (10.28.1)
|
|
21
|
-
- 主要パッケージ:
|
|
22
|
-
- typescript-eslint
|
|
23
|
-
- eslint-plugin-unicorn
|
|
24
|
-
- neostandard
|
|
25
|
-
- eslint-config-prettier
|
|
26
|
-
|
|
27
|
-
## コーディング規約
|
|
28
|
-
|
|
29
|
-
- フォーマット: Prettier との統合 (eslint-config-prettier)
|
|
30
|
-
- コメント言語: 日本語
|
|
31
|
-
- エラーメッセージ: 英語
|
|
32
|
-
- TypeScript の `skipLibCheck` での回避は禁止
|
|
33
|
-
- 関数・インターフェースには docstring (JSDoc など) を日本語で記載
|
|
34
|
-
|
|
35
|
-
## 開発コマンド
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
# 依存関係のインストール
|
|
39
|
-
pnpm install
|
|
12
|
+
## 重点的に確認する点
|
|
40
13
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
14
|
+
- **ルール変更には必ずテストを伴うこと**: `index.mjs` のルールを追加・変更する PR で
|
|
15
|
+
`test.mjs` の `testCases` にケースが追加・更新されていない場合は指摘する。
|
|
16
|
+
- **flat config の配列順序**: flat config は「後勝ち」。`eslintPrettier` は必ず配列末尾に
|
|
17
|
+
置くこと。`unicorn/filename-case` のような後段オーバーライドの順序が入れ替わっていないか
|
|
18
|
+
確認する。
|
|
19
|
+
- **公開パッケージとしての破壊的変更**: ルールの追加・厳格化は利用側プロジェクトに影響する。
|
|
20
|
+
破壊的変更に見合うバージョニング (Conventional Commits の `feat!:` / `fix:` など) が
|
|
21
|
+
適切か確認する。
|
|
22
|
+
- **コメント**: `index.mjs` の各ルール調整には「なぜ off / 変更したか」の日本語コメントを
|
|
23
|
+
付ける慣習がある。理由コメントなしのルール変更は指摘する。
|
|
44
24
|
|
|
45
|
-
##
|
|
25
|
+
## フラグすべきでない既知パターン (誤検知防止)
|
|
46
26
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
27
|
+
- **意図的に off / 緩和されているルール**: このパッケージは設計方針として
|
|
28
|
+
`@typescript-eslint/no-explicit-any`・`no-unsafe-assignment`・`no-unsafe-argument`・
|
|
29
|
+
`unicorn/prevent-abbreviations`・`unicorn/no-null`・`unicorn/prefer-top-level-await` などを
|
|
30
|
+
意図的に off にしている。これらを「有効化すべき」と指摘しない。
|
|
31
|
+
- **`index.mjs` 内の `@ts-expect-error`**: `unicorn.configs["flat/recommended"]` の型不整合を
|
|
32
|
+
回避するための意図的な記述。削除を促さない。
|
|
33
|
+
- **`test.mjs` が生成する一時ファイル**: テストは一時的に `src/__tmp__cli` と `tsconfig.json` を
|
|
34
|
+
作成して ESLint を実行する。この一時生成物を問題として扱わない。
|
|
50
35
|
|
|
51
|
-
##
|
|
36
|
+
## コーディング規約 (lint / 慣習で強制)
|
|
52
37
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
変更時に以下のドキュメントを更新すること:
|
|
59
|
-
|
|
60
|
-
- `README.md`: パッケージの使用方法、インストール手順
|
|
61
|
-
- `index.mjs`: ESLint ルール設定の変更時
|
|
62
|
-
- `test.mjs`: テストケースの追加・変更時
|
|
63
|
-
|
|
64
|
-
## リポジトリ固有
|
|
65
|
-
|
|
66
|
-
- このパッケージは npm に公開される共有可能な ESLint 設定です。
|
|
67
|
-
- index.mjs が ESLint flat config のエントリポイントです。
|
|
68
|
-
- TypeScript プロジェクト向けに `files: ["**/*.ts", "**/*.tsx"]` で TypeScript 専用ルールを適用しています。
|
|
69
|
-
- 以下のルールが特別に調整されています:
|
|
70
|
-
- `@typescript-eslint/no-explicit-any`: off (any 型の使用を許可)
|
|
71
|
-
- `@typescript-eslint/no-unsafe-assignment`: off (危険な代入を許可)
|
|
72
|
-
- `@typescript-eslint/no-unsafe-argument`: off (危険な引数を許可)
|
|
73
|
-
- `@typescript-eslint/restrict-template-expressions`: テンプレート式で number, boolean, any, nullish を許可
|
|
74
|
-
- `@typescript-eslint/no-floating-promises`: void 演算子と即時関数での Promise を許可
|
|
75
|
-
- `@typescript-eslint/no-unnecessary-condition`: 定数ループ条件 (無限ループ) を許可
|
|
76
|
-
- `@typescript-eslint/no-extraneous-class`: 名前空間として使用されるクラスを許可
|
|
77
|
-
- `@typescript-eslint/no-use-before-define`: TypeScript 準拠に変更
|
|
78
|
-
- `unicorn/prefer-top-level-await`: off (トップレベル await を許可)
|
|
79
|
-
- `unicorn/prevent-abbreviations`: off (省略形を許可)
|
|
80
|
-
- `unicorn/no-null`: off (null を許可)
|
|
81
|
-
- `unicorn/no-useless-undefined`: off (無駄な undefined を許可)
|
|
82
|
-
- Renovate による依存パッケージの自動更新が有効です。
|
|
38
|
+
- コメント: 日本語。エラーメッセージ: 英語。
|
|
39
|
+
- 日本語と英数字の間には半角スペースを入れる。
|
|
40
|
+
- `skipLibCheck` による TypeScript エラー回避は禁止。
|
|
41
|
+
- コミットメッセージは [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
|
|
42
|
+
(`<description>` は日本語)。
|
package/CLAUDE.md
CHANGED
|
@@ -47,35 +47,6 @@
|
|
|
47
47
|
- TypeScript プロジェクトにおいて、skipLibCheck を有効にして回避することは絶対にしてはならない
|
|
48
48
|
- 関数やインターフェースには、docstring (JSDoc など) を日本語で記載・更新する
|
|
49
49
|
|
|
50
|
-
## 相談ルール
|
|
51
|
-
|
|
52
|
-
Codex CLI や Gemini CLI の他エージェントに相談することができます。以下の観点で使い分けてください:
|
|
53
|
-
|
|
54
|
-
### Codex CLI (ask-codex)
|
|
55
|
-
|
|
56
|
-
- 実装コードに対するソースコードレビュー
|
|
57
|
-
- 関数設計、モジュール内部の実装方針などの局所的な技術判断
|
|
58
|
-
- アーキテクチャ、モジュール間契約、パフォーマンス / セキュリティといった全体影響の判断
|
|
59
|
-
- 実装の正当性確認、機械的ミスの検出、既存コードとの整合性確認
|
|
60
|
-
|
|
61
|
-
### Gemini CLI (ask-gemini)
|
|
62
|
-
|
|
63
|
-
- SaaS 仕様、言語・ランタイムのバージョン差、料金・制限・クォータといった、最新の適切な情報が必要な外部依存の判断
|
|
64
|
-
- 外部一次情報の確認、最新仕様の調査、外部前提条件の検証
|
|
65
|
-
|
|
66
|
-
### 指摘への対応ルール
|
|
67
|
-
|
|
68
|
-
他エージェントが指摘・異議を提示した場合、Claude Code は必ず以下のいずれかを行う。黙殺・無言での不採用は禁止する:
|
|
69
|
-
|
|
70
|
-
- 指摘を受け入れ、判断を修正する
|
|
71
|
-
- 指摘を退け、その理由を明示する
|
|
72
|
-
|
|
73
|
-
以下は必ず実施:
|
|
74
|
-
|
|
75
|
-
- 他エージェントの提案を鵜呑みにせず、その根拠や理由を理解する
|
|
76
|
-
- 自身の分析結果と他エージェントの意見が異なる場合は、双方の視点を比較検討する
|
|
77
|
-
- 最終的な判断は、両者の意見を総合的に評価した上で、自身で下す
|
|
78
|
-
|
|
79
50
|
## 開発コマンド
|
|
80
51
|
|
|
81
52
|
```bash
|
|
@@ -182,8 +153,11 @@ pnpm test
|
|
|
182
153
|
- `@typescript-eslint/no-extraneous-class`: 名前空間として使用されるクラスを許可
|
|
183
154
|
- `@typescript-eslint/no-use-before-define`: TypeScript 準拠に変更
|
|
184
155
|
- `unicorn/prefer-top-level-await`: off (トップレベル await を許可)
|
|
156
|
+
- `unicorn/consistent-class-member-order`: off (private before public を強制せず public-first の慣習を許可)
|
|
185
157
|
- `unicorn/prevent-abbreviations`: off (省略形を許可)
|
|
186
158
|
- `unicorn/no-null`: off (null を許可)
|
|
187
159
|
- `unicorn/no-useless-undefined`: off (無駄な undefined を許可)
|
|
160
|
+
- `unicorn/catch-error-name`: catch のエラー変数名を `error` に統一 (`err` も許可)
|
|
161
|
+
- `unicorn/filename-case`: `checkDirectories: false` でディレクトリ名チェックを無効化し、`__xxx__` 形式は対象外。`.vue` ファイルのみ pascalCase を適用
|
|
188
162
|
- Renovate による依存パッケージの自動更新が有効です。Renovate の PR には追加コミットや更新を行わないこと。
|
|
189
163
|
- テスト (test.mjs) は、一時的に `src/__tmp__cli` ディレクトリと `tsconfig.json` を作成して ESLint を実行します。
|
package/index.mjs
CHANGED
|
@@ -9,8 +9,196 @@ export default tseslint.config(
|
|
|
9
9
|
// Standard JS のルールセット(スタイル系は prettier に委ねるため無効化)
|
|
10
10
|
...neostandard({ noStyle: true }),
|
|
11
11
|
...tseslint.configs.recommended,
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
{
|
|
13
|
+
// eslint-plugin-unicorn のルールを flat/recommended に頼らず明示的に列挙する。
|
|
14
|
+
// 理由: flat/recommended は unicorn のバージョンアップごとに収録ルールが
|
|
15
|
+
// 無断で増減し、本パッケージに依存する多数のプロジェクトへ一斉に
|
|
16
|
+
// 新規エラーが波及するリスクがあるため。新しいルールを取り込む場合は
|
|
17
|
+
// このリストへ明示的に追記すること(unicorn の CHANGELOG を確認して判断する)。
|
|
18
|
+
//
|
|
19
|
+
// 生成方法: eslint-plugin-unicorn の flat/recommended が定義する
|
|
20
|
+
// ルール一覧を元に、以下を除外・調整して作成した。
|
|
21
|
+
// - deprecated ルールは対象外
|
|
22
|
+
// - catch-error-name, filename-case はオプション付きで設定するため、
|
|
23
|
+
// 下記の専用ブロックに記載し、ここでは省略する
|
|
24
|
+
// - 意図的に off とするルール(下記コメント参照)
|
|
25
|
+
plugins: { unicorn },
|
|
26
|
+
rules: {
|
|
27
|
+
// 集約処理のイディオムとして正当な用途が多く、for ループへの
|
|
28
|
+
// 書き換え強制がかえって可読性を落とすため無効化する
|
|
29
|
+
"unicorn/no-array-reduce": "off",
|
|
30
|
+
// クロージャで意図的に外側スコープの変数を捕捉する関数まで
|
|
31
|
+
// 最上位への移動を要求し、誤検知が多いため無効化する
|
|
32
|
+
"unicorn/consistent-function-scoping": "off",
|
|
33
|
+
// トップレベル await を許可する(IIFE 併用の CLI ツール等のため)
|
|
34
|
+
"unicorn/prefer-top-level-await": "off",
|
|
35
|
+
// 省略形を許可する (dev -> development, prod -> production などの変換をさせない)
|
|
36
|
+
"unicorn/prevent-abbreviations": "off",
|
|
37
|
+
// null を許可する
|
|
38
|
+
"unicorn/no-null": "off",
|
|
39
|
+
// 無駄な undefined を許可する
|
|
40
|
+
"unicorn/no-useless-undefined": "off",
|
|
41
|
+
//
|
|
42
|
+
// 以下、上記以外の flat/recommended 収録ルールをすべて明示的に error とする
|
|
43
|
+
"unicorn/better-dom-traversing": "error",
|
|
44
|
+
"unicorn/consistent-assert": "error",
|
|
45
|
+
"unicorn/consistent-compound-words": "error",
|
|
46
|
+
"unicorn/consistent-date-clone": "error",
|
|
47
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
48
|
+
"unicorn/consistent-existence-index-check": "error",
|
|
49
|
+
"unicorn/consistent-json-file-read": "error",
|
|
50
|
+
"unicorn/consistent-template-literal-escape": "error",
|
|
51
|
+
"unicorn/dom-node-dataset": "error",
|
|
52
|
+
"unicorn/empty-brace-spaces": "error",
|
|
53
|
+
"unicorn/error-message": "error",
|
|
54
|
+
"unicorn/escape-case": "error",
|
|
55
|
+
"unicorn/expiring-todo-comments": "error",
|
|
56
|
+
"unicorn/explicit-length-check": "error",
|
|
57
|
+
"unicorn/import-style": "error",
|
|
58
|
+
"unicorn/isolated-functions": "error",
|
|
59
|
+
"unicorn/new-for-builtins": "error",
|
|
60
|
+
"unicorn/no-abusive-eslint-disable": "error",
|
|
61
|
+
"unicorn/no-accessor-recursion": "error",
|
|
62
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
63
|
+
"unicorn/no-array-callback-reference": "error",
|
|
64
|
+
"unicorn/no-array-fill-with-reference-type": "error",
|
|
65
|
+
"unicorn/no-array-for-each": "error",
|
|
66
|
+
"unicorn/no-array-from-fill": "error",
|
|
67
|
+
"unicorn/no-array-method-this-argument": "error",
|
|
68
|
+
"unicorn/no-array-reverse": "error",
|
|
69
|
+
"unicorn/no-array-sort": "error",
|
|
70
|
+
"unicorn/no-await-expression-member": "error",
|
|
71
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
72
|
+
"unicorn/no-blob-to-file": "error",
|
|
73
|
+
"unicorn/no-canvas-to-image": "error",
|
|
74
|
+
"unicorn/no-confusing-array-splice": "error",
|
|
75
|
+
"unicorn/no-console-spaces": "error",
|
|
76
|
+
"unicorn/no-document-cookie": "error",
|
|
77
|
+
"unicorn/no-duplicate-set-values": "error",
|
|
78
|
+
"unicorn/no-empty-file": "error",
|
|
79
|
+
"unicorn/no-exports-in-scripts": "error",
|
|
80
|
+
"unicorn/no-for-loop": "error",
|
|
81
|
+
"unicorn/no-hex-escape": "error",
|
|
82
|
+
"unicorn/no-immediate-mutation": "error",
|
|
83
|
+
"unicorn/no-incorrect-query-selector": "error",
|
|
84
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
85
|
+
"unicorn/no-invalid-fetch-options": "error",
|
|
86
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
87
|
+
"unicorn/no-late-current-target-access": "error",
|
|
88
|
+
"unicorn/no-lonely-if": "error",
|
|
89
|
+
"unicorn/no-magic-array-flat-depth": "error",
|
|
90
|
+
"unicorn/no-named-default": "error",
|
|
91
|
+
"unicorn/no-negated-condition": "error",
|
|
92
|
+
"unicorn/no-negation-in-equality-check": "error",
|
|
93
|
+
"unicorn/no-nested-ternary": "error",
|
|
94
|
+
"unicorn/no-new-array": "error",
|
|
95
|
+
"unicorn/no-new-buffer": "error",
|
|
96
|
+
"unicorn/no-object-as-default-parameter": "error",
|
|
97
|
+
"unicorn/no-process-exit": "error",
|
|
98
|
+
"unicorn/no-single-promise-in-promise-methods": "error",
|
|
99
|
+
"unicorn/no-static-only-class": "error",
|
|
100
|
+
"unicorn/no-thenable": "error",
|
|
101
|
+
"unicorn/no-this-assignment": "error",
|
|
102
|
+
"unicorn/no-this-outside-of-class": "error",
|
|
103
|
+
"unicorn/no-typeof-undefined": "error",
|
|
104
|
+
"unicorn/no-unnecessary-array-flat-depth": "error",
|
|
105
|
+
"unicorn/no-unnecessary-array-splice-count": "error",
|
|
106
|
+
"unicorn/no-unnecessary-await": "error",
|
|
107
|
+
"unicorn/no-unnecessary-nested-ternary": "error",
|
|
108
|
+
"unicorn/no-unnecessary-polyfills": "error",
|
|
109
|
+
"unicorn/no-unnecessary-slice-end": "error",
|
|
110
|
+
"unicorn/no-unreadable-array-destructuring": "error",
|
|
111
|
+
"unicorn/no-unreadable-iife": "error",
|
|
112
|
+
"unicorn/no-unused-array-method-return": "error",
|
|
113
|
+
"unicorn/no-useless-collection-argument": "error",
|
|
114
|
+
"unicorn/no-useless-error-capture-stack-trace": "error",
|
|
115
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
116
|
+
"unicorn/no-useless-iterator-to-array": "error",
|
|
117
|
+
"unicorn/no-useless-length-check": "error",
|
|
118
|
+
"unicorn/no-useless-promise-resolve-reject": "error",
|
|
119
|
+
"unicorn/no-useless-spread": "error",
|
|
120
|
+
"unicorn/no-useless-switch-case": "error",
|
|
121
|
+
"unicorn/no-zero-fractions": "error",
|
|
122
|
+
"unicorn/number-literal-case": "error",
|
|
123
|
+
"unicorn/numeric-separators-style": "error",
|
|
124
|
+
"unicorn/prefer-add-event-listener": "error",
|
|
125
|
+
"unicorn/prefer-array-find": "error",
|
|
126
|
+
"unicorn/prefer-array-flat": "error",
|
|
127
|
+
"unicorn/prefer-array-flat-map": "error",
|
|
128
|
+
"unicorn/prefer-array-index-of": "error",
|
|
129
|
+
"unicorn/prefer-array-last-methods": "error",
|
|
130
|
+
"unicorn/prefer-array-some": "error",
|
|
131
|
+
"unicorn/prefer-at": "error",
|
|
132
|
+
"unicorn/prefer-bigint-literals": "error",
|
|
133
|
+
"unicorn/prefer-blob-reading-methods": "error",
|
|
134
|
+
"unicorn/prefer-class-fields": "error",
|
|
135
|
+
"unicorn/prefer-classlist-toggle": "error",
|
|
136
|
+
"unicorn/prefer-code-point": "error",
|
|
137
|
+
"unicorn/prefer-date-now": "error",
|
|
138
|
+
"unicorn/prefer-default-parameters": "error",
|
|
139
|
+
"unicorn/prefer-dom-node-append": "error",
|
|
140
|
+
"unicorn/prefer-dom-node-remove": "error",
|
|
141
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
142
|
+
"unicorn/prefer-event-target": "error",
|
|
143
|
+
"unicorn/prefer-export-from": "error",
|
|
144
|
+
"unicorn/prefer-get-or-insert-computed": "error",
|
|
145
|
+
"unicorn/prefer-global-this": "error",
|
|
146
|
+
"unicorn/prefer-https": "error",
|
|
147
|
+
"unicorn/prefer-includes": "error",
|
|
148
|
+
"unicorn/prefer-includes-over-repeated-comparisons": "error",
|
|
149
|
+
"unicorn/prefer-iterator-to-array-at-end": "error",
|
|
150
|
+
"unicorn/prefer-keyboard-event-key": "error",
|
|
151
|
+
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
152
|
+
"unicorn/prefer-math-abs": "error",
|
|
153
|
+
"unicorn/prefer-math-min-max": "error",
|
|
154
|
+
"unicorn/prefer-math-trunc": "error",
|
|
155
|
+
"unicorn/prefer-modern-dom-apis": "error",
|
|
156
|
+
"unicorn/prefer-modern-math-apis": "error",
|
|
157
|
+
"unicorn/prefer-module": "error",
|
|
158
|
+
"unicorn/prefer-native-coercion-functions": "error",
|
|
159
|
+
"unicorn/prefer-negative-index": "error",
|
|
160
|
+
"unicorn/prefer-node-protocol": "error",
|
|
161
|
+
"unicorn/prefer-number-properties": "error",
|
|
162
|
+
"unicorn/prefer-object-from-entries": "error",
|
|
163
|
+
"unicorn/prefer-optional-catch-binding": "error",
|
|
164
|
+
"unicorn/prefer-prototype-methods": "error",
|
|
165
|
+
"unicorn/prefer-query-selector": "error",
|
|
166
|
+
"unicorn/prefer-queue-microtask": "error",
|
|
167
|
+
"unicorn/prefer-reflect-apply": "error",
|
|
168
|
+
"unicorn/prefer-regexp-test": "error",
|
|
169
|
+
"unicorn/prefer-response-static-json": "error",
|
|
170
|
+
"unicorn/prefer-set-has": "error",
|
|
171
|
+
"unicorn/prefer-set-size": "error",
|
|
172
|
+
"unicorn/prefer-simple-condition-first": "error",
|
|
173
|
+
"unicorn/prefer-single-call": "error",
|
|
174
|
+
"unicorn/prefer-split-limit": "error",
|
|
175
|
+
"unicorn/prefer-spread": "error",
|
|
176
|
+
"unicorn/prefer-string-match-all": "error",
|
|
177
|
+
"unicorn/prefer-string-pad-start-end": "error",
|
|
178
|
+
"unicorn/prefer-string-raw": "error",
|
|
179
|
+
"unicorn/prefer-string-repeat": "error",
|
|
180
|
+
"unicorn/prefer-string-replace-all": "error",
|
|
181
|
+
"unicorn/prefer-string-slice": "error",
|
|
182
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
183
|
+
"unicorn/prefer-string-trim-start-end": "error",
|
|
184
|
+
"unicorn/prefer-structured-clone": "error",
|
|
185
|
+
"unicorn/prefer-switch": "error",
|
|
186
|
+
"unicorn/prefer-ternary": "error",
|
|
187
|
+
"unicorn/prefer-type-error": "error",
|
|
188
|
+
"unicorn/relative-url-style": "error",
|
|
189
|
+
"unicorn/require-array-join-separator": "error",
|
|
190
|
+
"unicorn/require-css-escape": "error",
|
|
191
|
+
"unicorn/require-module-attributes": "error",
|
|
192
|
+
"unicorn/require-module-specifiers": "error",
|
|
193
|
+
"unicorn/require-number-to-fixed-digits-argument": "error",
|
|
194
|
+
"unicorn/require-passive-events": "error",
|
|
195
|
+
"unicorn/switch-case-braces": "error",
|
|
196
|
+
"unicorn/switch-case-break-position": "error",
|
|
197
|
+
"unicorn/template-indent": "error",
|
|
198
|
+
"unicorn/text-encoding-identifier-case": "error",
|
|
199
|
+
"unicorn/throw-new-error": "error",
|
|
200
|
+
},
|
|
201
|
+
},
|
|
14
202
|
{
|
|
15
203
|
files: ["**/*.ts", "**/*.tsx"],
|
|
16
204
|
languageOptions: {
|
package/package.json
CHANGED
package/test.mjs
CHANGED
|
@@ -23,6 +23,18 @@ async function main() {
|
|
|
23
23
|
shouldError: false,
|
|
24
24
|
rules: ["unicorn/no-null"],
|
|
25
25
|
},
|
|
26
|
+
{
|
|
27
|
+
name: "no-array-reduce: reduceの使用はOK",
|
|
28
|
+
code: "const sum = [1, 2, 3].reduce((accumulator, value) => accumulator + value, 0);",
|
|
29
|
+
shouldError: false,
|
|
30
|
+
rules: ["unicorn/no-array-reduce"],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "consistent-function-scoping: 外側スコープを捕捉するネストした関数はOK",
|
|
34
|
+
code: "function outer() { const base = 1; function inner() { return base; } return inner(); }",
|
|
35
|
+
shouldError: false,
|
|
36
|
+
rules: ["unicorn/consistent-function-scoping"],
|
|
37
|
+
},
|
|
26
38
|
{
|
|
27
39
|
name: "no-use-before-define: 定義前の変数使用はエラー",
|
|
28
40
|
code: "console.log(a); const a = 1;",
|
package/AGENTS.md
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
# AI エージェント作業方針
|
|
2
|
-
|
|
3
|
-
## 目的
|
|
4
|
-
|
|
5
|
-
このドキュメントは、一般的な AI エージェントがこのプロジェクトで作業する際の共通の作業方針を定義します。
|
|
6
|
-
|
|
7
|
-
## 基本方針
|
|
8
|
-
|
|
9
|
-
- 会話言語: 日本語
|
|
10
|
-
- コメント言語: 日本語
|
|
11
|
-
- エラーメッセージ言語: 英語
|
|
12
|
-
- コミット規約: [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) に従う (`<description>` は日本語)
|
|
13
|
-
- 日本語と英数字の間: 半角スペースを挿入
|
|
14
|
-
|
|
15
|
-
## 判断記録のルール
|
|
16
|
-
|
|
17
|
-
判断は必ずレビュー可能な形で記録すること:
|
|
18
|
-
|
|
19
|
-
1. 判断内容の要約
|
|
20
|
-
2. 検討した代替案
|
|
21
|
-
3. 採用しなかった案とその理由
|
|
22
|
-
4. 前提条件・仮定・不確実性
|
|
23
|
-
5. 他エージェントによるレビュー可否
|
|
24
|
-
|
|
25
|
-
前提・仮定・不確実性を明示すること。仮定を事実のように扱ってはならない。
|
|
26
|
-
|
|
27
|
-
## 開発手順(概要)
|
|
28
|
-
|
|
29
|
-
1. **プロジェクト理解**
|
|
30
|
-
- README.md、package.json、主要ファイルを読んで理解する
|
|
31
|
-
- このプロジェクトは個人用 ESLint 設定パッケージです
|
|
32
|
-
|
|
33
|
-
2. **依存関係インストール**
|
|
34
|
-
- パッケージマネージャー: pnpm (10.28.1)
|
|
35
|
-
- コマンド: `pnpm install`
|
|
36
|
-
|
|
37
|
-
3. **変更実装**
|
|
38
|
-
- TypeScript / JavaScript のコーディング規約に従う
|
|
39
|
-
- 関数・インターフェースには日本語で docstring を記載
|
|
40
|
-
- skipLibCheck での TypeScript エラー回避は禁止
|
|
41
|
-
|
|
42
|
-
4. **テストと Lint/Format 実行**
|
|
43
|
-
- テストコマンド: `pnpm test`
|
|
44
|
-
- ESLint ルールの動作を検証する
|
|
45
|
-
|
|
46
|
-
## セキュリティ / 機密情報
|
|
47
|
-
|
|
48
|
-
- API キーや認証情報を Git にコミットしない。
|
|
49
|
-
- ログに個人情報や認証情報を出力しない。
|
|
50
|
-
|
|
51
|
-
## リポジトリ固有
|
|
52
|
-
|
|
53
|
-
- このパッケージは npm に公開される共有可能な ESLint 設定です。
|
|
54
|
-
- `index.mjs` が ESLint flat config のエントリポイントです。
|
|
55
|
-
- TypeScript プロジェクト向けに `files: ["**/*.ts", "**/*.tsx"]` で TypeScript 専用ルールを適用しています。
|
|
56
|
-
- 以下のルールが特別に調整されています:
|
|
57
|
-
- `@typescript-eslint/no-explicit-any`: off (any 型の使用を許可)
|
|
58
|
-
- `@typescript-eslint/no-unsafe-assignment`: off (危険な代入を許可)
|
|
59
|
-
- `@typescript-eslint/no-unsafe-argument`: off (危険な引数を許可)
|
|
60
|
-
- `@typescript-eslint/restrict-template-expressions`: テンプレート式で number, boolean, any, nullish を許可
|
|
61
|
-
- `@typescript-eslint/no-floating-promises`: void 演算子と即時関数での Promise を許可
|
|
62
|
-
- `@typescript-eslint/no-unnecessary-condition`: 定数ループ条件 (無限ループ) を許可
|
|
63
|
-
- `@typescript-eslint/no-extraneous-class`: 名前空間として使用されるクラスを許可
|
|
64
|
-
- `@typescript-eslint/no-use-before-define`: TypeScript 準拠に変更
|
|
65
|
-
- `unicorn/prefer-top-level-await`: off (トップレベル await を許可)
|
|
66
|
-
- `unicorn/prevent-abbreviations`: off (省略形を許可)
|
|
67
|
-
- `unicorn/no-null`: off (null を許可)
|
|
68
|
-
- `unicorn/no-useless-undefined`: off (無駄な undefined を許可)
|
|
69
|
-
- Renovate による依存パッケージの自動更新が有効です。
|
|
70
|
-
- テスト (test.mjs) は、一時的に `src/__tmp__cli` ディレクトリと `tsconfig.json` を作成して ESLint を実行します。
|
package/GEMINI.md
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
# Gemini CLI 作業方針
|
|
2
|
-
|
|
3
|
-
## 目的
|
|
4
|
-
|
|
5
|
-
このドキュメントは、Gemini CLI がこのプロジェクトで作業する際のコンテキストと作業方針を定義します。
|
|
6
|
-
|
|
7
|
-
## 出力スタイル
|
|
8
|
-
|
|
9
|
-
- 言語: 日本語
|
|
10
|
-
- トーン: プロフェッショナルで簡潔
|
|
11
|
-
- 形式: 構造化された説明とコード例
|
|
12
|
-
|
|
13
|
-
## 共通ルール
|
|
14
|
-
|
|
15
|
-
- 会話言語: 日本語
|
|
16
|
-
- コミット規約: [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) に従う (`<description>` は日本語)
|
|
17
|
-
- 日本語と英数字の間: 半角スペースを挿入
|
|
18
|
-
|
|
19
|
-
## プロジェクト概要
|
|
20
|
-
|
|
21
|
-
- 目的: 個人用 ESLint 設定を提供するパッケージ
|
|
22
|
-
- 主な機能: ESLint flat config に基づいた TypeScript / JavaScript プロジェクト向けのルール定義
|
|
23
|
-
- 技術スタック: JavaScript (ES Modules), TypeScript (設定対象), ESLint flat config
|
|
24
|
-
|
|
25
|
-
## コーディング規約
|
|
26
|
-
|
|
27
|
-
- フォーマット: Prettier との統合 (eslint-config-prettier)
|
|
28
|
-
- 命名規則: camelCase (変数・関数), PascalCase (クラス・型)
|
|
29
|
-
- コメント言語: 日本語
|
|
30
|
-
- エラーメッセージ言語: 英語
|
|
31
|
-
- TypeScript の `skipLibCheck` での回避は禁止
|
|
32
|
-
- 関数・インターフェースには docstring (JSDoc など) を日本語で記載
|
|
33
|
-
|
|
34
|
-
## 開発コマンド
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# 依存関係のインストール
|
|
38
|
-
pnpm install
|
|
39
|
-
|
|
40
|
-
# テスト実行
|
|
41
|
-
pnpm test
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## 注意事項
|
|
45
|
-
|
|
46
|
-
### セキュリティ / 機密情報
|
|
47
|
-
|
|
48
|
-
- API キーや認証情報を Git にコミットしない。
|
|
49
|
-
- ログに個人情報や認証情報を出力しない。
|
|
50
|
-
|
|
51
|
-
### 既存ルールの優先
|
|
52
|
-
|
|
53
|
-
- 既存のコーディングスタイルに従う。
|
|
54
|
-
- 不必要なリファクタリングは避ける。
|
|
55
|
-
|
|
56
|
-
### 既知の制約
|
|
57
|
-
|
|
58
|
-
- このパッケージは npm に公開される共有可能な ESLint 設定です。
|
|
59
|
-
- Renovate による依存パッケージの自動更新が有効です。
|
|
60
|
-
|
|
61
|
-
## リポジトリ固有
|
|
62
|
-
|
|
63
|
-
- `index.mjs` が ESLint flat config のエントリポイントです。
|
|
64
|
-
- TypeScript プロジェクト向けに `files: ["**/*.ts", "**/*.tsx"]` で TypeScript 専用ルールを適用しています。
|
|
65
|
-
- 以下のルールが特別に調整されています:
|
|
66
|
-
- `@typescript-eslint/no-explicit-any`: off (any 型の使用を許可)
|
|
67
|
-
- `@typescript-eslint/no-unsafe-assignment`: off (危険な代入を許可)
|
|
68
|
-
- `@typescript-eslint/no-unsafe-argument`: off (危険な引数を許可)
|
|
69
|
-
- `@typescript-eslint/restrict-template-expressions`: テンプレート式で number, boolean, any, nullish を許可
|
|
70
|
-
- `@typescript-eslint/no-floating-promises`: void 演算子と即時関数での Promise を許可
|
|
71
|
-
- `@typescript-eslint/no-unnecessary-condition`: 定数ループ条件 (無限ループ) を許可
|
|
72
|
-
- `@typescript-eslint/no-extraneous-class`: 名前空間として使用されるクラスを許可
|
|
73
|
-
- `@typescript-eslint/no-use-before-define`: TypeScript 準拠に変更
|
|
74
|
-
- `unicorn/prefer-top-level-await`: off (トップレベル await を許可)
|
|
75
|
-
- `unicorn/prevent-abbreviations`: off (省略形を許可)
|
|
76
|
-
- `unicorn/no-null`: off (null を許可)
|
|
77
|
-
- `unicorn/no-useless-undefined`: off (無駄な undefined を許可)
|
|
78
|
-
- テスト (test.mjs) は、一時的に `src/__tmp__cli` ディレクトリと `tsconfig.json` を作成して ESLint を実行します。
|