Package detail

stylelint-react-native

kristerkari39.2kMIT2.7.0

A collection of React Native specific rules for stylelint

css, csslint, lint, linter

readme

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

  • font-weight-no-ignored-values: Disallow valid font-weight values that work on iOS, but are ignored and get mapped to normal or bold weight on Android.

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

  • Create, enhance, and debug rules (see stylelint's guide to "Working on rules").
  • Improve documentation.
  • Chime in on any open issue or pull request.
  • 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.
  • Add new tests to absolutely anything.
  • Work on improving performance of rules.
  • Contribute to stylelint
  • Spread the word.

We communicate via issues and pull requests.

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

changelog

v2.7.0

  • Added: support for stylelint version 16 (#187).
  • Added: support for more React Native properties (#193, #194).

v2.6.0

  • Added: support for stylelint version 15.

v2.5.0

  • Added: support for rowGap, columnGap, and gap properties.

v2.4.0

  • Added: support for stylelint version 14.

v2.3.0

  • Added: css-property-no-unknown support for place-content property.
  • Updated: react-native-known-styling-properties dependency to v1.1.0.

v2.2.0

  • Added: support for stylelint versions 11, 12 and 13.

v2.1.1

  • Fixed: css-property-no-unknown now ignores custom -styled-mixin properties that stylelint-processor-styled-components is using.

v2.1.0

  • Added: support for stylelint version 10.

v2.0.2

  • Fixed: don't warn for object composition of styles when using style-property-no-unknown.
  • Updated: added a test to verify that css-property-no-unknown only accepts properties in kebab case.
  • Updated: react-native-known-styling-properties dependency to v1.0.5.

v2.0.1

  • Fixed: css-property-no-unknown don't warn for properties inside an :export block.

v2.0.0

  • Removed: Node.JS 4.x support. Node.js 6.x or greater is now required.
  • Added: font-weight-no-ignored-values rule.

v1.1.1

  • Updated: react-native-known-styling-properties dependency to v1.0.4.

v1.1.0

  • Added: support for stylelint 9.
  • Updated: react-native-known-styling-properties dependency to v1.0.3.

v1.0.1

  • Fixed: some missing React Native styling properties added. Updated react-native-known-styling-properties dependency to v1.0.2.

v1.0.0

  • Intial release