|
1 | 1 | # ESLint React Contributing Guide |
2 | 2 |
|
3 | | -Thank you for your interest in contributing to ESLint React! This guide will help you understand how to contribute effectively. |
| 3 | +Welcome to contributing to ESLint React! This guide will help you contribute effectively. |
4 | 4 |
|
5 | 5 | > [!NOTE] |
6 | 6 | > ESLint React is not a fork of or derived from `eslint-plugin-react`. Features in `eslint-plugin-react` may not appear in ESLint React. |
7 | 7 |
|
8 | | -## Issue Reporting Guidelines |
| 8 | +## Issue Reporting Guide |
9 | 9 |
|
10 | | -- **Search First** - Your issue may already be addressed |
11 | | -- **Verify Version** - Confirm reproducibility with the latest stable release |
12 | | -- **Clear Reproduction Steps Required** - Detailed steps to reproduce are essential |
13 | | -- **Minimal Code Example** - Provide only the code necessary to demonstrate the issue |
14 | | -- **Be Patient** - The team balances many responsibilities |
| 10 | +- **Search first**: Your issue may have already been reported. |
| 11 | +- **Verify version**: Ensure the issue is reproducible in the latest stable version. |
| 12 | +- **Provide clear reproduction steps**. |
| 13 | +- **Provide a minimal reproducible code example**. |
15 | 14 |
|
16 | | -## Pull Request Guidelines |
| 15 | +## Pull Request Guide |
17 | 16 |
|
18 | | -- **Sign Your Commits** - Ensure your commits are signed |
19 | | -- **Multiple Small Commits Allowed** - GitHub will squash before merging |
20 | | -- **New Features** - Provide strong rationale, preferably with prior discussion |
21 | | -- **Bug Fixes** - Include `(fix: #xxxx)` in your PR title and detailed description |
22 | | -- **Documentation Changes** - Include `(docs: #xxxx)` in your PR title and detailed description |
| 17 | +- **Sign your commits**. |
| 18 | +- **Small commits are welcome**: We will squash them before merging. |
| 19 | +- **New features**: Please provide a good reason, preferably by discussing it in an Issue first. |
| 20 | +- **Bug fixes**: Include `(fix: #xxxx)` in the PR title. |
| 21 | +- **Documentation changes**: Include `(docs: #xxxx)` in the PR title. |
23 | 22 |
|
24 | | -## References |
| 23 | +## Development Commands |
25 | 24 |
|
26 | | -- [Monorepo Structure](https://eslint-react.xyz/docs/contributing#monorepo-structure) |
| 25 | +### Build |
| 26 | + |
| 27 | +```bash |
| 28 | +# Build packages that are needed for development and publishing |
| 29 | +pnpm run build |
| 30 | + |
| 31 | +# Build packages that are used in the monorepo (e.g., plugins, configs) |
| 32 | +pnpm run build:pkgs |
| 33 | + |
| 34 | +# Build docs for all packages |
| 35 | +pnpm run build:docs |
| 36 | + |
| 37 | +# Build the website |
| 38 | +pnpm run build:website |
| 39 | +``` |
| 40 | + |
| 41 | +### Testing |
| 42 | + |
| 43 | +```bash |
| 44 | +# Run all tests |
| 45 | +pnpm run test |
| 46 | + |
| 47 | +# Run a single test file |
| 48 | +pnpm vitest packages/plugins/eslint-plugin-react-x/src/rules/[rule-name].spec.ts |
| 49 | +``` |
| 50 | + |
| 51 | +### Code Linting and Formatting |
| 52 | + |
| 53 | +```bash |
| 54 | +# Format the code |
| 55 | +pnpm run format:write |
| 56 | + |
| 57 | +# Run all checks |
| 58 | +pnpm run lint |
| 59 | +``` |
| 60 | + |
| 61 | +## Development Workflow |
| 62 | + |
| 63 | +### Testing |
| 64 | + |
| 65 | +- Test files coexist with source files: `src/rules/[rule-name].spec.ts`. |
| 66 | +- Uses `TypeScript ESLint Rule Tester`. |
| 67 | +- Provides separate test setups for type-aware and non-type-aware rules. |
| 68 | +- Test fixtures support multiple TypeScript configurations (e.g., JSX variants). |
| 69 | +- Test helpers are located in the `test/` directory. |
| 70 | + |
| 71 | +### Developing a New Rule |
| 72 | + |
| 73 | +1. If there isn't a related Issue, create one first to discuss the new rule. |
| 74 | +2. Implement the rule in the plugin's `src/rules/` directory. |
| 75 | +3. Create the corresponding test file. |
| 76 | +4. Export the rule in the plugin's entry file (`src/plugin.ts`). |
| 77 | +5. Add documentation for the rule. |
| 78 | +6. If the rule should be enabled by default, update the preset configurations. |
| 79 | +7. Update the unified plugin to include the new rule. |
| 80 | +8. Update the website documentation. |
| 81 | +9. Run build and test commands. |
| 82 | +10. Submit a PR with a clear description of the changes. |
| 83 | + |
| 84 | +## Reference |
| 85 | + |
| 86 | +- [Monorepo Structure](https://beta.eslint-react.xyz/docs/contributing#monorepo-structure) |
0 commit comments