Skip to content

Commit 024a9a6

Browse files
Configure prettier. (and static checks) (#4)
- Add prettier - Format files with prettier - add static check to verify formatting and typechecks - configure dependabot --------- Co-authored-by: Adrian Czerwiec <adrian.czerwiec@swmansion.com>
1 parent 8207ad2 commit 024a9a6

23 files changed

+110
-69
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Please see the documentation for all configuration options:
2+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: "npm"
7+
directory: "/"
8+
schedule:
9+
interval: "weekly"
10+
day: "monday"
11+
groups:
12+
development-dependencies:
13+
dependency-type: "development"

.github/pull_request_template.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Description
2+
3+
Describe your changes in detail

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
path: build
4848
- name: Deploy to GitHub Pages
4949
id: deployment
50-
uses: actions/deploy-pages@v2
50+
uses: actions/deploy-pages@v2

.github/workflows/static_check.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Static checks
2+
on:
3+
pull_request:
4+
jobs:
5+
types_and_lint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: checkout
9+
uses: actions/checkout@v3
10+
- name: Install node dependencies
11+
run: yarn
12+
- name: Check formatting
13+
run: yarn format:check
14+
- name: Check types
15+
run: yarn typecheck

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build/*
2+
node_modules/*

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
2+
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
33
};

blog/authors.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ mironiasty:
33
title: Fullstack Engineer @ Software Mansion
44
url: https://github.com/mironiasty
55
image_url: https://github.com/mironiasty.png
6-
7-
8-

blog/tags.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ sdk:
77
label: SDK
88
permalink: /sdk
99
description: News about SDK
10-

docs/tutorial-basics/create-a-document.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Add metadata to customize the sidebar label and position:
3030

3131
```md title="docs/hello.md" {1-4}
3232
---
33-
sidebar_label: 'Hi!'
33+
sidebar_label: "Hi!"
3434
sidebar_position: 3
3535
---
3636

@@ -44,13 +44,13 @@ It is also possible to create your sidebar explicitly in `sidebars.js`:
4444
```js title="sidebars.js"
4545
export default {
4646
tutorialSidebar: [
47-
'intro',
47+
"intro",
4848
// highlight-next-line
49-
'hello',
49+
"hello",
5050
{
51-
type: 'category',
52-
label: 'Tutorial',
53-
items: ['tutorial-basics/create-a-document'],
51+
type: "category",
52+
label: "Tutorial",
53+
items: ["tutorial-basics/create-a-document"],
5454
},
5555
],
5656
};

docs/tutorial-basics/create-a-page.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Add **Markdown or React** files to `src/pages` to create a **standalone page**:
1515
Create a file at `src/pages/my-react-page.js`:
1616

1717
```jsx title="src/pages/my-react-page.js"
18-
import React from 'react';
19-
import Layout from '@theme/Layout';
18+
import React from "react";
19+
import Layout from "@theme/Layout";
2020

2121
export default function MyReactPage() {
2222
return (

docs/tutorial-basics/markdown-features.mdx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function HelloDocusaurus() {
6767
return <h1>Hello, Docusaurus!</h1>;
6868
}
6969
```
70-
````
70+
````
7171

7272
```jsx title="src/components/HelloDocusaurus.js"
7373
function HelloDocusaurus() {
@@ -131,18 +131,19 @@ This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !
131131
This is <Highlight color="#1877F2">Facebook blue</Highlight> !
132132
```
133133

134-
export const Highlight = ({children, color}) => (
134+
export const Highlight = ({ children, color }) => (
135135
<span
136136
style={{
137137
backgroundColor: color,
138-
borderRadius: '20px',
139-
color: '#fff',
140-
padding: '10px',
141-
cursor: 'pointer',
138+
borderRadius: "20px",
139+
color: "#fff",
140+
padding: "10px",
141+
cursor: "pointer",
142142
}}
143143
onClick={() => {
144144
alert(`You clicked the color ${color} with label ${children}`);
145-
}}>
145+
}}
146+
>
146147
{children}
147148
</span>
148149
);

docs/tutorial-extras/manage-docs-versions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default {
3434
items: [
3535
// highlight-start
3636
{
37-
type: 'docsVersionDropdown',
37+
type: "docsVersionDropdown",
3838
},
3939
// highlight-end
4040
],

docs/tutorial-extras/translate-your-site.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Modify `docusaurus.config.js` to add support for the `fr` locale:
1313
```js title="docusaurus.config.js"
1414
export default {
1515
i18n: {
16-
defaultLocale: 'en',
17-
locales: ['en', 'fr'],
16+
defaultLocale: "en",
17+
locales: ["en", "fr"],
1818
},
1919
};
2020
```
@@ -60,7 +60,7 @@ export default {
6060
items: [
6161
// highlight-start
6262
{
63-
type: 'localeDropdown',
63+
type: "localeDropdown",
6464
},
6565
// highlight-end
6666
],

docs/tutorial-react-native/_category_.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
"type": "generated-index",
66
"description": "How to integrate Fishjam Cloud into your React Nateive mobile app."
77
}
8-
}
8+
}

docs/tutorial-react-native/connecting.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@ This app comes with preconfigured test service called Room Manager. This is basi
1717
create Room, add your app as Room's Participant and return token required to use that Room.
1818

1919
To use that simply call `fetch`:
20+
2021
```ts
2122
const response = await fetch(
2223
`https://fishjam.io/api/v1/connect/*YOUR_ID*/room-manager/*ROOM_NAME*/users/*USER_NAME*`,
2324
);
2425

25-
const {url, token} = await response.json();
26+
const { url, token } = await response.json();
2627
```
2728

2829
## Connecting
2930

3031
In order to connect, you just need to call `connect` method with data from previous step:
3132

3233
```ts
33-
import { connect } from '@fishjam-cloud/react-native-client';
34-
34+
import { connect } from "@fishjam-cloud/react-native-client";
3535

3636
await connect(url, token);
3737
```
3838

3939
## Disconnecting
4040

41-
In order to close connection, you have to call `leaveRoom` method.
41+
In order to close connection, you have to call `leaveRoom` method.

docs/tutorial-react-native/list-other.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ sidebar_position: 4
44

55
# List other participants
66

7-
In order see other streaming participants, you can use `useParticipants`. It will return all
8-
other participants, together with track that they are streaming.
7+
In order see other streaming participants, you can use `useParticipants`. It will return all
8+
other participants, together with track that they are streaming.
99

1010
### Example code that show all videos
1111

12-
1312
```ts
1413
import { useParticipants, VideoRendererView } from '@fishjam-cloud/react-native-client';
1514

@@ -29,4 +28,4 @@ function Component() {
2928
</View>
3029
);
3130
}
32-
```
31+
```

docs/tutorial-react-native/start-streaming.mdx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ How to stream your camera
88

99
:::tip Enable devices before connecting
1010

11-
You can enable your camera and microphone before calling connect method.
11+
You can enable your camera and microphone before calling connect method.
1212
This way, you can show user camera preview. Once connect method is called,
1313
enabled camera and microphone will start streaming to Room.
1414

1515
:::
1616

17-
1817
## Enable your camera
1918

2019
First, you have to enable your camera by calling `startCamera` method.
@@ -39,20 +38,20 @@ function Component() {
3938
To list all cameras available on device, you can use `cameraList` property from `useCamera` hook.
4039
This way, you can either automatically choose camera (front/back) or allow user to select camera type.
4140

42-
To change camera, simply call `switchCamera` method.
41+
To change camera, simply call `switchCamera` method.
4342

4443
```ts
45-
const { cameraList, switchCamera, currentCamera } = useCamera();
46-
47-
const flipCamera = useCallback(() => {
48-
const camera =
49-
cameraList.find(
50-
(camera) => camera.facingDirection !== currentCamera?.facingDirection,
51-
) || null;
52-
if (camera) {
53-
switchCamera(camera.id);
54-
}
55-
}, [camerasList, currentCamera?.facingDirection, switchCamera]);
44+
const { cameraList, switchCamera, currentCamera } = useCamera();
45+
46+
const flipCamera = useCallback(() => {
47+
const camera =
48+
cameraList.find(
49+
(camera) => camera.facingDirection !== currentCamera?.facingDirection,
50+
) || null;
51+
if (camera) {
52+
switchCamera(camera.id);
53+
}
54+
}, [camerasList, currentCamera?.facingDirection, switchCamera]);
5655
```
5756

5857
### Disabling/enabling camera
@@ -67,7 +66,6 @@ const { isCameraOn, toggleCamera } = useCamera();
6766

6867
Microphone works similar to camera. In order to enable it, you have to call `toggleMicrophone` method.
6968

70-
7169
```ts
7270
const { isMicrophoneOn, toggleMicrophone } = useMicrophone();
73-
```
71+
```

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"serve": "docusaurus serve",
1313
"write-translations": "docusaurus write-translations",
1414
"write-heading-ids": "docusaurus write-heading-ids",
15-
"typecheck": "tsc"
15+
"typecheck": "tsc",
16+
"format": "prettier . --write",
17+
"format:check": "prettier . --check"
1618
},
1719
"dependencies": {
1820
"@docusaurus/core": "3.5.2",
@@ -27,6 +29,7 @@
2729
"@docusaurus/module-type-aliases": "3.5.2",
2830
"@docusaurus/tsconfig": "3.5.2",
2931
"@docusaurus/types": "3.5.2",
32+
"prettier": "^3.3.3",
3033
"typescript": "~5.5.2"
3134
},
3235
"browserslist": {

sidebars.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
1+
import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";
22

33
/**
44
* Creating a sidebar enables you to:
@@ -12,7 +12,7 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
1212
*/
1313
const sidebars: SidebarsConfig = {
1414
// By default, Docusaurus generates a sidebar from the docs folder structure
15-
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
15+
tutorialSidebar: [{ type: "autogenerated", dirName: "." }],
1616

1717
// But you can create a sidebar manually
1818
/*

src/components/HomepageFeatures/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const FeatureList: FeatureItem[] = [
1414
Svg: require("@site/static/img/fish-easy.svg").default,
1515
description: (
1616
<>
17-
Fishjam Cloud was designed from the ground up to be easily installed and used to get Video Streaming in your app
18-
up and running quickly.
17+
Fishjam Cloud was designed from the ground up to be easily installed and
18+
used to get Video Streaming in your app up and running quickly.
1919
</>
2020
),
2121
},
@@ -24,8 +24,8 @@ const FeatureList: FeatureItem[] = [
2424
Svg: require("@site/static/img/fish-focus.svg").default,
2525
description: (
2626
<>
27-
Fishjam Cloud lets you focus on your users, and we&apos;ll do all difficult work. Go ahead and check that
28-
streaming can be easy.
27+
Fishjam Cloud lets you focus on your users, and we&apos;ll do all
28+
difficult work. Go ahead and check that streaming can be easy.
2929
</>
3030
),
3131
},
@@ -34,7 +34,8 @@ const FeatureList: FeatureItem[] = [
3434
Svg: require("@site/static/img/fish-technology.svg").default,
3535
description: (
3636
<>
37-
Move fast with integrationg streaming into your app by simple installation process in Expo and React Native Apps
37+
Move fast with integrationg streaming into your app by simple
38+
installation process in Expo and React Native Apps
3839
</>
3940
),
4041
},

src/css/custom.css

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919

2020
/* For readability concerns, you should choose a lighter palette in dark mode. */
21-
[data-theme='dark'] {
21+
[data-theme="dark"] {
2222
--ifm-color-primary: #25c2a0;
2323
--ifm-color-primary-dark: #21af90;
2424
--ifm-color-primary-darker: #1fa588;
@@ -29,14 +29,13 @@
2929
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
3030
}
3131

32-
33-
html[data-theme='light'] footer.footer {
34-
background-color: #FCF4E4;
32+
html[data-theme="light"] footer.footer {
33+
background-color: #fcf4e4;
3534
}
36-
html[data-theme='light'] nav.navbar--fixed-top {
37-
background-color: #FCF4E4;
35+
html[data-theme="light"] nav.navbar--fixed-top {
36+
background-color: #fcf4e4;
3837
}
39-
html[data-theme='light'] header.heroBanner_src-pages-index-module{
40-
background-color: #9BDCFB;
38+
html[data-theme="light"] header.heroBanner_src-pages-index-module {
39+
background-color: #9bdcfb;
4140
color: #000;
42-
}
41+
}

0 commit comments

Comments
 (0)