kristerkari / stylelint-react-native

A collection of React Native specific linting rules for stylelint (in a form of a plugin).
MIT License
57 stars 1 forks source link
linter-plugin react-native stylelint

stylelint-react-native

A collection of React Native specific linting rules for stylelint (in a form of a plugin).

NPM version Build Status Downloads per month contributions welcome

Installation and usage

Install stylelint-react-native (and stylelint, if you haven't done so yet):

yarn add stylelint stylelint-react-native --dev

or

npm install stylelint stylelint-react-native --save-dev

Create 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.

{
  "plugins": ["stylelint-react-native"],
  "rules": {
    "react-native/css-property-no-unknown": true
  }
}

Please refer to stylelint docs for the detailed info on using this linter plugin.

List of rules

General rules


css- rules (for tools like styled-components)

These rules are meant to be used with tools that allow you to write CSS when using React Native, e.g. styled-components, React Native CSS modules, etc.


style- rules (for React Native's built-in styling)

These rules are meant to be used when styling with React Native's built-in styling (StyleSheet), or with tools that use React Native's default styling.

Help out

There 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):

We communicate via issues and pull requests.

There is also stackoverflow, which would be the preferred QA forum.