Skip to content

🎥 Make videos programmatically with React

fix docs linting errors

Jonny Burger1749047d0797
diff --git a/packages/docs/components/3DPhone/Phone.tsx b/packages/docs/components/3DPhone/Phone.tsx
index 05e79c274a..ed50617838 100644
--- a/packages/docs/components/3DPhone/Phone.tsx
+++ b/packages/docs/components/3DPhone/Phone.tsx
@@ -1,7 +1,7 @@
import { useThree } from "@react-three/fiber";
import React, { useEffect, useMemo } from "react";
import { interpolate, spring, useCurrentFrame, useVideoConfig } from "remotion";
-import { VideoTexture } from "three";
+import type { VideoTexture } from "three";
import {
CAMERA_DISTANCE,
getPhoneLayout,
diff --git a/packages/docs/components/3DPhone/RoundedBox.tsx b/packages/docs/components/3DPhone/RoundedBox.tsx
index 798186f01f..e3c614cc83 100644
--- a/packages/docs/components/3DPhone/RoundedBox.tsx
+++ b/packages/docs/components/3DPhone/RoundedBox.tsx
@@ -13,7 +13,7 @@ export const RoundedBox: React.FC<Props> = ({
width,
height,
radius,
- curveSegments: curveSegments,
+ curveSegments,
children,
depth,
...otherProps
diff --git a/packages/docs/components/3DPhone/Scene.tsx b/packages/docs/components/3DPhone/Scene.tsx
index f44b5797ea..61112f5496 100644
--- a/packages/docs/components/3DPhone/Scene.tsx
+++ b/packages/docs/components/3DPhone/Scene.tsx
@@ -1,4 +1,5 @@
-import { getVideoMetadata, VideoMetadata } from "@remotion/media-utils";
+import type { VideoMetadata } from "@remotion/media-utils";
+import { getVideoMetadata } from "@remotion/media-utils";
import { ThreeCanvas, useVideoTexture } from "@remotion/three";
import React, { useEffect, useRef, useState } from "react";
import { AbsoluteFill, useVideoConfig, Video } from "remotion";
diff --git a/packages/docs/components/3DPhone/helpers/constants.ts b/packages/docs/components/3DPhone/helpers/constants.ts
index 7d1fc14852..c2994029b6 100644
--- a/packages/docs/components/3DPhone/helpers/constants.ts
+++ b/packages/docs/components/3DPhone/helpers/constants.ts
@@ -1,4 +1,4 @@
-import {Vector3} from '@react-three/fiber';
+import type {Vector3} from '@react-three/fiber';
// The distance from which the camera is pointing to the phone.
export const CAMERA_DISTANCE = 2.5;
@@ -23,6 +23,7 @@ const getPhoneHeight = (aspectRatio: number, baseScale: number): number => {
if (aspectRatio > 1) {
return baseScale;
}
+
return baseScale / aspectRatio;
};
@@ -30,6 +31,7 @@ const getPhoneWidth = (aspectRatio: number, baseScale: number): number => {
if (aspectRatio < 1) {
return baseScale;
}
+
return baseScale * aspectRatio;
};
diff --git a/packages/docs/components/3DPhonePlayer.tsx b/packages/docs/components/3DPhonePlayer.tsx
index d2eb30fad1..db2e1926b2 100644
--- a/packages/docs/components/3DPhonePlayer.tsx
+++ b/packages/docs/components/3DPhonePlayer.tsx
@@ -21,6 +21,6 @@ export const ThreeDPlayer: React.FC = () => {
videoSrc: phone,
baseScale: 1,
}}
- ></Player>
+ />
);
};
diff --git a/packages/docs/components/ColorDemo/RGBColors.tsx b/packages/docs/components/ColorDemo/RGBColors.tsx
index 2d17622fd6..78dfaf04e8 100644
--- a/packages/docs/components/ColorDemo/RGBColors.tsx
+++ b/packages/docs/components/ColorDemo/RGBColors.tsx
@@ -1,12 +1,7 @@
import { parseToRgb } from "polished";
import React from "react";
-import {
- interpolate,
- spring,
- useCurrentFrame,
- useVideoConfig,
-} from "remotion";
-import { defaultStyles } from './styles';
+import { interpolate, spring, useCurrentFrame, useVideoConfig } from "remotion";
+import { defaultStyles } from "./styles";
const BAR_SCALE_FACTOR = 1.5;
const TOP_PANEL = 100;
@@ -47,7 +42,7 @@ export const Colors: React.FC<{
}}
>
<div style={row}>
- {[parsed.red, parsed.green, parsed.blue].map((color, index) => {
+ {[parsed.red, parsed.green, parsed.blue].map((arrayColor, index) => {
const barProgress = spring({
fps,
frame: frame - index * 10,
@@ -57,7 +52,7 @@ export const Colors: React.FC<{
},
});
return (
- <div style={{ textAlign: "center" }}>
+ <div key={arrayColor} style={{ textAlign: "center" }}>
<div
style={{
height: TOP_PANEL,
@@ -69,19 +64,20 @@ export const Colors: React.FC<{
<span
style={{
opacity: barProgress,
- fontSize: 80
+ fontSize: 80,
}}
>
- {String(color)}
+ {String(arrayColor)}
</span>
</div>
<div
+ // eslint-disable-next-line react/no-array-index-key
key={index}
style={{
width: 250,
marginLeft: barMargin,
marginRight: barMargin,
- height: color * BAR_SCALE_FACTOR * barProgress,
+ height: arrayColor * BAR_SCALE_FACTOR * barProgress,
borderRadius: 10,
backgroundColor: rgb[index],
}}
diff --git a/packages/docs/components/ColorDemo/index.tsx b/packages/docs/components/ColorDemo/index.tsx
index ddecdb0680..3f4e0f52c1 100644
--- a/packages/docs/components/ColorDemo/index.tsx
+++ b/packages/docs/components/ColorDemo/index.tsx
@@ -38,6 +38,7 @@ export const ColorDemo: React.FC<{
</AbsoluteFill>
);
}
+
return (
<AbsoluteFill>
<Sequence from={0} durationInFrames={120}>
diff --git a/packages/docs/components/ColorDemo/styles.tsx b/packages/docs/components/ColorDemo/styles.tsx
index 53ea0a598f..68dfc52909 100644
--- a/packages/docs/components/ColorDemo/styles.tsx
+++ b/packages/docs/components/ColorDemo/styles.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import type React from "react";
export const defaultStyles: React.CSSProperties = {
display: "flex",
diff --git a/packages/docs/components/LandingPage/CodeExample.tsx b/packages/docs/components/LandingPage/CodeExample.tsx
index 5fe10f963e..1a19ec5366 100644
--- a/packages/docs/components/LandingPage/CodeExample.tsx
+++ b/packages/docs/components/LandingPage/CodeExample.tsx
@@ -40,7 +40,7 @@ const Preview: React.FC = () => {
style={container}
controls
fps={30}
- ></Player>
+ />
);
};
@@ -60,6 +60,7 @@ export const CodeExample: React.FC = () => {
return (
<div style={{ flex: 1, textAlign: "left", maxWidth: 500 }}>
<button
+ type="button"
style={{ ...tabStyle, opacity: tab === "code" ? 1 : 0.5 }}
onClick={() => setTab("code")}
>
@@ -67,6 +68,7 @@ export const CodeExample: React.FC = () => {
</button>
|
<button
+ type="button"
style={{ ...tabStyle, opacity: tab === "preview" ? 1 : 0.5 }}
onClick={() => setTab("preview")}
>
@@ -75,10 +77,10 @@ export const CodeExample: React.FC = () => {
<div>
{tab === "code" && (
<div style={container}>
- <img src="/img/code-sample.png"></img>
+ <img src="/img/code-sample.png" />
</div>
)}
- {tab === "preview" && <Preview></Preview>}
+ {tab === "preview" && <Preview />}
</div>
</div>
);
diff --git a/packages/docs/components/LandingPage/editor.tsx b/packages/docs/components/LandingPage/editor.tsx
index a23e9ca22b..a47e1f3dca 100644
--- a/packages/docs/components/LandingPage/editor.tsx
+++ b/packages/docs/components/LandingPage/editor.tsx
@@ -29,7 +29,7 @@ export const LightningFastEditor: React.FC = () => {
observer.observe(current);
return () => observer.unobserve(current);
- }, []);
+ }, [callback]);
return (
<div ref={ref} className={styles.row}>
<div>
diff --git a/packages/docs/components/PeriodSelector.tsx b/packages/docs/components/PeriodSelector.tsx
index fb3f5bca62..1edd1538bd 100644
--- a/packages/docs/components/PeriodSelector.tsx
+++ b/packages/docs/components/PeriodSelector.tsx
@@ -11,7 +11,7 @@ export const PeriodSelector: React.FC<{
setPeriod: (per: Period) => void;
}> = ({ period, setPeriod }) => {
const MonthlyComponent = period === Period.Monthly ? BlueButton : ClearButton;
- const YearlyComponent = period !== Period.Monthly ? BlueButton : ClearButton;
+ const YearlyComponent = period === Period.Monthly ? ClearButton : BlueButton;
return (
<div
diff --git a/packages/docs/components/PlayerExample.tsx b/packages/docs/components/PlayerExample.tsx
index 2edc24f67b..b964fbe99f 100644
--- a/packages/docs/components/PlayerExample.tsx
+++ b/packages/docs/components/PlayerExample.tsx
@@ -2,7 +2,8 @@ import { useEffect } from "react";
import { useState } from "react";
import { useRef } from "react";
import { useCallback } from "react";
-import { Player, PlayerRef } from "@remotion/player";
+import type { PlayerRef } from "@remotion/player";
+import { Player } from "@remotion/player";
import React from "react";
import { ColorDemo } from "./ColorDemo";
import "./input-fields.css";
diff --git a/packages/docs/components/TextInput.tsx b/packages/docs/components/TextInput.tsx
index ee95f795a2..85aa6c5006 100644
--- a/packages/docs/components/TextInput.tsx
+++ b/packages/docs/components/TextInput.tsx
@@ -1,4 +1,5 @@
-import React, { DetailedHTMLProps, useCallback, useState } from "react";
+import type { DetailedHTMLProps} from "react";
+import React, { useCallback, useState } from "react";
const LIGHT_BLUE = "#42e9f5";
const DARK_BLUE = "#4290f5";
diff --git a/packages/docs/components/TransparentVideoDemo.tsx b/packages/docs/components/TransparentVideoDemo.tsx
index 7dc984d40c..2f40610a52 100644
--- a/packages/docs/components/TransparentVideoDemo.tsx
+++ b/packages/docs/components/TransparentVideoDemo.tsx
@@ -14,9 +14,9 @@ export const TransparentVideoDemo: React.FC = () => {
controls
autoPlay
loop
- ></video>
+ />
<p className="tr-centered" onClick={onClick}>
- <button>Toggle transparency</button>
+ <button type="button">Toggle transparency</button>
</p>
</div>
);
diff --git a/packages/docs/components/layout/Button.tsx b/packages/docs/components/layout/Button.tsx
index aaa6bea4a3..f29420883c 100644
--- a/packages/docs/components/layout/Button.tsx
+++ b/packages/docs/components/layout/Button.tsx
@@ -1,5 +1,6 @@
import { opacify } from "polished";
-import React, { ButtonHTMLAttributes, DetailedHTMLProps } from "react";
+import type { ButtonHTMLAttributes, DetailedHTMLProps } from "react";
+import React from "react";
import styles from "./button.module.css";
import { RED, UNDERLAY_RED } from "./colors";
diff --git a/packages/docs/package.json b/packages/docs/package.json
index a5b1e3dd80..63068876ae 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -11,7 +11,7 @@
"deploy": "docusaurus deploy",
"serve": "docusaurus serve",
"clear": "docusaurus clear",
- "lint": "eslint src",
+ "lint": "eslint src && eslint components",
"test": "jest"
},
"dependencies": {