Skip to content

Commit 0595e35

Browse files
authored
ci: add formatting job (#1038)
1 parent 5354ad0 commit 0595e35

File tree

14 files changed

+150
-121
lines changed

14 files changed

+150
-121
lines changed

Diff for: .config/tsconfig.base.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"exclude": [
3-
"../node_modules"
4-
],
2+
"exclude": ["../node_modules"],
53
"compilerOptions": {
64
"noFallthroughCasesInSwitch": true,
75
"noImplicitAny": true,

Diff for: .github/ISSUE_TEMPLATE/bug_report.yml

+2-2
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

Diff for: .github/workflows/ci.yml

+19-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ on:
55
- main
66
pull_request:
77
jobs:
8+
format:
9+
name: Format
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Set up Node.js
15+
uses: actions/[email protected]
16+
with:
17+
node-version: 18.16.1
18+
cache: yarn
19+
- name: Install JS dependencies
20+
run: yarn
21+
- name: Format
22+
run: |
23+
yarn format
24+
git diff --exit-code
825
review:
926
name: Review
1027
runs-on: ubuntu-latest
@@ -150,7 +167,7 @@ jobs:
150167

151168
release:
152169
name: Release
153-
needs: [review, android, ios, macos, windows]
170+
needs: [format, review, android, ios, macos, windows]
154171
if: github.event_name == 'push'
155172
runs-on: ubuntu-22.04
156173
steps:
@@ -170,7 +187,7 @@ jobs:
170187
env:
171188
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
172189
GIT_AUTHOR_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
173-
GIT_AUTHOR_NAME : ${{ secrets.GH_BOT_NAME }}
190+
GIT_AUTHOR_NAME: ${{ secrets.GH_BOT_NAME }}
174191
GIT_COMMITTER_EMAIL: ${{ secrets.GH_BOT_EMAIL }}
175192
GIT_COMMITTER_NAME: ${{ secrets.GH_BOT_NAME }}
176193
NPM_TOKEN: ${{ secrets.NPM_RELEASE_TOKEN }}

Diff for: .github/workflows/stale.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/stale@v7
1313
with:
1414
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'
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"

Diff for: .github/workflows/website-deployment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches:
55
- main
66
paths:
7-
- 'packages/website/**'
7+
- "packages/website/**"
88

99
jobs:
1010
deploy:

Diff for: package.json

+6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
"packages/*"
66
],
77
"packageManager": "[email protected]",
8+
"scripts": {
9+
"format": "concurrently 'yarn:format:*'",
10+
"format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm') --style file:.config/.clang-format",
11+
"format:js": "prettier --write --loglevel error $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')"
12+
},
813
"devDependencies": {
14+
"concurrently": "^8.2.2",
915
"eslint": "^8.54.0",
1016
"prettier": "^2.8.8",
1117
"typescript": "^5.3.0"

Diff for: packages/api/example/ExampleStorage.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ type MyModel = StorageModel<{
88
likes: boolean[];
99
}>;
1010

11-
export class ExampleStorage implements AsyncStorage<MyModel, MyExampleExtension> {
11+
export class ExampleStorage
12+
implements AsyncStorage<MyModel, MyExampleExtension>
13+
{
1214
private storage: MyModel = {
1315
age: null,
1416
name: null,

Diff for: packages/api/jest.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
module.exports = {
3-
preset: 'ts-jest',
4-
testEnvironment: 'node',
3+
preset: "ts-jest",
4+
testEnvironment: "node",
55
};

Diff for: packages/default-storage/package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
"directory": "packages/default-storage-backend"
3939
},
4040
"scripts": {
41-
"format": "concurrently 'yarn:format:*'",
42-
"format:c": "clang-format -i $(git ls-files '*.cpp' '*.h' '*.m' '*.mm') --style file:../../.config/.clang-format",
43-
"format:js": "prettier --write $(git ls-files '*.js' '*.json' '*.ts' '*.tsx' '*.yml' 'README.md')",
4441
"prepare": "bob build",
4542
"start": "react-native start",
4643
"start:android": "react-native run-android",
@@ -86,7 +83,7 @@
8683
"appium": "2.2.2",
8784
"appium-uiautomator2-driver": "^2.34.1",
8885
"appium-xcuitest-driver": "^5.9.1",
89-
"concurrently": "^6.4.0",
86+
"concurrently": "^8.2.2",
9087
"eslint": "^8.54.0",
9188
"expo": "^48.0.0",
9289
"lodash": "^4.17.21",

Diff for: packages/website/docusaurus.config.js

+36-36
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
module.exports = {
2-
title: 'Async Storage',
3-
tagline: 'Data storage system for React Native.',
4-
url: 'https://react-native-async-storage.github.io',
5-
baseUrl: '/async-storage/',
6-
favicon: 'img/favicon.ico',
7-
organizationName: 'react-native-async-storage',
8-
projectName: 'async-storage',
2+
title: "Async Storage",
3+
tagline: "Data storage system for React Native.",
4+
url: "https://react-native-async-storage.github.io",
5+
baseUrl: "/async-storage/",
6+
favicon: "img/favicon.ico",
7+
organizationName: "react-native-async-storage",
8+
projectName: "async-storage",
99
themeConfig: {
1010
prism: {
11-
theme: require('prism-react-renderer/themes/vsDark'),
12-
darkTheme: require('prism-react-renderer/themes/vsDark'),
13-
lightTheme: require('prism-react-renderer/themes/vsLight'),
11+
theme: require("prism-react-renderer/themes/vsDark"),
12+
darkTheme: require("prism-react-renderer/themes/vsDark"),
13+
lightTheme: require("prism-react-renderer/themes/vsLight"),
1414
},
1515
navbar: {
16-
title: 'Async Storage',
16+
title: "Async Storage",
1717
logo: {
18-
alt: 'Async Storage Logo',
19-
src: 'img/logo.svg',
18+
alt: "Async Storage Logo",
19+
src: "img/logo.svg",
2020
},
2121
items: [
2222
{
23-
label: 'Docs',
24-
to: 'docs/install',
25-
activeBasePath: '/docs',
26-
position: 'right',
23+
label: "Docs",
24+
to: "docs/install",
25+
activeBasePath: "/docs",
26+
position: "right",
2727
},
2828
{
29-
href: 'https://github.com/react-native-async-storage/async-storage',
30-
label: 'GitHub',
31-
position: 'right',
29+
href: "https://github.com/react-native-async-storage/async-storage",
30+
label: "GitHub",
31+
position: "right",
3232
},
3333
],
3434
},
3535
footer: {
36-
style: 'dark',
36+
style: "dark",
3737
links: [
3838
{
39-
title: 'Documentation',
39+
title: "Documentation",
4040
items: [
4141
{
42-
label: 'Installation',
43-
to: 'docs/install',
42+
label: "Installation",
43+
to: "docs/install",
4444
},
4545
{
46-
label: 'API reference',
47-
to: 'docs/api',
46+
label: "API reference",
47+
to: "docs/api",
4848
},
4949
],
5050
},
5151
{
52-
title: 'Community',
52+
title: "Community",
5353
items: [
5454
{
55-
label: 'Discord',
56-
href: 'https://discord.gg/PycDts2',
55+
label: "Discord",
56+
href: "https://discord.gg/PycDts2",
5757
},
5858
],
5959
},
6060
{
61-
title: 'More',
61+
title: "More",
6262
items: [
6363
{
64-
label: 'GitHub',
65-
href: 'https://github.com/react-native-async-storage/async-storage',
64+
label: "GitHub",
65+
href: "https://github.com/react-native-async-storage/async-storage",
6666
},
6767
],
6868
},
@@ -72,15 +72,15 @@ module.exports = {
7272
},
7373
presets: [
7474
[
75-
'@docusaurus/preset-classic',
75+
"@docusaurus/preset-classic",
7676
{
7777
docs: {
78-
sidebarPath: require.resolve('./sidebars.js'),
78+
sidebarPath: require.resolve("./sidebars.js"),
7979
editUrl:
80-
'https://github.com/react-native-async-storage/async-storage/edit/main/website/',
80+
"https://github.com/react-native-async-storage/async-storage/edit/main/website/",
8181
},
8282
theme: {
83-
customCss: require.resolve('./src/css/custom.css'),
83+
customCss: require.resolve("./src/css/custom.css"),
8484
},
8585
},
8686
],

Diff for: packages/website/sidebars.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
module.exports = {
22
docs: {
3-
'Getting started': ['install', 'usage', 'api', 'limits'],
4-
Advanced: ['advanced/next', 'advanced/jest', 'advanced/brownfield', 'advanced/backup', 'advanced/executor', 'advanced/db_size','advanced/where_data_stored'],
5-
Debugging: ['debugging/communityPackages'],
6-
Help: ['help/troubleshooting'],
3+
"Getting started": ["install", "usage", "api", "limits"],
4+
Advanced: [
5+
"advanced/next",
6+
"advanced/jest",
7+
"advanced/brownfield",
8+
"advanced/backup",
9+
"advanced/executor",
10+
"advanced/db_size",
11+
"advanced/where_data_stored",
12+
],
13+
Debugging: ["debugging/communityPackages"],
14+
Help: ["help/troubleshooting"],
715
},
816
};

Diff for: packages/website/src/components/Platform.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const PlatformSupport = ({ platformIcon, title }) => (
66
display: "flex",
77
margin: "10px 20px",
88
alignItems: "center",
9-
flexDirection: "row"
9+
flexDirection: "row",
1010
}}
1111
>
1212
<img

0 commit comments

Comments
 (0)