This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nico Dinata
committed
Feb 29, 2020
1 parent
a807b13
commit e9fee04
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# import-sort-style-rn | ||
|
||
Sensible [import sorting](https://github.com/renke/import-sort/) style for React Native projects. | ||
|
||
## Installation | ||
|
||
``` | ||
yarn add --dev import-sort-cli import-sort-style-rn | ||
``` | ||
|
||
## Setup | ||
|
||
Add the following to your `package.json`: | ||
|
||
```json | ||
"importSort": { | ||
".js, .jsx, .ts, .tsx": { | ||
"style": "rn" | ||
} | ||
} | ||
``` | ||
|
||
## Style | ||
|
||
```javascript | ||
// Modules with side effects (not sorted internally because order may matter) | ||
import 'c'; | ||
import 'a'; | ||
|
||
// React (Native) modules | ||
import React from 'react'; | ||
import { Text, ... } from 'react-native'; | ||
|
||
// Node.js modules | ||
import { readFile } from 'fs'; | ||
|
||
// Installed modules | ||
import axios from 'axios'; | ||
|
||
// "External" project modules ("../") | ||
import Divider from '../components/Divider'; | ||
|
||
// "Internal" project modules ("./") | ||
import Bubble from './Bubble'; | ||
|
||
// Resource files (.png, .jpg, .jpeg, .svg) | ||
import Logo from '../assets/logo.png'; | ||
|
||
``` | ||
|
||
### References | ||
|
||
- https://github.com/renke/import-sort/tree/master/packages/import-sort-style-module | ||
- https://github.com/pietile/import-sort-style-pietile |