Skip to content

【提案】ESLint のルールと実行手順を CONTRIBUTING.md に明記したい #1299

@wasyokusatoshi

Description

@wasyokusatoshi

背景

本リポジトリには CONTRIBUTING.md があり、貢献フローは整理されていますが、
ESLint の具体的なルールセット(extends / plugins / 代表ルール)や実行手順が
ドキュメントからは分かりにくい状態です。

問題

  • 新規コントリビュータが「何がエラー扱いか」を把握しづらい
  • CI/フックで lint が必須かどうか、手元での回し方が明文化されていない
  • 複数パッケージ構成(packages/)のため、どの .eslintrc.* が有効かを掴みにくい
  • レビュー時の基準が曖昧になり、コントリビューターとメンテナで認識がずれる可能性がある

提案

CONTRIBUTING.md に以下を追記することを提案します:

  1. 参照する ESLint 設定ファイルの場所(例:/.eslintrc.js または packages/*/.eslintrc.*
  2. ベース設定(例:eslint:recommended / airbnb / plugin:@typescript-eslint/recommended など)
  3. 代表的にエラーになるルール例(unused imports, no-console, explicit return types など)
  4. 実行手順と自動修正方法
    • npm run lint
    • npm run lint -- --fix(必要なら -w オプションの説明も)
  5. pre-commit / pre-push フック(.husky)の有無と lint 実行の関係
  6. CI における lint の扱い(Fail 時にブロックするか、警告とするか)

利点

  • 新規コントリビュータが「どのルールに従えば良いか」を事前に理解できる
  • レビュー基準を事前に共有できるため、レビュー工数の削減につながる
  • 自動修正の使い方を明示することで、余計な差分を減らせる
  • OSS としての透明性・参入障壁の低減につながる

差分イメージ

以下のような形で CONTRIBUTING.md に追記することを想定しています。

 ## Contributing

 Thank you for contributing to Generative AI Use Cases!  
 Please follow the instructions below to ensure a smooth contribution process.

+### Linting and Code Style
+
+This project uses **ESLint** and **Prettier** to enforce code quality and consistent style.
+
+- **Config files**: ESLint configuration is defined in `.eslintrc.*` files (root or under `packages/`).  
+- **Base rules**: We extend commonly used configs such as `eslint:recommended` and `plugin:@typescript-eslint/recommended`.  
+- **Typical errors**:
+  - Unused imports / variables  
+  - Use of `console.log`  
+  - Missing explicit return types in TypeScript  
+  - React Hooks rules (e.g., `exhaustive-deps`)  
+
+#### Running ESLint
+Before committing, please run:
+
+```bash
+npm run lint
+```
+
+To automatically fix issues:
+
+```bash
+npm run lint -- --fix
+```
+
+#### Pre-commit Hook
+This repository uses [Husky](https://typicode.github.io/husky) for git hooks.  
+Linting may run automatically on `pre-commit` or `pre-push`.  
+If lint errors are present, your commit may be blocked until they are resolved.
+
+#### Review Standards
+- Lint rules are also used as **review criteria**.  
+- Please ensure your code passes linting before opening a PR to avoid unnecessary review cycles.
+- Consistent style improves readability and reduces back-and-forth in code review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions