1 | # Contributing
|
2 |
|
3 | **`README.md` is a generated file. Do not edit it directly.** Edit the files inside `.README` instead.
|
4 |
|
5 | ## Pre-Commit Hook
|
6 |
|
7 | When making a commit, the following Pre-Commit hooks run:
|
8 |
|
9 | * test and documentation checks
|
10 | * tests
|
11 | * lint
|
12 | * commit message validation (see "Commit Messages" below)
|
13 |
|
14 | ## Commit Messages
|
15 |
|
16 | All commit messages must begin with one of the following prefixes:
|
17 |
|
18 | * `fix: `
|
19 | * `feat: `
|
20 | * `refactor: `
|
21 | * `docs: `
|
22 | * `chore: `
|
23 |
|
24 | The prefix is used to bump the correct segment of the version number during the automatic release.
|
25 |
|
26 | ## Tests
|
27 |
|
28 | Run them with `npm test`.
|
29 |
|
30 | ## Lint
|
31 |
|
32 | Run with `npm run lint`.
|
33 |
|
34 | ## Adding a Rule
|
35 |
|
36 | ### Source & Tests
|
37 |
|
38 | 1. Create a file in `tests/rules/assertions` named the `camelCase` version of your rule name with the following template:
|
39 | * `export default { invalid: [], valid: [] }`
|
40 | 2. Add your test file to `tests/rules/index.js`
|
41 | 3. Create a file in `src/rules` named the `camelCase` version of your rule name
|
42 | 4. Add your rule file to `src/index.js`
|
43 |
|
44 | ### Adding Documentation
|
45 |
|
46 | 1. Create new file in `./.README/rules/[rule-name].md`.
|
47 | * Use [./.README/rules/require-valid-file-annotation.md](./.README/rules/require-valid-file-annotation.md) as a template.
|
48 | * Ensure that rule documentation document includes `<!-- assertions spaceAfterTypeColon -->` declaration.
|
49 | 1. Update [./.README/README.md](/.README/README.md) to include the new rule.
|
50 | 1. Run `npm run create-readme` to generate the new `README.md` (you should be on `master` branch for this command to work)
|
51 |
|
52 | Note: Sections "The following patterns are considered problems:" and "The following patterns are not considered problems:" are **generated automatically** using the test cases.
|