This repository was archived by the owner on Nov 5, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ # import-sort-style-rn
2
+
3
+ Sensible [ import sorting] ( https://github.com/renke/import-sort/ ) style for React Native projects.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ yarn add --dev import-sort-cli import-sort-style-rn
9
+ ```
10
+
11
+ ## Setup
12
+
13
+ Add the following to your ` package.json ` :
14
+
15
+ ``` json
16
+ "importSort" : {
17
+ ".js, .jsx, .ts, .tsx" : {
18
+ "style" : " rn"
19
+ }
20
+ }
21
+ ```
22
+
23
+ ## Style
24
+
25
+ ``` javascript
26
+ // Modules with side effects (not sorted internally because order may matter)
27
+ import ' c' ;
28
+ import ' a' ;
29
+
30
+ // React (Native) modules
31
+ import React from ' react' ;
32
+ import { Text , ... } from ' react-native' ;
33
+
34
+ // Node.js modules
35
+ import { readFile } from ' fs' ;
36
+
37
+ // Installed modules
38
+ import axios from ' axios' ;
39
+
40
+ // "External" project modules ("../")
41
+ import Divider from ' ../components/Divider' ;
42
+
43
+ // "Internal" project modules ("./")
44
+ import Bubble from ' ./Bubble' ;
45
+
46
+ // Resource files (.png, .jpg, .jpeg, .svg)
47
+ import Logo from ' ../assets/logo.png' ;
48
+
49
+ ```
50
+
51
+ ### References
52
+
53
+ - https://github.com/renke/import-sort/tree/master/packages/import-sort-style-module
54
+ - https://github.com/pietile/import-sort-style-pietile
You can’t perform that action at this time.
0 commit comments