Skip to content

RodSarhan/eslint-plugin-react-native-unistyles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-unistyles

ESLint plugin for React Native Unistyles

NPM Downloads GitHub Repo stars NPM Version License

React Native Unistyles linting rules for ESLint. This repository is structured like (and contains code from) eslint-plugin-react-native.

Supported Versions

This plugin only supports Unistyles v2 for now

I am not currently using unistyles due to a change in my career, so I won't be working on v3 support in the foreseeable future

You're welcome to open a PR or take over the project if you'd like.

Installation

Install eslint-plugin-react-native-unistyles

yarn add eslint-plugin-react-native-unistyles -D

Configuration

Add plugins section and specify react-native-unistyles as a plugin.

{
  "plugins": ["react-native-unistyles"]
}

If it is not already the case you must also configure ESLint to support JSX.

{
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    }
  }
}

Then, enable all of the rules that you would like to use.

{
  "rules": {
    "react-native-unistyles/no-unused-styles": "warn",
    "react-native-unistyles/sort-styles": [
      "warn",
      "asc",
      { "ignoreClassNames": false, "ignoreStyleProperties": false }
    ],
  }
}

List of supported rules

  • no-unused-styles: Detect createStyleSheet styles which are not used in your React components
  • sort-styles: Detect createStyleSheet styles which are not in correct sort order

Shareable configurations

All

This plugin also exports an all configuration that includes every available rule.

{
  "plugins": [
    /* ... */
    "react-native-unistyles"
  ],
  "extends": [/* ... */, "plugin:react-native-unistyles/all"]
}

Note: These configurations will import eslint-plugin-react-native-unistyles and enable JSX in parser options.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •