Skip to content

Commit 2812517

Browse files
committed
feat: migrate from Flow to TypeScript
- Migrated all Flow files to TypeScript - Disabled 'dot-notation' ESLint rule conflicting with TypeScript - Use more default Prettier settings - Moved ESLint and Prettier config into package.json
1 parent bcaf152 commit 2812517

39 files changed

+1184
-1153
lines changed

.circleci/config.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ default config for macOS: &macos_defaults
2626
macos:
2727
xcode: '12.5.1'
2828

29-
3029
config for macOS (android): &macos_defaults_android
3130
<<: *defaults
3231
resource_class: 'medium'
@@ -143,13 +142,13 @@ jobs:
143142
name: Lint check
144143
command: yarn test:lint
145144

146-
"Test: flow":
145+
"Test: TypeScript":
147146
<<: *js_defaults
148147
steps:
149148
- *addWorkspace
150149
- run:
151-
name: Flow check
152-
command: yarn test:flow
150+
name: TypeScript check
151+
command: yarn test:ts
153152

154153
"Test: Android unit":
155154
<<: *android_defaults
@@ -322,7 +321,7 @@ workflows:
322321
- "Test: lint":
323322
requires:
324323
- "Setup environment"
325-
- "Test: flow":
324+
- "Test: TypeScript":
326325
requires:
327326
- "Setup environment"
328327
- "Test: Android unit":
@@ -331,11 +330,11 @@ workflows:
331330
- "Test: iOS e2e":
332331
requires:
333332
- "Test: lint"
334-
- "Test: flow"
333+
- "Test: TypeScript"
335334
- "Build: Android release apk":
336335
requires:
337336
- "Test: lint"
338-
- "Test: flow"
337+
- "Test: TypeScript"
339338
- "Test: Android unit"
340339
- "Test: Android e2e":
341340
requires:

.eslintrc

Lines changed: 0 additions & 17 deletions
This file was deleted.

.flowconfig

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ body:
2121
attributes:
2222
label: Version
2323
description: What version of `@react-native-async-storage/async-storage` are you using?
24-
placeholder: "Example: 1.15.9"
24+
placeholder: 'Example: 1.15.9'
2525
validations:
2626
required: true
2727
- type: checkboxes
2828
id: platforms
2929
attributes:
3030
label: What platforms are you seeing this issue on?
31-
description: "Select all that apply:"
31+
description: 'Select all that apply:'
3232
options:
3333
- label: Android
3434
- label: iOS

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77
jobs:
88
macos:
9-
name: "macOS"
9+
name: 'macOS'
1010
runs-on: macos-latest
1111
steps:
1212
- name: Set up Node.js
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
yarn test:e2e:macos
3636
windows:
37-
name: "Windows"
37+
name: 'Windows'
3838
runs-on: windows-latest
3939
steps:
4040
- name: Set up MSBuild

.github/workflows/stale.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
name: Mark stale issues and pull requests
22
on:
33
schedule:
4-
- cron: "30 1 * * *"
4+
- cron: '30 1 * * *'
55
jobs:
66
stale:
77
runs-on: ubuntu-latest
88
permissions:
99
issues: write
1010
pull-requests: write
1111
steps:
12-
- uses: actions/stale@v4
13-
with:
14-
repo-token: ${{ secrets.GITHUB_TOKEN }}
15-
stale-issue-message: 'This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.'
16-
stale-pr-message: 'This PR has been marked as stale due to inactivity. Please address any comments within 7 days or it will be closed.'
17-
exempt-issue-labels: 'help wanted :octocat:'
18-
exempt-pr-labels: 'WIP'
12+
- uses: actions/stale@v4
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
stale-issue-message: 'This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.'
16+
stale-pr-message: 'This PR has been marked as stale due to inactivity. Please address any comments within 7 days or it will be closed.'
17+
exempt-issue-labels: 'help wanted :octocat:'
18+
exempt-pr-labels: 'WIP'

.github/workflows/website-deployment.yml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,30 @@ name: Website Deployment
22
on:
33
push:
44
branches:
5-
- master
5+
- master
66
paths:
7-
- 'website/**'
7+
- 'website/**'
88

