UNPKG

1.7 kBMarkdownView Raw
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
7When 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
16All commit messages must begin with one of the following prefixes:
17
18* `fix: `
19* `feat: `
20* `refactor: `
21* `docs: `
22* `chore: `
23
24The prefix is used to bump the correct segment of the version number during the automatic release.
25
26## Tests
27
28Run them with `npm test`.
29
30## Lint
31
32Run with `npm run lint`.
33
34## Adding a Rule
35
36### Source & Tests
37
381. Create a file in `tests/rules/assertions` named the `camelCase` version of your rule name with the following template:
39 * `export default { invalid: [], valid: [] }`
402. Add your test file to `tests/rules/index.js`
413. Create a file in `src/rules` named the `camelCase` version of your rule name
424. Add your rule file to `src/index.js`
43
44### Adding Documentation
45
461. 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.
491. Update [./.README/README.md](/.README/README.md) to include the new rule.
501. Run `npm run create-readme` to generate the new `README.md` (you should be on `master` branch for this command to work)
51
52Note: Sections "The following patterns are considered problems:" and "The following patterns are not considered problems:" are **generated automatically** using the test cases.