You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-20
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,6 @@
1
+
# ESLint plugin for React Native
1
2
2
-
ESLint plugin for React Native
3
-
==============================
4
-
5
-
# Project update
3
+
## Project update
6
4
7
5
Dear users, first of all, thanks for using the plugin! At the moment development activity is low, I've personally not worked with React Native for many years and have little time to continue updating the plugin. I'll do my best to update the plugin to ensure compatibility with new eslint versions, but unfortunately I do not have time to asses new features/pull requests. Thanks for your understanding!
8
6
@@ -12,28 +10,27 @@ Dear users, first of all, thanks for using the plugin! At the moment development
12
10
13
11
React Native specific linting rules for ESLint. This repository is structured like (and contains code from) the excellent [eslint-plugin-react](http://github.com/yannickcr/eslint-plugin-react).
14
12
15
-
# Installation
13
+
##Installation
16
14
17
15
Install [ESLint](https://github.com/eslint/eslint) either locally or globally.
18
16
19
17
```sh
20
-
$ npm install --save-dev eslint
18
+
npm install --save-dev eslint
21
19
```
22
20
23
21
To make most use of this plugin, its recommended to install [eslint-plugin-react](http://github.com/yannickcr/eslint-plugin-react) in addition to [ESLint](https://github.com/eslint/eslint). If you installed `ESLint` globally, you have to install eslint-plugin-react globally too. Otherwise, install it locally.
Add `plugins` section and specify ESLint-plugin-React (optional) and ESLint-plugin-react-native as a plugin.
39
36
@@ -91,15 +88,25 @@ Finally, enable all of the rules that you would like to use.
91
88
}
92
89
```
93
90
94
-
# List of supported rules
91
+
## List of supported rules
92
+
93
+
<!-- begin auto-generated rules list -->
95
94
96
-
*[no-unused-styles](docs/rules/no-unused-styles.md): Detect `StyleSheet` rules which are not used in your React components
97
-
*[sort-styles](docs/rules/sort-styles.md): Require style definitions to be sorted alphabetically
98
-
*[split-platform-components](docs/rules/split-platform-components.md): Enforce using platform specific filenames when necessary
99
-
*[no-inline-styles](docs/rules/no-inline-styles.md): Detect JSX components with inline styles that contain literal values
100
-
*[no-color-literals](docs/rules/no-color-literals.md): Detect `StyleSheet` rules and inline styles containing color literals instead of variables
101
-
*[no-raw-text](docs/rules/no-raw-text.md): Detect raw text outside of `Text` component
102
-
*[no-single-element-style-arrays](docs/rules/no-single-element-style-arrays.md): No style arrays that have 1 element only `<View style={[{height: 10}]}/>`
|[no-color-literals](docs/rules/no-color-literals.md)| Detect `StyleSheet` rules and inline styles containing color literals instead of variables | 🌐 ||
102
+
|[no-inline-styles](docs/rules/no-inline-styles.md)| Detect JSX components with inline styles that contain literal values | 🌐 ||
103
+
|[no-raw-text](docs/rules/no-raw-text.md)| Detect raw text outside of `Text` component | 🌐 ||
104
+
|[no-single-element-style-arrays](docs/rules/no-single-element-style-arrays.md)| Disallow single element style arrays. These cause unnecessary re-renders as the identity of the array always changes | 🌐 | 🔧 |
105
+
|[no-unused-styles](docs/rules/no-unused-styles.md)| Detect `StyleSheet` rules which are not used in your React components | 🌐 ||
106
+
|[sort-styles](docs/rules/sort-styles.md)| Require style definitions to be sorted alphabetically | 🌐 | 🔧 |
107
+
|[split-platform-components](docs/rules/split-platform-components.md)| Enforce using platform specific filenames when necessary | 🌐 | 🔧 |
Copy file name to clipboardExpand all lines: docs/rules/no-single-element-style-arrays.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,10 @@
1
-
# No Single Element Style Arrays are allowed
1
+
# Disallow single element style arrays. These cause unnecessary re-renders as the identity of the array always changes (`react-native/no-single-element-style-arrays`)
2
+
3
+
💼 This rule is enabled in the 🌐 `all`[config](https://github.com/Intellicode/eslint-plugin-react-native#shareable-configurations).
4
+
5
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
6
+
7
+
<!-- end auto-generated rule header -->
2
8
3
9
These cause unnecessary re-renders as each time the array's identity changes.
Copy file name to clipboardExpand all lines: docs/rules/no-unused-styles.md
+13-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,9 @@
1
-
# Detect unused StyleSheet rules in React components
1
+
# Detect `StyleSheet` rules which are not used in your React components (`react-native/no-unused-styles`)
2
+
3
+
💼 This rule is enabled in the 🌐 `all`[config](https://github.com/Intellicode/eslint-plugin-react-native#shareable-configurations).
4
+
5
+
<!-- end auto-generated rule header -->
6
+
2
7
When working on a component over a longer period of time, you could end up with unused StyleSheet rules that slipped in over time but are forgotten as you continue to improve your UX/UI design.
Copy file name to clipboardExpand all lines: docs/rules/sort-styles.md
+8-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,11 @@
1
-
# Require StyleSheet keys to be sorted
1
+
# Require style definitions to be sorted alphabetically (`react-native/sort-styles`)
2
+
3
+
💼 This rule is enabled in the 🌐 `all`[config](https://github.com/Intellicode/eslint-plugin-react-native#shareable-configurations).
4
+
5
+
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix).
6
+
7
+
<!-- end auto-generated rule header -->
8
+
2
9
It's like [sort-keys](https://eslint.org/docs/rules/sort-keys), but just for React Native styles.
3
10
4
11
Keeping your style definitions sorted is a common convention that helps with readability. This rule lets you enforce an ascending (default) or descending alphabetical order for both "class names" and style properties.
0 commit comments