https://github.com/rodsarhan/eslint-plugin-react-native-unistyles
https://github.com/rodsarhan/eslint-plugin-react-native-unistyles
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/rodsarhan/eslint-plugin-react-native-unistyles
- Owner: RodSarhan
- License: mit
- Created: 2024-07-05T06:09:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-17T12:45:09.000Z (over 1 year ago)
- Last Synced: 2025-04-03T05:19:48.633Z (about 1 year ago)
- Language: JavaScript
- Size: 534 KB
- Stars: 15
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# ESLint plugin for React Native Unistyles
 [](https://github.com/RodSarhan/eslint-plugin-react-native-unistyles)  [](https://github.com/RodSarhan/eslint-plugin-react-native-unistyles/blob/main/LICENSE)
[React Native Unistyles](https://github.com/jpudysz/react-native-unistyles) linting rules for ESLint. This repository is structured like (and contains code from) [eslint-plugin-react-native](https://github.com/Intellicode/eslint-plugin-react-native).
## Supported Versions
This plugin only supports Unistyles v2 for now, v3 support will be added once v3 is stable and out of beta
## Installation
Install eslint-plugin-react-native-unistyles
```sh
yarn add eslint-plugin-react-native-unistyles -D
```
## Configuration
Add `plugins` section and specify react-native-unistyles as a plugin.
```json
{
"plugins": ["react-native-unistyles"]
}
```
If it is not already the case you must also configure `ESLint` to support JSX.
```json
{
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
}
}
```
Then, enable all of the rules that you would like to use.
```json
{
"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](docs/rules/no-unused-styles.md): Detect `createStyleSheet` styles which are not used in your React components
- [sort-styles](docs/rules/sort-styles.md): 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.
```js
{
"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](http://eslint.org/docs/user-guide/configuring#specifying-parser-options).