UNPKG

4.24 kBMarkdownView Raw
1# Contributing
2
3Thank you for wanting to contribute.
4
5To help out, you can:
6
7- get involved in any open [issue](https://github.com/stylelint/stylelint/issues) or [pull request](https://github.com/stylelint/stylelint/pulls)
8- improve our [support for non-standard syntaxes](docs/about/syntaxes.md)
9- create, enhance and debug rules using [our guide](docs/developer-guide/rules.md)
10- improve the [documentation](docs/)
11- add [new tests](https://github.com/stylelint/stylelint/issues?q=is%3Aopen+is%3Aissue+label%3A%22type%3A+tests%22) to _absolutely anything_
12- improve the [performance of rules](docs/developer-guide/rules.md#improve-the-performance-of-a-rule)
13- open [new issues](https://github.com/stylelint/stylelint/issues/new/choose) about your ideas for making stylelint better
14- create or contribute to [integrations](docs/user-guide/integrations/editor.md), like our plugin for [VS Code](https://github.com/stylelint/vscode-stylelint)
15
16Not only will you help stylelint thrive, but you may learn a thing or two — about CSS, PostCSS, Node, ES2015, unit testing, open-source software, and more. We want to encourage contributions! If you want to participate but couldn't, please [give us feedback](https://github.com/stylelint/stylelint/issues/new) about what we could do better.
17
18## Code contributions
19
20To start coding, you'll need:
21
22- a minimum of [Node.js](https://nodejs.org/en/) v10, though we do recommend using the latest LTS release
23- the latest [npm](https://www.npmjs.com/)
24
25Then:
26
271. [Fork and clone](https://guides.github.com/activities/forking/) the stylelint repository.
282. Install all the dependencies with `npm ci`.
29
30### Run tests
31
32Next, you'll want to run the tests using `npm test`.
33
34However, this runs all 25,000+ unit tests and also linting.
35
36You can use the interactive testing prompt to run tests for just a chosen set of files (which you'll want to do during development). For example, to run the tests for just the `color-hex-case` and `color-hex-length` rules:
37
381. Run `npm run watch` to start the interactive testing prompt.
392. Press `p` to filter by a filename regex pattern.
403. Enter `color-hex-case|color-hex-length`, i.e. each rule name separated by the pipe symbol (`|`).
41
42You can find more information about testing on the [Jest website](https://jestjs.io/).
43
44### Write code
45
46With the interactive testing prompt running, you can write code confident that things are working as expected.
47
48You can write code to:
49
50- [add a rule](docs/developer-guide/rules.md#add-a-rule)
51- [add an option to a rule](docs/developer-guide/rules.md#add-an-option-to-a-rule)
52- [fix a bug in a rule](docs/developer-guide/rules.md#fix-a-bug-in-a-rule)
53- [improve the performance of a rule](docs/developer-guide/rules.md#improve-the-performance-of-a-rule)
54
55And many more things, including [writing system tests](docs/developer-guide/system-tests.md) and improving the [documentation](docs/).
56
57### Format code
58
59We use [Prettier](https://prettier.io/) (with [a Husky and lint-staged precommit](https://prettier.io/docs/en/precommit.html)) to format your code automatically.
60
61Alternatively, you can:
62
63- trigger the pretty-printing all the files using `npm run format`
64- use a [Prettier editor integration](https://prettier.io/docs/en/editors.html)
65
66### Open a pull request
67
68When you have something to share, it's time to [open a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
69
70After we review and merge your pull request, we'll invite you to become a maintainer of the stylelint organization. You'll then be able to help manage issues, pull requests and releases. You'll also be able to work on the stylelint repository rather than your fork.
71
72## Financial contributions
73
74We welcome financial contributions in full transparency on our [Open Collective](https://opencollective.com/stylelint).
75
76Anyone can file an expense. We will "merge" the expense into the ledger if it makes sense for the development of the community. Open Collective then reimburses the person who filed the expense.
77
78You can financially support us by becoming a:
79
80- [backer](https://opencollective.com/stylelint#backer)
81- [sponsor](https://opencollective.com/stylelint#sponsor)