Skip to content

Commit 908e7ca

Browse files
author
Krzysztof Borowy
authored
chore: use eslint community config, hooks interface docs
* chore: use eslint config from community * docs: changes info about hooks interface
1 parent d68889d commit 908e7ca

File tree

7 files changed

+50
-354
lines changed

7 files changed

+50
-354
lines changed

.eslintrc

Lines changed: 12 additions & 290 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,6 @@ getData = async () => {
5454

5555
```
5656

57-
### useAsyncStorage hook
58-
59-
React hooks (introduced in 16.8) allow you to use state and async requests without writing a class. For more info on hooks and how to use them, see [hooks documentation](https://reactjs.org/docs/hooks-intro.html) or the [hooks example](docs/Hooks.md) in this repo.
60-
61-
`useAsyncStorage` has no hard-coded dependencies in react hooks, it is just a convenience wrapper around `AsyncStorage`.
62-
63-
```js
64-
import { useAsyncStorage } from '@react-native-community/async-storage';
65-
```
66-
67-
```jsx
68-
const {
69-
getItem,
70-
setItem,
71-
mergeItem,
72-
removeItem
73-
} = useAsyncStorage('@storage_key');
74-
```
75-
7657
See docs for [api and more examples.](docs/API.md)
7758

7859
## Contribution

docs/API.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,8 @@ static flushGetRequests(): void
502502
503503
## `useAsyncStorage`
504504
505-
Uses the new [hooks api](https://reactjs.org/docs/hooks-intro.html) to give you convenience functions so you can get, set, merge and delete a value for a given key from Async Storage.
505+
**Note**: A hooks-like interface that we're experimenting with. This will change in the nearest future to fully leverage Hooks API, so feel free to [follow this discussion to learn more](https://github.com/react-native-community/react-native-async-storage/issues/32).
506+
506507
507508
The `useAsyncStorage` returns an object that exposes all methods that allow you to interact with the stored value.
508509

example/src/App.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
Text,
1616
TouchableOpacity,
1717
View,
18-
ScrollView,
1918
Keyboard,
2019
Button,
2120
} from 'react-native';

lib/hooks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ export function useAsyncStorage(key: string): AsyncStorageHook {
2222
mergeItem: (...args) => AsyncStorage.mergeItem(key, ...args),
2323
removeItem: (...args) => AsyncStorage.removeItem(key, ...args),
2424
};
25-
}
25+
}

package.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,16 @@
3838
},
3939
"devDependencies": {
4040
"@babel/core": "7.0.0",
41+
"@react-native-community/eslint-config": "0.0.2",
4142
"@semantic-release/git": "7.0.8",
4243
"babel-core": "7.0.0-bridge.0",
43-
"babel-eslint": "9.0.0",
4444
"babel-jest": "24.1.0",
4545
"babel-plugin-module-resolver": "3.1.3",
4646
"detox": "10.0.7",
4747
"eslint": "5.1.0",
48-
"eslint-config-fb-strict": "22.1.0",
49-
"eslint-config-fbjs": "2.0.1",
50-
"eslint-plugin-eslint-comments": "3.0.1",
51-
"eslint-plugin-flowtype": "2.43.0",
52-
"eslint-plugin-jest": "21.8.0",
53-
"eslint-plugin-prettier": "2.6.0",
54-
"eslint-plugin-react": "7.8.2",
55-
"eslint-plugin-react-hooks": "1.0.1",
56-
"eslint-plugin-react-native": "3.5.0",
5748
"flow-bin": "0.86.0",
5849
"jest": "24.1.0",
5950
"metro-react-native-babel-preset": "0.51.1",
60-
"prettier": "1.16.4",
6151
"react": "16.6.3",
6252
"react-native": "0.58.4",
6353
"react-test-renderer": "16.6.3",

yarn.lock

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,21 @@
715715
universal-user-agent "^2.0.0"
716716
url-template "^2.0.8"
717717

718+
"@react-native-community/eslint-config@^0.0.2":
719+
version "0.0.2"
720+
resolved "https://registry.yarnpkg.com/@react-native-community/eslint-config/-/eslint-config-0.0.2.tgz#042224762e00ef06b45693a14be78ebda5fb7def"
721+
integrity sha512-oKtMR046Ptfjvzd67MPm7Q8a5H8MeMsKB7E5bKgcMoybdZBmrsqo3Fn49FCKwc6yHd4KUkTyQihE4Fgk9jaanA==
722+
dependencies:
723+
babel-eslint "9.0.0"
724+
eslint-plugin-eslint-comments "^3.0.1"
725+
eslint-plugin-flowtype "2.43.0"
726+
eslint-plugin-jest "21.8.0"
727+
eslint-plugin-prettier "2.6.0"
728+
eslint-plugin-react "7.8.2"
729+
eslint-plugin-react-hooks "^1.0.1"
730+
eslint-plugin-react-native "3.5.0"
731+
prettier "1.13.6"
732+
718733
"@semantic-release/commit-analyzer@^6.1.0":
719734
version "6.1.0"
720735
resolved "https://registry.yarnpkg.com/@semantic-release/commit-analyzer/-/commit-analyzer-6.1.0.tgz#32bbe3c23da86e23edf072fbb276fa2f383fcb17"
@@ -2579,30 +2594,13 @@ escodegen@^1.9.1:
25792594
optionalDependencies:
25802595
source-map "~0.6.1"
25812596

2582-
eslint-config-fb-strict@22.1.0:
2583-
version "22.1.0"
2584-
resolved "https://registry.yarnpkg.com/eslint-config-fb-strict/-/eslint-config-fb-strict-22.1.0.tgz#6a81785d45748d6c753442772b84da0aca13c45f"
2585-
integrity sha512-UFJeCwl7Zg7s3d90PjedcNbjpMBzyojTiF9H6lEJMp/XU8oSlSDzk1UFOz41YqdG2BFyg5xsRbQngquJkTxrxg==
2586-
dependencies:
2587-
eslint-config-fbjs "^2.0.1"
2588-
2589-
eslint-config-fbjs@2.0.1:
2590-
version "2.0.1"
2591-
resolved "https://registry.yarnpkg.com/eslint-config-fbjs/-/eslint-config-fbjs-2.0.1.tgz#395896fd740e0e28dc1c2072e3bc982e88247df5"
2592-
integrity sha512-nZ/JByixNK/8epeQqmrtNCYYMXCjHoPkJwHaHg4aZyZlS62YLttDSWYE6ISGl070V+o6dkFbDALceWaO3Po+Sw==
2593-
2594-
eslint-config-fbjs@^2.0.1:
2595-
version "2.1.0"
2596-
resolved "https://registry.yarnpkg.com/eslint-config-fbjs/-/eslint-config-fbjs-2.1.0.tgz#bfe4f8c2d2282bfe515359553905d830e3a5d12f"
2597-
integrity sha512-wh7Lveo51V3/SUydWtR2VEU8wNfSHt5V7YzIUKTRkHF3kvkCwFtM6Jgsn+xBNkjxZGpfWgNJN/drk1LLx64Dww==
2598-
2599-
eslint-plugin-eslint-comments@3.0.1:
2600-
version "3.0.1"
2601-
resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.0.1.tgz#baafb713584c0de7ee588710720e580bcc28cfbb"
2602-
integrity sha512-7zU6gCulKVmfG3AZdnvDxzfHaGdvkA8tsLiKbneeI/TlVaulJsRzOyMCctH9QTobKVJ6LIsiJbrkSKkgcFLHxw==
2597+
eslint-plugin-eslint-comments@^3.0.1:
2598+
version "3.1.1"
2599+
resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.1.tgz#32ff0afba8a48e17073817e6d03fbc5622f735b7"
2600+
integrity sha512-GZDKhOFqJLKlaABX+kdoLskcTINMrVOWxGca54KcFb1QCPd0CLmqgAMRxkkUfGSmN+5NJUMGh7NGccIMcWPSfQ==
26032601
dependencies:
26042602
escape-string-regexp "^1.0.5"
2605-
ignore "^3.3.8"
2603+
ignore "^5.0.5"
26062604

26072605
eslint-plugin-flowtype@2.43.0:
26082606
version "2.43.0"
@@ -2624,10 +2622,10 @@ eslint-plugin-prettier@2.6.0:
26242622
fast-diff "^1.1.1"
26252623
jest-docblock "^21.0.0"
26262624

2627-
eslint-plugin-react-hooks@1.0.1:
2628-
version "1.0.1"
2629-
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.0.1.tgz#76b6fb4edafab02eab0090078977687157605dd9"
2630-
integrity sha512-yNhvY7EFBp0mq0Bt8BHoS57GwJ4e1qSYdvDFSfPnjmiSmyGUfQFQGcQs4K0JQFDGopWkURWq58psbUJIhWZ2Kg==
2625+
eslint-plugin-react-hooks@^1.0.1:
2626+
version "1.5.0"
2627+
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.5.0.tgz#cdd958cfff55bd5fa4f84db90d1490fb5ca4ae2b"
2628+
integrity sha512-iwDuWR2ReRgvJsNm8fXPtTKdg78IVQF8I4+am3ntztPf/+nPnWZfArFu6aXpaC75/iCYRrkqI8nPCYkxJstmpA==
26312629

26322630
eslint-plugin-react-native-globals@^0.1.1:
26332631
version "0.1.2"
@@ -3699,7 +3697,7 @@ ignore-walk@^3.0.1:
36993697
dependencies:
37003698
minimatch "^3.0.4"
37013699

3702-
ignore@^3.3.3, ignore@^3.3.8:
3700+
ignore@^3.3.3:
37033701
version "3.3.10"
37043702
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043"
37053703
integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==
@@ -3709,6 +3707,11 @@ ignore@^4.0.3:
37093707
resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc"
37103708
integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==
37113709

3710+
ignore@^5.0.5:
3711+
version "5.0.5"
3712+
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.0.5.tgz#c663c548d6ce186fb33616a8ccb5d46e56bdbbf9"
3713+
integrity sha512-kOC8IUb8HSDMVcYrDVezCxpJkzSQWTAzf3olpKM6o9rM5zpojx23O0Fl8Wr4+qJ6ZbPEHqf1fdwev/DS7v7pmA==
3714+
37123715
image-size@^0.6.0:
37133716
version "0.6.3"
37143717
resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.6.3.tgz#e7e5c65bb534bd7cdcedd6cb5166272a85f75fb2"
@@ -6748,10 +6751,10 @@ preserve@^0.2.0:
67486751
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
67496752
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=
67506753

6751-
prettier@1.16.4:
6752-
version "1.16.4"
6753-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717"
6754-
integrity sha512-ZzWuos7TI5CKUeQAtFd6Zhm2s6EpAD/ZLApIhsF9pRvRtM1RFo61dM/4MSRUA0SuLugA/zgrZD8m0BaY46Og7g==
6754+
prettier@1.13.6:
6755+
version "1.13.6"
6756+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.6.tgz#00ae0b777ad92f81a9e7a1df2f0470b6dab0cb44"
6757+
integrity sha512-p5eqCNiohWZN++7aJXUVj0JgLqHCPLf9GLIcLBHGNWs4Y9FJOPs6+KNO2WT0udJIQJTbeZFrJkjzjcb8fkAYYQ==
67556758

67566759
pretty-format@24.0.0-alpha.6:
67576760
version "24.0.0-alpha.6"

0 commit comments

Comments
 (0)