|
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 | 23 | ## Development Commands |
25 | 24 |
|
26 | | -### Build Commands |
| 25 | +### Build |
27 | 26 |
|
28 | 27 | ```bash |
29 | | -# Build packages in packages directory (core, shared, utilities, plugins) |
| 28 | +# Build packages that are needed for development and publishing |
30 | 29 | pnpm run build |
31 | 30 |
|
32 | | -# Build packages in .pkgs directory (local configs) |
| 31 | +# Build packages that are used in the monorepo (e.g., plugins, configs) |
33 | 32 | pnpm run build:pkgs |
34 | 33 |
|
35 | | -# Build documentation for all packages |
| 34 | +# Build docs for all packages |
36 | 35 | pnpm run build:docs |
37 | 36 |
|
38 | | -# Build website |
| 37 | +# Build the website |
39 | 38 | pnpm run build:website |
40 | 39 | ``` |
41 | 40 |
|
42 | 41 | ### Testing |
43 | 42 |
|
44 | 43 | ```bash |
45 | | -# Run all tests with Vitest |
| 44 | +# Run all tests |
46 | 45 | pnpm run test |
47 | 46 |
|
48 | 47 | # Run a single test file |
49 | 48 | pnpm vitest packages/plugins/eslint-plugin-react-x/src/rules/[rule-name].spec.ts |
50 | 49 | ``` |
51 | 50 |
|
52 | | -### Linting & Formatting |
| 51 | +### Code Linting and Formatting |
53 | 52 |
|
54 | 53 | ```bash |
55 | | -# Full lint check (deps, publish, TypeScript, ESLint, examples) |
56 | | -pnpm run lint |
57 | | - |
58 | | -# Individual lint commands |
59 | | -pnpm run lint:deps # Check dependency cycles with skott |
60 | | -pnpm run lint:ts # TypeScript check across packages |
61 | | -pnpm run lint:es # ESLint check |
62 | | -pnpm run lint:publish # Check package.json publishing config |
63 | | - |
64 | | -# Format code |
65 | | -pnpm run format:write # Format with dprint |
66 | | -pnpm run format:check # Check formatting |
67 | | -``` |
68 | | - |
69 | | -### Development Utilities |
| 54 | +# Format the code |
| 55 | +pnpm run format:write |
70 | 56 |
|
71 | | -```bash |
72 | | -# Update project metadata |
73 | | -pnpm run update:all # Update version, README, and website |
74 | | -pnpm run update:version # Update version across packages |
75 | | -pnpm run update:readme # Update README with generated content |
76 | | -pnpm run update:website # Update website content |
77 | | - |
78 | | -# Package management |
79 | | -pnpm run sort:package-json # Sort package.json files consistently |
80 | | - |
81 | | -# Inspection tools |
82 | | -pnpm run inspect:deps # Visualize dependency graph |
83 | | -pnpm run inspect:eslint-config # Launch ESLint config inspector |
| 57 | +# Run all checks |
| 58 | +pnpm run lint |
84 | 59 | ``` |
85 | 60 |
|
86 | 61 | ## Development Workflow |
87 | 62 |
|
88 | 63 | ### Testing |
89 | 64 |
|
90 | | -- Test files located alongside source: `src/rules/[rule-name].spec.ts` |
91 | | -- Uses TypeScript ESLint Rule Tester with custom configurations |
92 | | -- Separate test setups for type-checked and non-type-checked rules |
93 | | -- Test fixtures support multiple TypeScript configurations (JSX variants) |
94 | | -- Helper functions in `test/` directory for common test utilities |
95 | | - |
96 | | -### Working with Rules |
97 | | - |
98 | | -When developing new ESLint rules: |
99 | | - |
100 | | -1. Open an issue to discuss the rule's purpose and design if no existing issue exists |
101 | | -2. Add rule implementation in appropriate plugin's `src/rules/` directory |
102 | | -3. Create corresponding test file using rule tester setup |
103 | | -4. Export rule from plugin's main index file |
104 | | -5. Add rule documentation with summary and examples |
105 | | -6. Update presets/configs if rule should be included by default |
106 | | -7. Update the unified plugin to include the new rule |
107 | | -8. Update the website documentation with the new rule details |
108 | | -9. Run the build and test commands to ensure everything works as expected |
109 | | -10. Submit a pull request with clear description of the changes and any relevant issue links |
110 | | - |
111 | | -## References |
| 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 |
112 | 85 |
|
113 | 86 | - [Monorepo Structure](https://beta.eslint-react.xyz/docs/contributing#monorepo-structure) |
0 commit comments