|
| 1 | +# Contributing to `eslint-plugin-solid` |
| 2 | + |
| 3 | +Thanks for your interest in improving this project! We welcome questions, bug reports, and feature |
| 4 | +requests. Please file an issue before submitting a PR, and fill out applicable details in the chosen |
| 5 | +issue template. |
| 6 | + |
| 7 | +> Please see our [Code of Conduct](./CODE_OF_CONDUCT.md) before contributing. |
| 8 | +
|
| 9 | +## Development |
| 10 | + |
| 11 | +This project uses `pnpm` for package management. Run `pnpm i` to install dependencies after cloning |
| 12 | +the repo. |
| 13 | + |
| 14 | +To type-check and build the code, run `pnpm build`. This will also regenerate the docs from source |
| 15 | +code descriptions and test cases, using `scripts/docs.ts`. |
| 16 | + |
| 17 | +`pnpm lint` runs ESLint on the repo (so meta!). |
| 18 | + |
| 19 | +Testing is _extremely_ important to maintaining the quality of this project, so we require |
| 20 | +comprehensive tests for every rule, and we check against example code provided in the docs. To run |
| 21 | +tests for individual rules as well as integration/e2e tests, run `pnpm test`. To run tests for a |
| 22 | +specific rule like `reactivity`, run `pnpm test reactivity` or `pnpm test reactivity --watch`. |
| 23 | +Before releasing new versions, we run tests against various ESLint parsers with `pnpm test:all`. |
| 24 | + |
| 25 | +### Adding a new rule |
| 26 | + |
| 27 | +For each rule, there's a few things to do for it to be ready for release. Let's say you have |
| 28 | +received approval to add a rule named `solid/some-name` in an issue: |
| 29 | + |
| 30 | +1. Create `src/rules/some-name.ts`. Add the necessary imports and a default export of the form `{ |
| 31 | + meta: { ... }, create() { ... } }`. |
| 32 | + [`solid/no-react-specific-props`](./src/rules/no-react-specific-props.ts) is a good, brief |
| 33 | + example of what's necessary. |
| 34 | +2. Create `test/rules/some-name.test.ts`. Add `valid` and `invalid` test cases, using other files |
| 35 | + for inspiration. Be sure to `export const cases` so `scripts/docs.ts` can pick up the test cases. |
| 36 | +3. Create `docs/rules/some-name.md`. You can copy the content of |
| 37 | + `docs/rules/no-react-specific-props.md` directly, as all of its content is auto-generated. Run |
| 38 | + `pnpm build` and then verify that the content has been updated to reflect the new rule. |
| 39 | +4. When good tests are written and passing, open `src/index.ts` and import your new rule. Add it to |
| 40 | + `allRules` and the `recommended` and `typescript` configs as appropriate. |
| 41 | +5. Submit your PR and await feedback. When any necessary changes have been made, it will be merged. |
| 42 | + Congratulations! |
| 43 | + |
| 44 | +## Publishing |
| 45 | + |
| 46 | +Publishing is currently done manually by @joshwilsonvu. When publishing a new version of |
| 47 | +`eslint-plugin-solid`, we also publish a corresponding version of `eslint-plugin-standalone`, which |
| 48 | +is a package primarily intended to support linting on https://playground.solidjs.com. |
0 commit comments