Skip to content

Commit 92dbfa5

Browse files
docs: Add ESLint and code style guidelines to DEVELOPMENT.md (#1307)
1 parent 30d609d commit 92dbfa5

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ To send us a pull request, please:
3535
5. Send us a pull request, answering any default questions in the pull request interface.
3636
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
3737

38+
For detailed development guidelines including linting and code style requirements, please refer to:
39+
- [DEVELOPMENT.md (English)](docs/en/DEVELOPMENT.md)
40+
- [DEVELOPMENT.md (日本語)](docs/ja/DEVELOPMENT.md)
41+
3842
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
3943
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4044

docs/en/DEVELOPMENT.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,45 @@ npm run web:dev
5252

5353
If executed successfully, it will start at http://localhost:5173, so please try accessing it from your browser.
5454

55+
## Linting and Code Style
56+
57+
This project uses **ESLint** and **Prettier** to enforce code quality and consistent style.
58+
59+
### ESLint Configuration
60+
61+
- **Config files**: ESLint configurations are located in each package directory:
62+
- `packages/web/.eslintrc.cjs` (Frontend)
63+
- `packages/cdk/.eslintrc.cjs` (CDK/Infrastructure)
64+
- `browser-extension/.eslintrc.json` (Browser Extension)
65+
- **Base rules**: We extend commonly used configs:
66+
- `eslint:recommended`
67+
- `plugin:@typescript-eslint/recommended`
68+
- `plugin:react-hooks/recommended` (for React code)
69+
- `plugin:tailwindcss/recommended` (for frontend)
70+
- **Key rules enforced**:
71+
- Unused imports/variables
72+
- React Hooks rules (e.g., `exhaustive-deps`)
73+
- Japanese string detection (i18n compliance)
74+
- YAML formatting and key sorting
75+
76+
### Running ESLint
77+
78+
Before committing, run:
79+
80+
```bash
81+
npm run lint
82+
```
83+
84+
To automatically fix issues:
85+
86+
```bash
87+
npm run web:lint:fix # For frontend code
88+
```
89+
90+
### Pre-commit Hook
91+
92+
This repository uses [Husky](https://typicode.github.io/husky) for git hooks. Linting runs automatically on `git commit` via `lint-staged`.
93+
5594
## When Submitting a Pull Request
5695

5796
We welcome Pull Requests for bug fixes and feature improvements :tada:
@@ -72,6 +111,12 @@ If you want to ignore this error and create a Draft PR, add the `--no-verify` op
72111
git commit -m "xxx" --no-verify
73112
```
74113

114+
### Review Standards
115+
116+
- Lint rules are used as **review criteria**.
117+
- Please ensure your code passes linting before opening a PR to avoid unnecessary review cycles.
118+
- Consistent style improves readability and reduces back-and-forth in code review.
119+
75120
Also, if there are changes to the CDK, check the snapshots with the following command and update them:
76121

77122
```bash

docs/ja/DEVELOPMENT.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,45 @@ npm run web:dev
5353

5454
正常に実行されれば http://localhost:5173 で起動しますので、ブラウザからアクセスしてみてください。
5555

56+
## Lint とコードスタイル
57+
58+
このプロジェクトでは、コード品質と一貫したスタイルを保つために **ESLint****Prettier** を使用しています。
59+
60+
### ESLint の設定
61+
62+
- **設定ファイルの場所**: ESLint の設定は各パッケージディレクトリに配置されています:
63+
- `packages/web/.eslintrc.cjs` (フロントエンド)
64+
- `packages/cdk/.eslintrc.cjs` (CDK/インフラ)
65+
- `browser-extension/.eslintrc.json` (ブラウザ拡張)
66+
- **ベースルール**: 以下の一般的な設定を拡張しています:
67+
- `eslint:recommended`
68+
- `plugin:@typescript-eslint/recommended`
69+
- `plugin:react-hooks/recommended` (React コード用)
70+
- `plugin:tailwindcss/recommended` (フロントエンド用)
71+
- **主要なルール**:
72+
- 未使用のインポート/変数の検出
73+
- React Hooks のルール (例: `exhaustive-deps`)
74+
- 日本語文字列の検出 (i18n 対応)
75+
- YAML のフォーマットとキーのソート
76+
77+
### ESLint の実行
78+
79+
コミット前に以下を実行してください:
80+
81+
```bash
82+
npm run lint
83+
```
84+
85+
自動修正を行う場合:
86+
87+
```bash
88+
npm run web:lint:fix # フロントエンドコード用
89+
```
90+
91+
### Pre-commit フック
92+
93+
このリポジトリでは [Husky](https://typicode.github.io/husky) を使用して Git フックを管理しています。`git commit` 時に `lint-staged` 経由で自動的に lint が実行されます。
94+
5695
## Pull Request を出す場合
5796

5897
バグ修正や機能改善などの Pull Request は歓迎しております :tada:
@@ -73,6 +112,12 @@ npm run web:dev
73112
git commit -m "xxx" --no-verify
74113
```
75114

115+
### レビュー基準
116+
117+
- Lint ルールは**レビュー基準**として使用されます。
118+
- 不要なレビューサイクルを避けるため、PR を開く前にコードが lint を通過することを確認してください。
119+
- 一貫したスタイルは可読性を向上させ、コードレビューでのやり取りを減らします。
120+
76121
もしCDK に変更があれば以下のコマンドでスナップショットの確認を行いスナップショットを更新してください。
77122

78123
```bash

0 commit comments

Comments
 (0)