UNPKG

2.78 kBMarkdownView Raw
1# stylelint-react-native
2
3A collection of React Native specific linting rules for [stylelint](https://github.com/stylelint/stylelint) (in a form of a plugin).
4
5## Installation and usage
6
7Install `stylelint-react-native` (and `stylelint`, if you haven't done so yet):
8
9```
10yarn add stylelint stylelint-react-native --dev
11```
12
13or
14
15```
16npm install stylelint stylelint-react-native --save-dev
17```
18
19Create the `.stylelintrc` config file (or open the existing one), add `stylelint-react-native` to the plugins array and the rules you need to the rules list. All rules from `stylelint-react-native` need to be namespaced with `react-native`.
20
21```json
22{
23 "plugins": ["stylelint-taro-rn"],
24 "rules": {
25 "taro-rn/css-property-no-unknown": true
26 }
27}
28```
29
30Please refer to [stylelint docs](http://stylelint.io/user-guide/) for the detailed info on using this linter plugin.
31
32## List of rules
33
34### General rules
35
36- [`font-weight-no-ignored-values`](./src/rules/font-weight-no-ignored-values/README.md): Disallow valid `font-weight` values that work on iOS, but are ignored and get mapped to `normal` or `bold` weight on Android.
37
38---
39
40### css- rules (for tools like styled-components)
41
42These rules are meant to be used with tools that allow you to write CSS when using React Native, e.g. [styled-components](https://www.styled-components.com/), [React Native CSS modules](https://github.com/kristerkari/react-native-css-modules), etc.
43
44- [`css-property-no-unknown`](./src/rules/css-property-no-unknown/README.md): Disallow unknown React Native CSS properties.
45
46---
47
48### style- rules (for React Native's built-in styling)
49
50These rules are meant to be used when styling with React Native's built-in styling, or with tools that use React Native's default styling.
51
52- [`style-property-no-unknown`](./src/rules/style-property-no-unknown/README.md): Disallow unknown React Native Style properties.
53
54## Help out
55
56There work on the plugin's rules is still in progress, so if you feel like it, you're welcome to help out in any of these (the plugin follows stylelint guidelines so most part of this is based on its docs):
57
58- Create, enhance, and debug rules (see stylelint's guide to "[Working on rules](https://github.com/stylelint/stylelint/blob/master/docs/developer-guide/rules.md)").
59- Improve documentation.
60- Chime in on any open issue or pull request.
61- Open new issues about your ideas on new rules, or for how to improve the existing ones, and pull requests to show us how your idea works.
62- Add new tests to absolutely anything.
63- Work on improving performance of rules.
64- Contribute to [stylelint](https://github.com/stylelint/stylelint)
65- Spread the word.
66
67There is also [stackoverflow](http://stackoverflow.com/questions/tagged/stylelint), which would be the preferred QA forum.