99
jobs:
1010
deploy:
1111
name: Deploy website
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v2
16-
- name: Cache/restore dependencies
17-
uses: actions/cache@v1
18-
id: cache
19-
with:
20-
path: ./website/node_modules
21-
key: website-${{ hashFiles('website/yarn.lock') }}
22-
- name: Install dependencies
23-
if: steps.cache.outputs.cache-hit != 'true'
24-
run: yarn install --frozen-lockfile --cwd ./website
25-
- name: Release
26-
working-directory: ./website
27-
run: |
28-
git config --global user.name ${{ secrets.GH_DEPLOY_NAME }}
29-
git config --global user.email ${{ secrets.GH_DEPLOY_EMAIL }}
30-
echo "machine github.com login ${{ secrets.GH_DEPLOY_NAME }} password ${{ secrets.GH_DEPLOY_TOKEN }}" > ~/.netrc
31-
GIT_USER=${{ secrets.GH_DEPLOY_NAME }} yarn run deploy
32-
33-
34-
15+
- uses: actions/checkout@v2
16+
- name: Cache/restore dependencies
17+
uses: actions/cache@v1
18+
id: cache
19+
with:
20+
path: ./website/node_modules
21+
key: website-${{ hashFiles('website/yarn.lock') }}
22+
- name: Install dependencies
23+
if: steps.cache.outputs.cache-hit != 'true'
24+
run: yarn install --frozen-lockfile --cwd ./website
25+
- name: Release
26+
working-directory: ./website
27+
run: |
28+
git config --global user.name ${{ secrets.GH_DEPLOY_NAME }}
29+
git config --global user.email ${{ secrets.GH_DEPLOY_EMAIL }}
30+
echo "machine github.com login ${{ secrets.GH_DEPLOY_NAME }} password ${{ secrets.GH_DEPLOY_TOKEN }}" > ~/.netrc
31+
GIT_USER=${{ secrets.GH_DEPLOY_NAME }} yarn run deploy

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ README.md
1010
babel.config.js
1111
.clang-format
1212
.eslintrc
13-
.flowconfig
1413
.watchmanconfig
1514
.npmrc
1615
.circleci

.prettierrc

Lines changed: 0 additions & 8 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 58 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,82 @@
11
# Contributing to React Native Async Storage
22

3-
Thank you for helping out with Async Storage!
4-
We'd like to make contributions as pleasent as possible, so here's a small guide of how we see it. Happy to hear your feedback about anything, so please let us know.
5-
3+
Thank you for helping out with Async Storage! We'd like to make contributions as
4+
pleasent as possible, so here's a small guide of how we see it. Happy to hear
5+
your feedback about anything, so please let us know.
66

77
## Tests
8-
We use `flow` for type check, `eslint` with `prettier` for linting/formatting, `jest/detox` for tests (unit and e2e). All tests are run on CircleCI for all opened pull requests, but you should use them locally when making changes.
98

10-
* `yarn test`: Run all tests, except for e2e (see note below).
11-
* `yarn test:lint`: Run `eslint` check.
12-
* `yarn test:flow`: Run `flow` type check.
13-
* `yarn test:e2e:<ios|android|macos>`: Runs e2e tests. Before you can run it, you should build the app that can be run, by using `yarn build:e2e:<ios|android|macos>`.
9+
We use TypeScript for type check, `eslint` with `prettier` for
10+
linting/formatting, `jest/detox` for tests (unit and e2e). All tests are run on
11+
CircleCI for all opened pull requests, but you should use them locally when
12+
making changes.
1413

14+
- `yarn test`: Run all tests, except for e2e (see note below).
15+
- `yarn test:lint`: Run `eslint` check.
16+
- `yarn test:ts`: Run `tsc` type check.
17+
- `yarn test:e2e:<ios|android|macos>`: Runs e2e tests. Before you can run it,
18+
you should build the app that can be run, by using
19+
`yarn build:e2e:<ios|android|macos>`.
1520

1621
## Sending a pull request
17-
When you're sending a pull request:
1822

19-
* Communication is a key. If you want fix/add something, please open new/find existing issue, so we can discuss it.
20-
* We prefer small pull requests focused on one change, as those are easier to test/check.
21-
* Please make sure that all tests are passing on your local machine.
22-
* Please make sure you've run formatters and linters locally.
23-
* In VS Code, you can press ⇧+Alt+F or ⇧⌥F to format the current file.
24-
* To format C++ and Objective-C files, make sure you have the [C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) installed.
25-
* To format JavaScript files, please install [Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode).
26-
* From the command line, you can run `yarn format:c` and `yarn format:js` to format C-based languages and JavaScript respectively. The first command requires that you've already installed [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html).
27-
* Follow the template when opening a PR.
23+
When you're sending a pull request:
2824

25+
- Communication is a key. If you want fix/add something, please open new/find
26+
existing issue, so we can discuss it.
27+
- We prefer small pull requests focused on one change, as those are easier to
28+
test/check.
29+
- Please make sure that all tests are passing on your local machine.
30+
- Please make sure you've run formatters and linters locally.
31+
- In VS Code, you can press ⇧+Alt+F or ⇧⌥F to format the current file.
32+
- To format C++ and Objective-C files, make sure you have the
33+
[C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
34+
installed.
35+
- To format JavaScript files, please install
36+
[Prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode).
37+
- From the command line, you can run `yarn format:c` and `yarn format:js` to
38+
format C-based languages and JavaScript respectively. The first command
39+
requires that you've already installed
40+
[ClangFormat](https://clang.llvm.org/docs/ClangFormat.html).
41+
- Follow the template when opening a PR.
2942

3043
## Commits and versioning
31-
All PRs are squashed into `master` branch and wrapped up in a single commit, following [conventional commit message](https://www.conventionalcommits.org/en/v1.0.0-beta.3). Combined with [semantic versioning](https://semver.org/), this allows us to have a frequent releases of the library.
3244

33-
*Note*: We don't force this convention on Pull Requests from contributors, but it's a clean way to see what type of changes are made, so feel free to follow it.
45+
All PRs are squashed into `master` branch and wrapped up in a single commit,
46+
following
47+
[conventional commit message](https://www.conventionalcommits.org/en/v1.0.0-beta.3).
48+
Combined with [semantic versioning](https://semver.org/), this allows us to have
49+
a frequent releases of the library.
3450

51+
_Note_: We don't force this convention on Pull Requests from contributors, but
52+
it's a clean way to see what type of changes are made, so feel free to follow
53+
it.
3554

3655
Most notably prefixes you'll see:
3756

38-
* **fix**: Bug fixes, triggers *patch* release
39-
* **feat**: New feature implemented, triggers *minor*
40-
* **chore**: Changes that are not affecting end user (CI config changes, scripts, ["grunt work"](https://stackoverflow.com/a/26944812/3510245))
41-
* **docs**: Documentation changes.
42-
* **perf**: A code change that improves performance.
43-
* **refactor**: A code change that neither fixes a bug nor adds a feature.
44-
* **test**: Adding missing tests or correcting existing tests.
45-
57+
- **fix**: Bug fixes, triggers _patch_ release
58+
- **feat**: New feature implemented, triggers _minor_
59+
- **chore**: Changes that are not affecting end user (CI config changes,
60+
scripts, ["grunt work"](https://stackoverflow.com/a/26944812/3510245))
61+
- **docs**: Documentation changes.
62+
- **perf**: A code change that improves performance.
63+
- **refactor**: A code change that neither fixes a bug nor adds a feature.
64+
- **test**: Adding missing tests or correcting existing tests.
4665

4766
## Release process
48-
We use [Semantic Release](http://semantic-release.org) to automatically release new versions of the library when changes are merged into `master` branch, which we plan to keep stable. Bug fixes take priority in the release order.
67+
68+
We use [Semantic Release](http://semantic-release.org) to automatically release
69+
new versions of the library when changes are merged into `master` branch, which
70+
we plan to keep stable. Bug fixes take priority in the release order.
4971

5072
## Reporting issues
51-
You can report issues on our [bug tracker](https://github.com/react-native-community/react-native-async-storage/issues). Please search for existing issues and follow the issue template when opening an one.
5273

74+
You can report issues on our
75+
[bug tracker](https://github.com/react-native-community/react-native-async-storage/issues).
76+
Please search for existing issues and follow the issue template when opening an
77+
one.
5378

5479
## License
55-
By contributing to React Native Async Storage, you agree that your contributions will be licensed under the **MIT** license.
80+
81+
By contributing to React Native Async Storage, you agree that your contributions
82+
will be licensed under the **MIT** license.

0 commit comments

Comments
 (0)