Skip to content

🎥 Make videos programmatically with React

updated formatting

Jonny Burger0f65936aa53f
diff --git a/packages/astro-example/src/components/Counter.tsx b/packages/astro-example/src/components/Counter.tsx
index a1a54e0f03..90a3c33bae 100644
--- a/packages/astro-example/src/components/Counter.tsx
+++ b/packages/astro-example/src/components/Counter.tsx
@@ -1,31 +1,31 @@
-import "./Counter.css";
-import { Player } from "@remotion/player";
-import { Gif } from "@remotion/gif";
+import {Gif} from '@remotion/gif';
+import {Player} from '@remotion/player';
+import './Counter.css';
const Comp: React.FC = () => {
- return (
- <div>
- <Gif
- src="https://media.giphy.com/media/xT0GqH01ZyKwd3aT3G/giphy.gif"
- fit="cover"
- height={200}
- width={200}
- />
- </div>
- );
+ return (
+ <div>
+ <Gif
+ src="https://media.giphy.com/media/xT0GqH01ZyKwd3aT3G/giphy.gif"
+ fit="cover"
+ height={200}
+ width={200}
+ />
+ </div>
+ );
};
export default function Counter() {
- return (
- <>
- <Player
- component={Comp}
- durationInFrames={100}
- compositionWidth={400}
- compositionHeight={400}
- fps={30}
- controls
- ></Player>
- </>
- );
+ return (
+ <>
+ <Player
+ component={Comp}
+ durationInFrames={100}
+ compositionWidth={400}
+ compositionHeight={400}
+ fps={30}
+ controls
+ ></Player>
+ </>
+ );
}
diff --git a/packages/bundler/src/index.ts b/packages/bundler/src/index.ts
index c40e120c0f..e9e7286d87 100644
--- a/packages/bundler/src/index.ts
+++ b/packages/bundler/src/index.ts
@@ -20,10 +20,10 @@ export const BundlerInternals = {
export type {GitSource} from '@remotion/studio-shared';
export {
+ bundle,
BundleOptions,
LegacyBundleOptions,
MandatoryLegacyBundleOptions,
- bundle,
} from './bundle';
export {WebpackConfiguration, WebpackOverrideFn} from './webpack-config';
export {webpack};
diff --git a/packages/cli/src/render-queue/process-video.ts b/packages/cli/src/render-queue/process-video.ts
index 8194e44d91..de5df5890f 100644
--- a/packages/cli/src/render-queue/process-video.ts
+++ b/packages/cli/src/render-queue/process-video.ts
@@ -77,8 +77,8 @@ export const processVideoJob = async ({
muted: job.type === 'video' ? job.muted : true,
enforceAudioTrack: job.type === 'video' ? job.enforceAudioTrack : false,
proResProfile:
- job.type === 'video' ? job.proResProfile ?? undefined : undefined,
- x264Preset: job.type === 'video' ? job.x264Preset ?? null : null,
+ job.type === 'video' ? (job.proResProfile ?? undefined) : undefined,
+ x264Preset: job.type === 'video' ? (job.x264Preset ?? null) : null,
pixelFormat: job.type === 'video' ? job.pixelFormat : 'yuv420p',
videoBitrate: job.type === 'video' ? job.videoBitrate : null,
encodingBufferSize: job.type === 'video' ? job.encodingBufferSize : null,
diff --git a/packages/cloudrun/src/api/get-buckets.ts b/packages/cloudrun/src/api/get-buckets.ts
index a66b20020e..63b17be995 100644
--- a/packages/cloudrun/src/api/get-buckets.ts
+++ b/packages/cloudrun/src/api/get-buckets.ts
@@ -19,8 +19,8 @@ export const getRemotionStorageBuckets = async (
return {remotionBuckets: []};
}
- let remotionBuckets = buckets.filter(
- (b) => b.name?.startsWith(REMOTION_BUCKET_PREFIX),
+ let remotionBuckets = buckets.filter((b) =>
+ b.name?.startsWith(REMOTION_BUCKET_PREFIX),
);
if (region !== 'all regions') {
diff --git a/packages/cloudrun/src/api/upload-dir.ts b/packages/cloudrun/src/api/upload-dir.ts
index 8f48ceb2d5..1c5ae6b0ef 100644
--- a/packages/cloudrun/src/api/upload-dir.ts
+++ b/packages/cloudrun/src/api/upload-dir.ts
@@ -73,7 +73,7 @@ export const uploadDir = async ({
name: res,
size,
},
- ];
+ ];
}),
);
return _files.flat(1);
diff --git a/packages/cloudrun/src/cli/commands/services/index.ts b/packages/cloudrun/src/cli/commands/services/index.ts
index b6e0e27dc8..cb65591230 100644
--- a/packages/cloudrun/src/cli/commands/services/index.ts
+++ b/packages/cloudrun/src/cli/commands/services/index.ts
@@ -4,10 +4,10 @@ import type {ServiceInfo} from '../../../api/get-service-info';
import {BINARY_NAME} from '../../../shared/constants';
import {quit} from '../../helpers/quit';
import {Log} from '../../log';
-import {cloudRunDeploySubcommand, CLOUD_RUN_DEPLOY_SUBCOMMAND} from './deploy';
-import {servicesLsCommand, SERVICES_LS_SUBCOMMAND} from './ls';
-import {servicesRmCommand, SERVICES_RM_SUBCOMMAND} from './rm';
-import {servicesRmallCommand, SERVICES_RMALL_SUBCOMMAND} from './rmall';
+import {CLOUD_RUN_DEPLOY_SUBCOMMAND, cloudRunDeploySubcommand} from './deploy';
+import {SERVICES_LS_SUBCOMMAND, servicesLsCommand} from './ls';
+import {SERVICES_RM_SUBCOMMAND, servicesRmCommand} from './rm';
+import {SERVICES_RMALL_SUBCOMMAND, servicesRmallCommand} from './rmall';
export const SERVICES_COMMAND = 'services';
diff --git a/packages/cloudrun/src/client.ts b/packages/cloudrun/src/client.ts
index db7fb63bcc..4c2fc96400 100644
--- a/packages/cloudrun/src/client.ts
+++ b/packages/cloudrun/src/client.ts
@@ -6,11 +6,11 @@ export {getServiceInfo} from './api/get-service-info';
export {getServices} from './api/get-services';
export {getSites} from './api/get-sites';
export {
- renderMediaOnCloudrun,
RenderMediaOnCloudrunInput,
+ renderMediaOnCloudrun,
} from './api/render-media-on-cloudrun';
export {
- renderStillOnCloudrun,
RenderStillOnCloudrunInput,
+ renderStillOnCloudrun,
} from './api/render-still-on-cloudrun';
export {speculateServiceName} from './api/speculate-service-name';
diff --git a/packages/cloudrun/src/index.ts b/packages/cloudrun/src/index.ts
index 06b29bd4ae..dc5411da85 100644
--- a/packages/cloudrun/src/index.ts
+++ b/packages/cloudrun/src/index.ts
@@ -37,24 +37,24 @@ const getSites = deprecatedGetSites;
export {
CloudrunInternals,
+ deleteService,
+ deleteSite,
deployService,
deploySite,
- deleteSite,
- deleteService,
- getServices,
getOrCreateBucket,
- renderMediaOnCloudrun,
- renderStillOnCloudrun,
- getServiceInfo,
getRegions,
+ getServiceInfo,
+ getServices,
getSites,
+ renderMediaOnCloudrun,
+ renderStillOnCloudrun,
speculateServiceName,
testPermissions,
};
export type {
- GcpRegion,
DeployServiceInput,
DeployServiceOutput,
- RenderMediaOnCloudrunOutput,
+ GcpRegion,
RenderMediaOnCloudrunInput,
+ RenderMediaOnCloudrunOutput,
};
diff --git a/packages/core/src/CompositionManager.tsx b/packages/core/src/CompositionManager.tsx
index 24ebe63ebb..80db426080 100644
--- a/packages/core/src/CompositionManager.tsx
+++ b/packages/core/src/CompositionManager.tsx
@@ -233,15 +233,11 @@ export const CompositionManagerProvider: React.FC<{
[],
);
- useImperativeHandle(
- compositionsRef,
- () => {
- return {
- getCompositions: () => currentcompositionsRef.current,
- };
- },
- [],
- );
+ useImperativeHandle(compositionsRef, () => {
+ return {
+ getCompositions: () => currentcompositionsRef.current,
+ };
+ }, []);
const composition = compositions.find((c) =>
canvasContent?.type === 'composition'
diff --git a/packages/core/src/EditorProps.tsx b/packages/core/src/EditorProps.tsx
index b13cee8717..0ae8da11e4 100644
--- a/packages/core/src/EditorProps.tsx
+++ b/packages/core/src/EditorProps.tsx
@@ -67,16 +67,12 @@ export const EditorPropsProvider: React.FC<{
setProps({});
}, []);
- useImperativeHandle(
- editorPropsProviderRef,
- () => {
- return {
- getProps: () => props,
- setProps,
- };
- },
- [props],
- );
+ useImperativeHandle(editorPropsProviderRef, () => {
+ return {
+ getProps: () => props,
+ setProps,
+ };
+ }, [props]);
const ctx = useMemo((): EditorPropsContextType => {
return {props, updateProps, resetUnsaved};
diff --git a/packages/core/src/Img.tsx b/packages/core/src/Img.tsx
index 6930e3a122..d19b709e2f 100644
--- a/packages/core/src/Img.tsx
+++ b/packages/core/src/Img.tsx
@@ -56,13 +56,9 @@ const ImgRefForwarding: React.ForwardRefRenderFunction<
throw new Error('No "src" prop was passed to <Img>.');
}
- useImperativeHandle(
- ref,
- () => {
- return imageRef.current as HTMLImageElement;
- },
- [],
- );
+ useImperativeHandle(ref, () => {
+ return imageRef.current as HTMLImageElement;
+ }, []);
const actualSrc = usePreload(src as string);
diff --git a/packages/core/src/ResolveCompositionConfig.tsx b/packages/core/src/ResolveCompositionConfig.tsx
index 60b5fe062c..9dfb50fbbc 100644
--- a/packages/core/src/ResolveCompositionConfig.tsx
+++ b/packages/core/src/ResolveCompositionConfig.tsx
@@ -87,7 +87,7 @@ export const ResolveCompositionConfig: React.FC<
const inputProps = useMemo(() => {
return typeof window === 'undefined' || getRemotionEnvironment().isPlayer
? {}
- : getInputProps() ?? {};
+ : (getInputProps() ?? {});
}, []);
const [resolvedConfigs, setResolvedConfigs] = useState<
@@ -96,13 +96,13 @@ export const ResolveCompositionConfig: React.FC<
const selectedEditorProps = useMemo(() => {
return selectedComposition
- ? allEditorProps[selectedComposition.id] ?? {}
+ ? (allEditorProps[selectedComposition.id] ?? {})
: {};
}, [allEditorProps, selectedComposition]);
const renderModalProps = useMemo(() => {
return renderModalComposition
- ? allEditorProps[renderModalComposition.id] ?? {}
+ ? (allEditorProps[renderModalComposition.id] ?? {})
: {};
}, [allEditorProps, renderModalComposition]);
@@ -230,61 +230,57 @@ export const ResolveCompositionConfig: React.FC<
const currentComposition =
canvasContent?.type === 'composition' ? canvasContent.compositionId : null;
- useImperativeHandle(
- resolveCompositionsRef,
- () => {
- return {
- setCurrentRenderModalComposition: (id: string | null) => {
- setCurrentRenderModalComposition(id);
- },
- reloadCurrentlySelectedComposition: () => {
- if (!currentComposition) {
- return;
- }
-
- const composition = compositions.find(
- (c) => c.id === currentComposition,
+ useImperativeHandle(resolveCompositionsRef, () => {
+ return {
+ setCurrentRenderModalComposition: (id: string | null) => {
+ setCurrentRenderModalComposition(id);
+ },
+ reloadCurrentlySelectedComposition: () => {
+ if (!currentComposition) {
+ return;
+ }
+
+ const composition = compositions.find(
+ (c) => c.id === currentComposition,
+ );
+
+ if (!composition) {
+ throw new Error(
+ `Could not find composition with id ${currentComposition}`,
);
+ }
- if (!composition) {
- throw new Error(
- `Could not find composition with id ${currentComposition}`,
- );
- }
-
- const editorProps = allEditorProps[currentComposition] ?? {};
+ const editorProps = allEditorProps[currentComposition] ?? {};
- const defaultProps = {
- ...(composition.defaultProps ?? {}),
- ...(editorProps ?? {}),
- };
+ const defaultProps = {
+ ...(composition.defaultProps ?? {}),
+ ...(editorProps ?? {}),
+ };
- const props = {
- ...defaultProps,
- ...(inputProps ?? {}),
- };
+ const props = {
+ ...defaultProps,
+ ...(inputProps ?? {}),
+ };
- doResolution({
- defaultProps,
- calculateMetadata: composition.calculateMetadata,
- combinedProps: props,
- compositionDurationInFrames: composition.durationInFrames ?? null,
- compositionFps: composition.fps ?? null,
- compositionHeight: composition.height ?? null,
- compositionWidth: composition.width ?? null,
- compositionId: composition.id,
- });
- },
- };
- },
- [
- allEditorProps,
- compositions,
- currentComposition,
- doResolution,
- inputProps,
- ],
- );
+ doResolution({
+ defaultProps,
+ calculateMetadata: composition.calculateMetadata,
+ combinedProps: props,
+ compositionDurationInFrames: composition.durationInFrames ?? null,
+ compositionFps: composition.fps ?? null,
+ compositionHeight: composition.height ?? null,
+ compositionWidth: composition.width ?? null,
+ compositionId: composition.id,
+ });
+ },
+ };
+ }, [
+ allEditorProps,
+ compositions,
+ currentComposition,
+ doResolution,
+ inputProps,
+ ]);
const isTheSame = selectedComposition?.id === renderModalComposition?.id;
@@ -435,7 +431,7 @@ export const useResolvedVideoConfig = (
const composition = compositions.find((c) => c.id === compositionId);
const selectedEditorProps = useMemo(() => {
- return composition ? allEditorProps[composition.id] ?? {} : {};
+ return composition ? (allEditorProps[composition.id] ?? {}) : {};
}, [allEditorProps, composition]);
return useMemo(() => {
@@ -491,7 +487,7 @@ export const useResolvedVideoConfig = (
...(typeof window === 'undefined' ||
getRemotionEnvironment().isPlayer
? {}
- : getInputProps() ?? {}),
+ : (getInputProps() ?? {})),
},
defaultCodec: null,
},
diff --git a/packages/core/src/Sequence.tsx b/packages/core/src/Sequence.tsx
index 9c1701de40..5da2a6cf78 100644
--- a/packages/core/src/Sequence.tsx
+++ b/packages/core/src/Sequence.tsx
@@ -291,7 +291,7 @@ const PremountedSequenceRefForwardingFunction: React.ForwardRefRenderFunction<
opacity: premountingActive ? 0 : 1,
pointerEvents: premountingActive
? 'none'
- : passedStyle?.pointerEvents ?? undefined,
+ : (passedStyle?.pointerEvents ?? undefined),
};
}, [premountingActive, passedStyle]);
diff --git a/packages/core/src/audio/AudioForPreview.tsx b/packages/core/src/audio/AudioForPreview.tsx
index 1f30dc8e75..7eb64843ee 100644
--- a/packages/core/src/audio/AudioForPreview.tsx
+++ b/packages/core/src/audio/AudioForPreview.tsx
@@ -177,13 +177,9 @@ const AudioForDevelopmentForwardRefFunction: React.ForwardRefRenderFunction<
onAutoPlayError: null,
});
- useImperativeHandle(
- ref,
- () => {
- return audioRef.current as HTMLAudioElement;
- },
- [audioRef],
- );
+ useImperativeHandle(ref, () => {
+ return audioRef.current as HTMLAudioElement;
+ }, [audioRef]);
const currentOnDurationCallback =
useRef<AudioForPreviewProps['onDuration']>();
diff --git a/packages/core/src/audio/AudioForRendering.tsx b/packages/core/src/audio/AudioForRendering.tsx
index 0ebcd18562..3125f97db3 100644
--- a/packages/core/src/audio/AudioForRendering.tsx
+++ b/packages/core/src/audio/AudioForRendering.tsx
@@ -78,13 +78,9 @@ const AudioForRenderingRefForwardingFunction: React.ForwardRefRenderFunction<
allowAmplificationDuringRender: allowAmplificationDuringRender ?? false,
});
- useImperativeHandle(
- ref,
- () => {
- return audioRef.current as HTMLVideoElement;
- },
- [],
- );
+ useImperativeHandle(ref, () => {
+ return audioRef.current as HTMLVideoElement;
+ }, []);
useEffect(() => {
if (!props.src) {
diff --git a/packages/core/src/delay-render.ts b/packages/core/src/delay-render.ts
index a6e58c48aa..4c0e8be573 100644
--- a/packages/core/src/delay-render.ts
+++ b/packages/core/src/delay-render.ts
@@ -49,7 +49,7 @@ export const delayRender = (
(options?.timeoutInMilliseconds ??
(typeof window === 'undefined'
? defaultTimeout
- : window.remotion_puppeteerTimeout ?? defaultTimeout)) - 2000;
+ : (window.remotion_puppeteerTimeout ?? defaultTimeout))) - 2000;
if (typeof window !== 'undefined') {
const retriesLeft =
(options?.retries ?? 0) - (window.remotion_attempt - 1);
diff --git a/packages/core/src/no-react.ts b/packages/core/src/no-react.ts
index 4559b5f4f7..2807a6d726 100644
--- a/packages/core/src/no-react.ts
+++ b/packages/core/src/no-react.ts
@@ -3,14 +3,14 @@ export type {
AudioOrVideoAsset,
TRenderAsset,
} from './CompositionManager';
-export type {ClipRegion} from './NativeLayers';
export {
EasingFunction,
ExtrapolateType,
- InterpolateOptions,
interpolate,
+ InterpolateOptions,
} from './interpolate';
-export {RandomSeed, random} from './random.js';
+export type {ClipRegion} from './NativeLayers';
+export {random, RandomSeed} from './random.js';
export type {VideoConfig} from './video-config';
import {
DELAY_RENDER_CALLSTACK_TOKEN,
diff --git a/packages/core/src/timeline-position-state.ts b/packages/core/src/timeline-position-state.ts
index 8dd6622b5b..083185a68b 100644
--- a/packages/core/src/timeline-position-state.ts
+++ b/packages/core/src/timeline-position-state.ts
@@ -84,7 +84,7 @@ export const useTimelinePosition = (): number => {
if (!videoConfig) {
return typeof window === 'undefined'
? 0
- : window.remotion_initialFrame ?? 0;
+ : (window.remotion_initialFrame ?? 0);
}
const unclamped =
diff --git a/packages/core/src/video/VideoForPreview.tsx b/packages/core/src/video/VideoForPreview.tsx
index 5941695805..181c094b89 100644
--- a/packages/core/src/video/VideoForPreview.tsx
+++ b/packages/core/src/video/VideoForPreview.tsx
@@ -141,13 +141,9 @@ const VideoForDevelopmentRefForwardingFunction: React.ForwardRefRenderFunction<
fps,
});
- useImperativeHandle(
- ref,
- () => {
- return videoRef.current as HTMLVideoElement;
- },
- [],
- );
+ useImperativeHandle(ref, () => {
+ return videoRef.current as HTMLVideoElement;
+ }, []);
useEffect(() => {
const {current} = videoRef;
@@ -243,7 +239,7 @@ const VideoForDevelopmentRefForwardingFunction: React.ForwardRefRenderFunction<
const actualStyle: React.CSSProperties = useMemo(() => {
return {
...style,
- opacity: isSequenceHidden ? 0 : style?.opacity ?? 1,
+ opacity: isSequenceHidden ? 0 : (style?.opacity ?? 1),
};
}, [isSequenceHidden, style]);
diff --git a/packages/core/src/video/VideoForRendering.tsx b/packages/core/src/video/VideoForRendering.tsx
index 75eef07ce0..9e43001044 100644
--- a/packages/core/src/video/VideoForRendering.tsx
+++ b/packages/core/src/video/VideoForRendering.tsx
@@ -139,13 +139,9 @@ const VideoForRenderingForwardFunction: React.ForwardRefRenderFunction<
sequenceContext?.relativeFrom,
]);
- useImperativeHandle(
- ref,
- () => {
- return videoRef.current as HTMLVideoElement;
- },
- [],
- );
+ useImperativeHandle(ref, () => {
+ return videoRef.current as HTMLVideoElement;
+ }, []);
useEffect(() => {
if (!window.remotion_videoEnabled) {
diff --git a/packages/core/src/video/index.ts b/packages/core/src/video/index.ts
index b444258dc6..b242d8ac31 100644
--- a/packages/core/src/video/index.ts
+++ b/packages/core/src/video/index.ts
@@ -1,7 +1,7 @@
export {OffthreadVideo} from './OffthreadVideo.js';
-export {Video} from './Video.js';
export type {
RemotionMainVideoProps,
OffthreadVideoProps as RemotionOffthreadVideoProps,
RemotionVideoProps,
} from './props';
+export {Video} from './Video.js';
diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts
index d684afd0f8..abf18470d0 100644
--- a/packages/eslint-plugin/src/index.ts
+++ b/packages/eslint-plugin/src/index.ts
@@ -1,52 +1,52 @@
-import deterministicRandomness from "./rules/deterministic-randomness";
-import evenDimensions from "./rules/even-dimensions";
-import noBackgroundImage from "./rules/no-background-image";
-import durationInFrames from "./rules/no-duration-frames-infinity";
-import noFrom0 from "./rules/no-from-0";
-import nomp4Import from "./rules/no-mp4-import";
-import noStringAssets from "./rules/no-string-assets";
-import staticFileNoRelative from "./rules/staticfile-no-relative";
-import staticFileNoRemote from "./rules/staticfile-no-remote";
-import useGifComponent from "./rules/use-gif-component";
-import volumeCallback from "./rules/volume-callback";
-import warnNativeMediaTag from "./rules/warn-native-media-tag";
-import v4Import from "./rules/v4-import";
+import deterministicRandomness from './rules/deterministic-randomness';
+import evenDimensions from './rules/even-dimensions';
+import noBackgroundImage from './rules/no-background-image';
+import durationInFrames from './rules/no-duration-frames-infinity';
+import noFrom0 from './rules/no-from-0';
+import nomp4Import from './rules/no-mp4-import';
+import noStringAssets from './rules/no-string-assets';
+import staticFileNoRelative from './rules/staticfile-no-relative';
+import staticFileNoRemote from './rules/staticfile-no-remote';
+import useGifComponent from './rules/use-gif-component';
+import v4Import from './rules/v4-import';
+import volumeCallback from './rules/volume-callback';
+import warnNativeMediaTag from './rules/warn-native-media-tag';
const rules = {
- "no-mp4-import": nomp4Import,
- "warn-native-media-tag": warnNativeMediaTag,
- "deterministic-randomness": deterministicRandomness,
- "no-string-assets": noStringAssets,
- "even-dimensions": evenDimensions,
- "duration-in-frames": durationInFrames,
- "from-0": noFrom0,
- "volume-callback": volumeCallback,
- "use-gif-component": useGifComponent,
- "staticfile-no-relative": staticFileNoRelative,
- "staticfile-no-remote": staticFileNoRemote,
- "no-background-image": noBackgroundImage,
- "v4-config-import": v4Import,
+ 'no-mp4-import': nomp4Import,
+ 'warn-native-media-tag': warnNativeMediaTag,
+ 'deterministic-randomness': deterministicRandomness,
+ 'no-string-assets': noStringAssets,
+ 'even-dimensions': evenDimensions,
+ 'duration-in-frames': durationInFrames,
+ 'from-0': noFrom0,
+ 'volume-callback': volumeCallback,
+ 'use-gif-component': useGifComponent,
+ 'staticfile-no-relative': staticFileNoRelative,
+ 'staticfile-no-remote': staticFileNoRemote,
+ 'no-background-image': noBackgroundImage,
+ 'v4-config-import': v4Import,
};
export = {
- rules,
- configs: {
- recommended: {
- rules: {
- "@remotion/no-mp4-import": "off",
- "@remotion/warn-native-media-tag": "error",
- "@remotion/deterministic-randomness": "error",
- "@remotion/no-string-assets": "error",
- "@remotion/even-dimensions": "error",
- "@remotion/duration-in-frames": "error",
- "@remotion/from-0": "error",
- "@remotion/volume-callback": "error",
- "@remotion/use-gif-component": "error",
- "@remotion/staticfile-no-relative": "error",
- "@remotion/staticfile-no-remote": "error",
- "@remotion/no-background-image": "error",
- "@remotion/v4-config-import": "error",
- },
- },
- },
+ rules,
+ configs: {
+ recommended: {
+ rules: {
+ '@remotion/no-mp4-import': 'off',
+ '@remotion/warn-native-media-tag': 'error',
+ '@remotion/deterministic-randomness': 'error',
+ '@remotion/no-string-assets': 'error',
+ '@remotion/even-dimensions': 'error',
+ '@remotion/duration-in-frames': 'error',
+ '@remotion/from-0': 'error',
+ '@remotion/volume-callback': 'error',
+ '@remotion/use-gif-component': 'error',
+ '@remotion/staticfile-no-relative': 'error',
+ '@remotion/staticfile-no-remote': 'error',
+ '@remotion/no-background-image': 'error',
+ '@remotion/v4-config-import': 'error',
+ },
+ },
+ },
};
diff --git a/packages/eslint-plugin/src/rules/deterministic-randomness.ts b/packages/eslint-plugin/src/rules/deterministic-randomness.ts
index 05853da15a..ca12619ab7 100644
--- a/packages/eslint-plugin/src/rules/deterministic-randomness.ts
+++ b/packages/eslint-plugin/src/rules/deterministic-randomness.ts
@@ -1,56 +1,56 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
-type MessageIds = "DeterministicRandomness";
+type MessageIds = 'DeterministicRandomness';
const DeterministicRandomness = [
- "The result of Math.random() will change between frames while in rendering mode.",
- "Use the `random()` API from Remotion to get a deterministic pseudorandom value.",
- "If you are sure you want a true random value, use `random(null)` to hide this warning.",
- "See: https://remotion.dev/docs/using-randomness",
-].join("\n");
+ 'The result of Math.random() will change between frames while in rendering mode.',
+ 'Use the `random()` API from Remotion to get a deterministic pseudorandom value.',
+ 'If you are sure you want a true random value, use `random(null)` to hide this warning.',
+ 'See: https://remotion.dev/docs/using-randomness',
+].join('\n');
export default createRule<Options, MessageIds>({
- name: "deterministic-randomness",
- meta: {
- type: "problem",
- docs: {
- description: DeterministicRandomness,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- DeterministicRandomness: DeterministicRandomness,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- CallExpression: (node) => {
- const callee = node.callee;
- if (callee.type === "MemberExpression") {
- if (
- callee.object.type === "Identifier" &&
- callee.object.name === "Math"
- ) {
- if (
- callee.property.type === "Identifier" &&
- callee.property.name === "random"
- ) {
- context.report({
- messageId: "DeterministicRandomness",
- node,
- });
- }
- }
- }
- },
- };
- },
+ name: 'deterministic-randomness',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: DeterministicRandomness,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ DeterministicRandomness: DeterministicRandomness,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ CallExpression: (node) => {
+ const callee = node.callee;
+ if (callee.type === 'MemberExpression') {
+ if (
+ callee.object.type === 'Identifier' &&
+ callee.object.name === 'Math'
+ ) {
+ if (
+ callee.property.type === 'Identifier' &&
+ callee.property.name === 'random'
+ ) {
+ context.report({
+ messageId: 'DeterministicRandomness',
+ node,
+ });
+ }
+ }
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/even-dimensions.ts b/packages/eslint-plugin/src/rules/even-dimensions.ts
index 6a4c1121fd..65648d53e2 100644
--- a/packages/eslint-plugin/src/rules/even-dimensions.ts
+++ b/packages/eslint-plugin/src/rules/even-dimensions.ts
@@ -1,77 +1,77 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
-type MessageIds = "EvenDimensions";
+type MessageIds = 'EvenDimensions';
const EvenDimensions =
- "Videos rendered in H264/H265 codec do not support dimensions that are not divisible by 2. Make the number even to resolve this warning. Ignore this warning if you don't plan on rendering this video with a H264 or H265 codec.";
+ "Videos rendered in H264/H265 codec do not support dimensions that are not divisible by 2. Make the number even to resolve this warning. Ignore this warning if you don't plan on rendering this video with a H264 or H265 codec.";
export default createRule<Options, MessageIds>({
- name: "even-dimensions",
- meta: {
- type: "problem",
- docs: {
- description: EvenDimensions,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- EvenDimensions,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- JSXAttribute: (node) => {
- if (node.type !== "JSXAttribute") {
- return;
- }
- if (node.name.name !== "width" && node.name.name !== "height") {
- return;
- }
- const value = node.value;
- if (!value || value.type !== "JSXExpressionContainer") {
- return;
- }
+ name: 'even-dimensions',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: EvenDimensions,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ EvenDimensions,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ JSXAttribute: (node) => {
+ if (node.type !== 'JSXAttribute') {
+ return;
+ }
+ if (node.name.name !== 'width' && node.name.name !== 'height') {
+ return;
+ }
+ const value = node.value;
+ if (!value || value.type !== 'JSXExpressionContainer') {
+ return;
+ }
- const expression = value.expression;
- if (!expression || expression.type !== "Literal") {
- return;
- }
+ const expression = value.expression;
+ if (!expression || expression.type !== 'Literal') {
+ return;
+ }
- const stringValue = expression.value;
- if (typeof stringValue !== "number") {
- return;
- }
+ const stringValue = expression.value;
+ if (typeof stringValue !== 'number') {
+ return;
+ }
- const parent = node.parent;
- if (!parent) {
- return;
- }
+ const parent = node.parent;
+ if (!parent) {
+ return;
+ }
- if (parent.type !== "JSXOpeningElement") {
- return;
- }
- const name = parent.name;
- if (name.type !== "JSXIdentifier") {
- return;
- }
- if (name.name !== "Composition") {
- return;
- }
- if (stringValue % 2 !== 0) {
- context.report({
- messageId: "EvenDimensions",
- node,
- });
- }
- },
- };
- },
+ if (parent.type !== 'JSXOpeningElement') {
+ return;
+ }
+ const name = parent.name;
+ if (name.type !== 'JSXIdentifier') {
+ return;
+ }
+ if (name.name !== 'Composition') {
+ return;
+ }
+ if (stringValue % 2 !== 0) {
+ context.report({
+ messageId: 'EvenDimensions',
+ node,
+ });
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/no-background-image.ts b/packages/eslint-plugin/src/rules/no-background-image.ts
index 698eb7c2b9..4d1dddeb44 100644
--- a/packages/eslint-plugin/src/rules/no-background-image.ts
+++ b/packages/eslint-plugin/src/rules/no-background-image.ts
@@ -1,67 +1,67 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return "https://remotion.dev/docs/troubleshooting/background-image";
+ return 'https://remotion.dev/docs/troubleshooting/background-image';
});
type Options = [];
-type MessageIds = "BackgroundImage";
+type MessageIds = 'BackgroundImage';
const BackgroundImage = [
- "Don't use background-image in Remotion.",
- "See: https://remotion.dev/docs/troubleshooting/background-image",
-].join("\n");
+ "Don't use background-image in Remotion.",
+ 'See: https://remotion.dev/docs/troubleshooting/background-image',
+].join('\n');
export default createRule<Options, MessageIds>({
- name: "no-background-image",
- meta: {
- type: "problem",
- docs: {
- description: BackgroundImage,
- recommended: "error",
- },
- fixable: undefined,
- schema: [],
- messages: {
- BackgroundImage: BackgroundImage,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- Property: (node) => {
- if (node.key.type !== "Identifier") {
- return;
- }
+ name: 'no-background-image',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: BackgroundImage,
+ recommended: 'error',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ BackgroundImage: BackgroundImage,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ Property: (node) => {
+ if (node.key.type !== 'Identifier') {
+ return;
+ }
- if (node.key.name !== "backgroundImage") {
- return;
- }
+ if (node.key.name !== 'backgroundImage') {
+ return;
+ }
- if (node.value.type === "Literal") {
- const { value } = node.value;
- if (typeof value === "string" && value.includes("url(")) {
- context.report({
- messageId: "BackgroundImage",
- node,
- });
- }
- }
+ if (node.value.type === 'Literal') {
+ const {value} = node.value;
+ if (typeof value === 'string' && value.includes('url(')) {
+ context.report({
+ messageId: 'BackgroundImage',
+ node,
+ });
+ }
+ }
- if (node.value.type === "TemplateLiteral") {
- for (const element of node.value.quasis) {
- if (element.type !== "TemplateElement") {
- continue;
- }
- if (element.value.raw.includes("url(")) {
- context.report({
- messageId: "BackgroundImage",
- node,
- });
- }
- }
- }
- },
- };
- },
+ if (node.value.type === 'TemplateLiteral') {
+ for (const element of node.value.quasis) {
+ if (element.type !== 'TemplateElement') {
+ continue;
+ }
+ if (element.value.raw.includes('url(')) {
+ context.report({
+ messageId: 'BackgroundImage',
+ node,
+ });
+ }
+ }
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/no-duration-frames-infinity.ts b/packages/eslint-plugin/src/rules/no-duration-frames-infinity.ts
index a774a3889d..46b3d2788b 100644
--- a/packages/eslint-plugin/src/rules/no-duration-frames-infinity.ts
+++ b/packages/eslint-plugin/src/rules/no-duration-frames-infinity.ts
@@ -1,82 +1,82 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
-type MessageIds = "DurationInFrames";
+type MessageIds = 'DurationInFrames';
const DurationInFrames =
- "Infinity is now the default, so you can remove the prop.";
+ 'Infinity is now the default, so you can remove the prop.';
export default createRule<Options, MessageIds>({
- name: "duration-in-frames",
- meta: {
- type: "problem",
- docs: {
- description: DurationInFrames,
- recommended: "warn",
- },
- fixable: "code",
- schema: [],
- messages: {
- DurationInFrames,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- JSXAttribute: (node) => {
- if (node.type !== "JSXAttribute") {
- return;
- }
+ name: 'duration-in-frames',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: DurationInFrames,
+ recommended: 'warn',
+ },
+ fixable: 'code',
+ schema: [],
+ messages: {
+ DurationInFrames,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ JSXAttribute: (node) => {
+ if (node.type !== 'JSXAttribute') {
+ return;
+ }
- if (node.name.name !== "durationInFrames") {
- return;
- }
- const value = node.value;
- if (!value || value.type !== "JSXExpressionContainer") {
- return;
- }
+ if (node.name.name !== 'durationInFrames') {
+ return;
+ }
+ const value = node.value;
+ if (!value || value.type !== 'JSXExpressionContainer') {
+ return;
+ }
- const expression = value.expression;
- if (!expression || expression.type !== "Identifier") {
- return;
- }
+ const expression = value.expression;
+ if (!expression || expression.type !== 'Identifier') {
+ return;
+ }
- const stringValue = expression.name;
- if (typeof stringValue !== "string") {
- return;
- }
+ const stringValue = expression.name;
+ if (typeof stringValue !== 'string') {
+ return;
+ }
- const parent = node.parent;
- if (!parent) {
- return;
- }
+ const parent = node.parent;
+ if (!parent) {
+ return;
+ }
- if (parent.type !== "JSXOpeningElement") {
- return;
- }
+ if (parent.type !== 'JSXOpeningElement') {
+ return;
+ }
- const name = parent.name;
- if (name.type !== "JSXIdentifier") {
- return;
- }
- if (name.name !== "Sequence") {
- return;
- }
- if (stringValue === "Infinity") {
- context.report({
- messageId: "DurationInFrames",
- node,
- fix: (fixer) => {
- return fixer.removeRange([node.name.range[0], value.range[1]]);
- },
- });
- }
- },
- };
- },
+ const name = parent.name;
+ if (name.type !== 'JSXIdentifier') {
+ return;
+ }
+ if (name.name !== 'Sequence') {
+ return;
+ }
+ if (stringValue === 'Infinity') {
+ context.report({
+ messageId: 'DurationInFrames',
+ node,
+ fix: (fixer) => {
+ return fixer.removeRange([node.name.range[0], value.range[1]]);
+ },
+ });
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/no-from-0.ts b/packages/eslint-plugin/src/rules/no-from-0.ts
index c489c1cf81..1d57d278fb 100644
--- a/packages/eslint-plugin/src/rules/no-from-0.ts
+++ b/packages/eslint-plugin/src/rules/no-from-0.ts
@@ -1,82 +1,82 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
-type MessageIds = "From0";
+type MessageIds = 'From0';
-const From0 = "0 is now the default, so you can remove the prop.";
+const From0 = '0 is now the default, so you can remove the prop.';
export default createRule<Options, MessageIds>({
- name: "from",
- meta: {
- type: "problem",
- docs: {
- description: From0,
- recommended: "warn",
- },
- fixable: "code",
- schema: [],
- messages: {
- From0,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- JSXAttribute: (node) => {
- if (node.type !== "JSXAttribute") {
- return;
- }
+ name: 'from',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: From0,
+ recommended: 'warn',
+ },
+ fixable: 'code',
+ schema: [],
+ messages: {
+ From0,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ JSXAttribute: (node) => {
+ if (node.type !== 'JSXAttribute') {
+ return;
+ }
- if (node.name.name !== "from") {
- return;
- }
- const value = node.value;
- if (!value || value.type !== "JSXExpressionContainer") {
- return;
- }
+ if (node.name.name !== 'from') {
+ return;
+ }
+ const value = node.value;
+ if (!value || value.type !== 'JSXExpressionContainer') {
+ return;
+ }
- const expression = value.expression;
- if (!expression || expression.type !== "Literal") {
- return;
- }
+ const expression = value.expression;
+ if (!expression || expression.type !== 'Literal') {
+ return;
+ }
- const stringValue = expression.value;
+ const stringValue = expression.value;
- if (stringValue !== 0) {
- return;
- }
+ if (stringValue !== 0) {
+ return;
+ }
- const parent = node.parent;
- if (!parent) {
- return;
- }
+ const parent = node.parent;
+ if (!parent) {
+ return;
+ }
- if (parent.type !== "JSXOpeningElement") {
- return;
- }
+ if (parent.type !== 'JSXOpeningElement') {
+ return;
+ }
- const name = parent.name;
- if (name.type !== "JSXIdentifier") {
- return;
- }
- if (name.name !== "Sequence") {
- return;
- }
- if (stringValue === 0) {
- context.report({
- messageId: "From0",
- node,
- fix: (fixer) => {
- return fixer.removeRange([node.name.range[0], value.range[1]]);
- },
- });
- }
- },
- };
- },
+ const name = parent.name;
+ if (name.type !== 'JSXIdentifier') {
+ return;
+ }
+ if (name.name !== 'Sequence') {
+ return;
+ }
+ if (stringValue === 0) {
+ context.report({
+ messageId: 'From0',
+ node,
+ fix: (fixer) => {
+ return fixer.removeRange([node.name.range[0], value.range[1]]);
+ },
+ });
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/no-mp4-import.ts b/packages/eslint-plugin/src/rules/no-mp4-import.ts
index 91b84232ce..476f9c281a 100644
--- a/packages/eslint-plugin/src/rules/no-mp4-import.ts
+++ b/packages/eslint-plugin/src/rules/no-mp4-import.ts
@@ -1,69 +1,69 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
-type MessageIds = "NoMP4Import";
+type MessageIds = 'NoMP4Import';
const NoMP4Import =
- "Importing MP4 will work while you are previewing the video, but will not work while rendering since Puppeteer does not include the codecs necessary for MP4 videos. Convert the video to WebM first.";
+ 'Importing MP4 will work while you are previewing the video, but will not work while rendering since Puppeteer does not include the codecs necessary for MP4 videos. Convert the video to WebM first.';
const rule = createRule<Options, MessageIds>({
- name: "no-mp4-import",
- meta: {
- type: "problem",
- docs: {
- description: NoMP4Import,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- NoMP4Import,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- ImportDeclaration: (node) => {
- if (node.source.raw.includes(".mp4")) {
- context.report({
- messageId: "NoMP4Import",
- node,
- });
- }
- },
- CallExpression: (node) => {
- // @ts-expect-error
- if (node.callee.name !== "require") {
- return;
- }
- // @ts-expect-error
- const firstArgument = node.callee?.parent?.arguments?.[0]?.raw as
- | string
- | undefined;
- if (!firstArgument) {
- const sourceCode = context.getSourceCode().getText(node);
- if (sourceCode.includes(".mp4")) {
- context.report({
- messageId: "NoMP4Import",
- node,
- });
- }
- return;
- }
- if (firstArgument.includes(".mp4")) {
- context.report({
- messageId: "NoMP4Import",
- node,
- });
- }
- },
- };
- },
+ name: 'no-mp4-import',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: NoMP4Import,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ NoMP4Import,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ ImportDeclaration: (node) => {
+ if (node.source.raw.includes('.mp4')) {
+ context.report({
+ messageId: 'NoMP4Import',
+ node,
+ });
+ }
+ },
+ CallExpression: (node) => {
+ // @ts-expect-error
+ if (node.callee.name !== 'require') {
+ return;
+ }
+ // @ts-expect-error
+ const firstArgument = node.callee?.parent?.arguments?.[0]?.raw as
+ | string
+ | undefined;
+ if (!firstArgument) {
+ const sourceCode = context.getSourceCode().getText(node);
+ if (sourceCode.includes('.mp4')) {
+ context.report({
+ messageId: 'NoMP4Import',
+ node,
+ });
+ }
+ return;
+ }
+ if (firstArgument.includes('.mp4')) {
+ context.report({
+ messageId: 'NoMP4Import',
+ node,
+ });
+ }
+ },
+ };
+ },
});
export default rule;
diff --git a/packages/eslint-plugin/src/rules/no-string-assets.ts b/packages/eslint-plugin/src/rules/no-string-assets.ts
index 1c3d919d53..5fc3021506 100644
--- a/packages/eslint-plugin/src/rules/no-string-assets.ts
+++ b/packages/eslint-plugin/src/rules/no-string-assets.ts
@@ -1,99 +1,99 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
-type MessageIds = "NoStringAssets";
+type MessageIds = 'NoStringAssets';
const NoStringAssets = [
- "Don't reference local assets by string, use an import statement or staticFile() instead.",
- "See: https://www.remotion.dev/docs/assets",
-].join("\n");
+ "Don't reference local assets by string, use an import statement or staticFile() instead.",
+ 'See: https://www.remotion.dev/docs/assets',
+].join('\n');
export default createRule<Options, MessageIds>({
- name: "no-string-assets",
- meta: {
- type: "problem",
- docs: {
- description: NoStringAssets,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- NoStringAssets: NoStringAssets,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- JSXAttribute: (node) => {
- if (node.type !== "JSXAttribute") {
- return;
- }
- if (node.name.name !== "src") {
- return;
- }
- const value = node.value;
- // src={"some string"}
- const insideCurlyBraces =
- value &&
- value.type === "JSXExpressionContainer" &&
- value.expression.type === "Literal";
- if (!value || (value.type !== "Literal" && !insideCurlyBraces)) {
- return;
- }
- const stringValue =
- value &&
- value.type === "JSXExpressionContainer" &&
- value.expression.type === "Literal"
- ? value.expression.value
- : value.type === "Literal"
- ? value.value
- : null;
- if (typeof stringValue !== "string") {
- return;
- }
+ name: 'no-string-assets',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: NoStringAssets,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ NoStringAssets: NoStringAssets,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ JSXAttribute: (node) => {
+ if (node.type !== 'JSXAttribute') {
+ return;
+ }
+ if (node.name.name !== 'src') {
+ return;
+ }
+ const value = node.value;
+ // src={"some string"}
+ const insideCurlyBraces =
+ value &&
+ value.type === 'JSXExpressionContainer' &&
+ value.expression.type === 'Literal';
+ if (!value || (value.type !== 'Literal' && !insideCurlyBraces)) {
+ return;
+ }
+ const stringValue =
+ value &&
+ value.type === 'JSXExpressionContainer' &&
+ value.expression.type === 'Literal'
+ ? value.expression.value
+ : value.type === 'Literal'
+ ? value.value
+ : null;
+ if (typeof stringValue !== 'string') {
+ return;
+ }
- const parent = node.parent;
- if (!parent) {
- return;
- }
- if (parent.type !== "JSXOpeningElement") {
- return;
- }
- const name = parent.name;
- if (name.type !== "JSXIdentifier") {
- return;
- }
- if (
- name.name === "Img" ||
- name.name === "img" ||
- name.name === "Audio" ||
- name.name === "audio" ||
- name.name === "Video" ||
- name.name === "video" ||
- name.name === "source"
- ) {
- // Network and inline URLs are okay
- if (stringValue.startsWith("http://")) {
- return;
- }
- if (stringValue.startsWith("https://")) {
- return;
- }
- if (stringValue.startsWith("data:")) {
- return;
- }
- context.report({
- messageId: "NoStringAssets",
- node,
- });
- }
- },
- };
- },
+ const parent = node.parent;
+ if (!parent) {
+ return;
+ }
+ if (parent.type !== 'JSXOpeningElement') {
+ return;
+ }
+ const name = parent.name;
+ if (name.type !== 'JSXIdentifier') {
+ return;
+ }
+ if (
+ name.name === 'Img' ||
+ name.name === 'img' ||
+ name.name === 'Audio' ||
+ name.name === 'audio' ||
+ name.name === 'Video' ||
+ name.name === 'video' ||
+ name.name === 'source'
+ ) {
+ // Network and inline URLs are okay
+ if (stringValue.startsWith('http://')) {
+ return;
+ }
+ if (stringValue.startsWith('https://')) {
+ return;
+ }
+ if (stringValue.startsWith('data:')) {
+ return;
+ }
+ context.report({
+ messageId: 'NoStringAssets',
+ node,
+ });
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/staticfile-no-relative.ts b/packages/eslint-plugin/src/rules/staticfile-no-relative.ts
index cae3d64669..32cb136052 100644
--- a/packages/eslint-plugin/src/rules/staticfile-no-relative.ts
+++ b/packages/eslint-plugin/src/rules/staticfile-no-relative.ts
@@ -1,114 +1,114 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://remotion.dev/docs/staticfile-relative-paths`;
+ return `https://remotion.dev/docs/staticfile-relative-paths`;
});
type Options = [];
type MessageIds =
- | "RelativePathStaticFile"
- | "AbsoluteStaticFile"
- | "PublicStaticFile";
+ | 'RelativePathStaticFile'
+ | 'AbsoluteStaticFile'
+ | 'PublicStaticFile';
const RelativePathStaticFile = [
- "Don't pass a relative path to staticFile().",
- "See: https://remotion.dev/docs/staticfile-relative-paths",
-].join("\n");
+ "Don't pass a relative path to staticFile().",
+ 'See: https://remotion.dev/docs/staticfile-relative-paths',
+].join('\n');
const AbsoluteStaticFile = [
- "Do not pass an absolute path to staticFile().",
- "See: https://remotion.dev/docs/staticfile-relative-paths",
-].join("");
+ 'Do not pass an absolute path to staticFile().',
+ 'See: https://remotion.dev/docs/staticfile-relative-paths',
+].join('');
const PublicStaticFile = [
- "Do not prefix your assets with public/.",
- "See: https://remotion.dev/docs/staticfile-relative-paths",
-].join("");
+ 'Do not prefix your assets with public/.',
+ 'See: https://remotion.dev/docs/staticfile-relative-paths',
+].join('');
export default createRule<Options, MessageIds>({
- name: "staticfile-no-relative",
- meta: {
- type: "problem",
- docs: {
- description: RelativePathStaticFile,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- RelativePathStaticFile: RelativePathStaticFile,
- PublicStaticFile: PublicStaticFile,
- AbsoluteStaticFile: AbsoluteStaticFile,
- },
- },
+ name: 'staticfile-no-relative',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: RelativePathStaticFile,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ RelativePathStaticFile: RelativePathStaticFile,
+ PublicStaticFile: PublicStaticFile,
+ AbsoluteStaticFile: AbsoluteStaticFile,
+ },
+ },
- defaultOptions: [],
- create: (context) => {
- return {
- CallExpression: (node) => {
- const value = node;
- // src={"some string"}
- if (!value) {
- return;
- }
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ CallExpression: (node) => {
+ const value = node;
+ // src={"some string"}
+ if (!value) {
+ return;
+ }
- if (
- node.type === "CallExpression" &&
- node.callee.type === "Identifier" &&
- node.callee.name === "staticFile"
- ) {
- const args = node.arguments;
- if (args.length === 0) {
- return;
- }
+ if (
+ node.type === 'CallExpression' &&
+ node.callee.type === 'Identifier' &&
+ node.callee.name === 'staticFile'
+ ) {
+ const args = node.arguments;
+ if (args.length === 0) {
+ return;
+ }
- const firstArg = args[0];
+ const firstArg = args[0];
- if (firstArg.type === "Literal") {
- const value = firstArg.value;
- if (typeof value !== "string") {
- return;
- }
- if (value.startsWith("./")) {
- context.report({
- messageId: "RelativePathStaticFile",
- node,
- });
- }
- if (value.startsWith("../")) {
- context.report({
- messageId: "RelativePathStaticFile",
- node,
- });
- }
+ if (firstArg.type === 'Literal') {
+ const value = firstArg.value;
+ if (typeof value !== 'string') {
+ return;
+ }
+ if (value.startsWith('./')) {
+ context.report({
+ messageId: 'RelativePathStaticFile',
+ node,
+ });
+ }
+ if (value.startsWith('../')) {
+ context.report({
+ messageId: 'RelativePathStaticFile',
+ node,
+ });
+ }
- if (value.startsWith("public/")) {
- context.report({
- messageId: "PublicStaticFile",
- node,
- });
- }
+ if (value.startsWith('public/')) {
+ context.report({
+ messageId: 'PublicStaticFile',
+ node,
+ });
+ }
- if (
- value.startsWith("/Users") ||
- value.startsWith("/home") ||
- value.startsWith("/tmp") ||
- value.startsWith("/etc") ||
- value.startsWith("/opt") ||
- value.startsWith("/var") ||
- value.startsWith("C:") ||
- value.startsWith("D:") ||
- value.startsWith("E:")
- ) {
- context.report({
- messageId: "AbsoluteStaticFile",
- node,
- });
- }
- }
- }
- },
- };
- },
+ if (
+ value.startsWith('/Users') ||
+ value.startsWith('/home') ||
+ value.startsWith('/tmp') ||
+ value.startsWith('/etc') ||
+ value.startsWith('/opt') ||
+ value.startsWith('/var') ||
+ value.startsWith('C:') ||
+ value.startsWith('D:') ||
+ value.startsWith('E:')
+ ) {
+ context.report({
+ messageId: 'AbsoluteStaticFile',
+ node,
+ });
+ }
+ }
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/staticfile-no-remote.ts b/packages/eslint-plugin/src/rules/staticfile-no-remote.ts
index 743202832b..b27a1ca245 100644
--- a/packages/eslint-plugin/src/rules/staticfile-no-remote.ts
+++ b/packages/eslint-plugin/src/rules/staticfile-no-remote.ts
@@ -1,74 +1,74 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://remotion.dev/docs/staticfile-remote-urls`;
+ return `https://remotion.dev/docs/staticfile-remote-urls`;
});
type Options = [];
-type MessageIds = "RelativePathStaticFile";
+type MessageIds = 'RelativePathStaticFile';
const RelativePathStaticFile = [
- "Don't pass a remote URL to staticFile().",
- "See: https://remotion.dev/docs/staticfile-remote-urls",
-].join("\n");
+ "Don't pass a remote URL to staticFile().",
+ 'See: https://remotion.dev/docs/staticfile-remote-urls',
+].join('\n');
export default createRule<Options, MessageIds>({
- name: "staticfile-no-remote",
- meta: {
- type: "problem",
- docs: {
- description: RelativePathStaticFile,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- RelativePathStaticFile: RelativePathStaticFile,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- CallExpression: (node) => {
- const value = node;
- // src={"some string"}
- if (!value) {
- return;
- }
+ name: 'staticfile-no-remote',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: RelativePathStaticFile,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ RelativePathStaticFile: RelativePathStaticFile,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ CallExpression: (node) => {
+ const value = node;
+ // src={"some string"}
+ if (!value) {
+ return;
+ }
- if (
- node.type === "CallExpression" &&
- node.callee.type === "Identifier" &&
- node.callee.name === "staticFile"
- ) {
- const args = node.arguments;
- if (args.length === 0) {
- return;
- }
+ if (
+ node.type === 'CallExpression' &&
+ node.callee.type === 'Identifier' &&
+ node.callee.name === 'staticFile'
+ ) {
+ const args = node.arguments;
+ if (args.length === 0) {
+ return;
+ }
- const firstArg = args[0];
+ const firstArg = args[0];
- if (firstArg.type === "Literal") {
- const value = firstArg.value;
- if (typeof value !== "string") {
- return;
- }
- if (value.startsWith("http://")) {
- context.report({
- messageId: "RelativePathStaticFile",
- node,
- });
- }
- if (value.startsWith("https://")) {
- context.report({
- messageId: "RelativePathStaticFile",
- node,
- });
- }
- }
- }
- },
- };
- },
+ if (firstArg.type === 'Literal') {
+ const value = firstArg.value;
+ if (typeof value !== 'string') {
+ return;
+ }
+ if (value.startsWith('http://')) {
+ context.report({
+ messageId: 'RelativePathStaticFile',
+ node,
+ });
+ }
+ if (value.startsWith('https://')) {
+ context.report({
+ messageId: 'RelativePathStaticFile',
+ node,
+ });
+ }
+ }
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/use-gif-component.ts b/packages/eslint-plugin/src/rules/use-gif-component.ts
index 64a9977f4e..b6364bb460 100644
--- a/packages/eslint-plugin/src/rules/use-gif-component.ts
+++ b/packages/eslint-plugin/src/rules/use-gif-component.ts
@@ -1,109 +1,109 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
-type MessageIds = "UseGifComponent";
+type MessageIds = 'UseGifComponent';
const UseGifComponent = [
- "Use the <Gif> component animated GIFs.",
- "See: https://www.remotion.dev/docs/gif.",
- "Ignore this message if this is a non-animated GIF.",
-].join("\n");
+ 'Use the <Gif> component animated GIFs.',
+ 'See: https://www.remotion.dev/docs/gif.',
+ 'Ignore this message if this is a non-animated GIF.',
+].join('\n');
export default createRule<Options, MessageIds>({
- name: "use-gif-component",
- meta: {
- type: "problem",
- docs: {
- description: UseGifComponent,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- UseGifComponent: UseGifComponent,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- JSXAttribute: (node) => {
- if (node.type !== "JSXAttribute") {
- return;
- }
- if (node.name.name !== "src") {
- return;
- }
- const parent = node.parent;
- if (!parent) {
- return;
- }
- if (parent.type !== "JSXOpeningElement") {
- return;
- }
- const name = parent.name;
- if (name.type !== "JSXIdentifier") {
- return;
- }
- if (name.name !== "Img" && name.name !== "img") {
- return;
- }
+ name: 'use-gif-component',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: UseGifComponent,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ UseGifComponent: UseGifComponent,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ JSXAttribute: (node) => {
+ if (node.type !== 'JSXAttribute') {
+ return;
+ }
+ if (node.name.name !== 'src') {
+ return;
+ }
+ const parent = node.parent;
+ if (!parent) {
+ return;
+ }
+ if (parent.type !== 'JSXOpeningElement') {
+ return;
+ }
+ const name = parent.name;
+ if (name.type !== 'JSXIdentifier') {
+ return;
+ }
+ if (name.name !== 'Img' && name.name !== 'img') {
+ return;
+ }
- const value = node.value;
- // src={"some string"}
- if (!value) {
- return;
- }
- const stringValue =
- value &&
- value.type === "JSXExpressionContainer" &&
- value.expression.type === "Literal"
- ? value.expression.value
- : value.type === "Literal"
- ? value.value
- : null;
- // src="image.gif"
- if (typeof stringValue === "string") {
- // Network and inline URLs are okay
- if (stringValue.includes(".gif")) {
- context.report({
- messageId: "UseGifComponent",
- node,
- });
- }
- }
+ const value = node.value;
+ // src={"some string"}
+ if (!value) {
+ return;
+ }
+ const stringValue =
+ value &&
+ value.type === 'JSXExpressionContainer' &&
+ value.expression.type === 'Literal'
+ ? value.expression.value
+ : value.type === 'Literal'
+ ? value.value
+ : null;
+ // src="image.gif"
+ if (typeof stringValue === 'string') {
+ // Network and inline URLs are okay
+ if (stringValue.includes('.gif')) {
+ context.report({
+ messageId: 'UseGifComponent',
+ node,
+ });
+ }
+ }
- if (
- value.type === "JSXExpressionContainer" &&
- value.expression.type === "CallExpression" &&
- value.expression.callee.type === "Identifier" &&
- value.expression.callee.name === "staticFile"
- ) {
- const args = value.expression.arguments;
- if (args.length === 0) {
- return;
- }
+ if (
+ value.type === 'JSXExpressionContainer' &&
+ value.expression.type === 'CallExpression' &&
+ value.expression.callee.type === 'Identifier' &&
+ value.expression.callee.name === 'staticFile'
+ ) {
+ const args = value.expression.arguments;
+ if (args.length === 0) {
+ return;
+ }
- const firstArg = args[0];
+ const firstArg = args[0];
- if (firstArg.type === "Literal") {
- const value = firstArg.value;
- if (typeof value !== "string") {
- return;
- }
- if (value.includes(".gif")) {
- context.report({
- messageId: "UseGifComponent",
- node,
- });
- }
- }
- }
- },
- };
- },
+ if (firstArg.type === 'Literal') {
+ const value = firstArg.value;
+ if (typeof value !== 'string') {
+ return;
+ }
+ if (value.includes('.gif')) {
+ context.report({
+ messageId: 'UseGifComponent',
+ node,
+ });
+ }
+ }
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/v4-import.ts b/packages/eslint-plugin/src/rules/v4-import.ts
index e2e21817ee..ac9bccc5e0 100644
--- a/packages/eslint-plugin/src/rules/v4-import.ts
+++ b/packages/eslint-plugin/src/rules/v4-import.ts
@@ -1,49 +1,49 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://www.remotion.dev/docs/4-0-migration`;
+ return `https://www.remotion.dev/docs/4-0-migration`;
});
type Options = [];
-type MessageIds = "ImportConfig";
+type MessageIds = 'ImportConfig';
const ImportConfig =
- "Update the import to the new V4 location: import {Config} from '@remotion/cli/config'";
+ "Update the import to the new V4 location: import {Config} from '@remotion/cli/config'";
const rule = createRule<Options, MessageIds>({
- name: "v4-config-import",
- meta: {
- type: "problem",
- docs: {
- description: ImportConfig,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- ImportConfig,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- ImportDeclaration: (node) => {
- if (node.source.value !== "remotion") {
- return;
- }
- const config = node.specifiers.find(
- (s) => s.type === "ImportSpecifier" && s.imported.name === "Config"
- );
- if (config) {
- context.report({
- messageId: "ImportConfig",
- node,
- });
- }
- },
- };
- },
+ name: 'v4-config-import',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: ImportConfig,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ ImportConfig,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ ImportDeclaration: (node) => {
+ if (node.source.value !== 'remotion') {
+ return;
+ }
+ const config = node.specifiers.find(
+ (s) => s.type === 'ImportSpecifier' && s.imported.name === 'Config',
+ );
+ if (config) {
+ context.report({
+ messageId: 'ImportConfig',
+ node,
+ });
+ }
+ },
+ };
+ },
});
export default rule;
diff --git a/packages/eslint-plugin/src/rules/volume-callback.ts b/packages/eslint-plugin/src/rules/volume-callback.ts
index ae7dc58b9f..717b9ede3c 100644
--- a/packages/eslint-plugin/src/rules/volume-callback.ts
+++ b/packages/eslint-plugin/src/rules/volume-callback.ts
@@ -1,78 +1,78 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
-type MessageIds = "VolumeCallback";
+type MessageIds = 'VolumeCallback';
const VolumeCallback =
- "Prefer a callback function for setting the volume: `volume={(f) => interpolate(...)}`. See https://www.remotion.dev/docs/using-audio/#controlling-volume";
+ 'Prefer a callback function for setting the volume: `volume={(f) => interpolate(...)}`. See https://www.remotion.dev/docs/using-audio/#controlling-volume';
export default createRule<Options, MessageIds>({
- name: "volume-callback",
- meta: {
- type: "problem",
- docs: {
- description: VolumeCallback,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- VolumeCallback,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- JSXAttribute: (node) => {
- if (node.type !== "JSXAttribute") {
- return;
- }
- if (node.name.name !== "volume") {
- return;
- }
- const value = node.value;
- if (!value || value.type !== "JSXExpressionContainer") {
- return;
- }
+ name: 'volume-callback',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: VolumeCallback,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ VolumeCallback,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ JSXAttribute: (node) => {
+ if (node.type !== 'JSXAttribute') {
+ return;
+ }
+ if (node.name.name !== 'volume') {
+ return;
+ }
+ const value = node.value;
+ if (!value || value.type !== 'JSXExpressionContainer') {
+ return;
+ }
- const parent = node.parent;
- if (!parent) {
- return;
- }
+ const parent = node.parent;
+ if (!parent) {
+ return;
+ }
- if (parent.type !== "JSXOpeningElement") {
- return;
- }
- const name = parent.name;
- if (name.type !== "JSXIdentifier") {
- return;
- }
- if (name.name !== "Video" && name.name !== "Audio") {
- return;
- }
+ if (parent.type !== 'JSXOpeningElement') {
+ return;
+ }
+ const name = parent.name;
+ if (name.type !== 'JSXIdentifier') {
+ return;
+ }
+ if (name.name !== 'Video' && name.name !== 'Audio') {
+ return;
+ }
- const expression = value.expression;
- if (!expression) {
- return;
- }
+ const expression = value.expression;
+ if (!expression) {
+ return;
+ }
- if (expression.type === "Literal") {
- return;
- }
- if (expression.type === "ArrowFunctionExpression") {
- return;
- }
+ if (expression.type === 'Literal') {
+ return;
+ }
+ if (expression.type === 'ArrowFunctionExpression') {
+ return;
+ }
- context.report({
- messageId: "VolumeCallback",
- node,
- });
- },
- };
- },
+ context.report({
+ messageId: 'VolumeCallback',
+ node,
+ });
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/rules/warn-native-media-tag.ts b/packages/eslint-plugin/src/rules/warn-native-media-tag.ts
index e0cff1f585..0c43a486eb 100644
--- a/packages/eslint-plugin/src/rules/warn-native-media-tag.ts
+++ b/packages/eslint-plugin/src/rules/warn-native-media-tag.ts
@@ -1,110 +1,110 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
+import {ESLintUtils} from '@typescript-eslint/utils';
const createRule = ESLintUtils.RuleCreator(() => {
- return `https://github.com/remotion-dev/remotion`;
+ return `https://github.com/remotion-dev/remotion`;
});
type Options = [];
type MessageIds =
- | "NoNativeImgTag"
- | "NoNativeIFrameTag"
- | "NoNativeAudioTag"
- | "NoNativeVideoTag";
+ | 'NoNativeImgTag'
+ | 'NoNativeIFrameTag'
+ | 'NoNativeAudioTag'
+ | 'NoNativeVideoTag';
const NoNativeImgTag =
- "Prefer the <Img /> tag from 'remotion' package, because it will wait until the image is loaded when you are rendering your video.";
+ "Prefer the <Img /> tag from 'remotion' package, because it will wait until the image is loaded when you are rendering your video.";
const NoNativeIFrameTag =
- "Prefer the <IFrame /> tag from 'remotion' package, because it will wait until the iframe is loaded when you are rendering your video.";
+ "Prefer the <IFrame /> tag from 'remotion' package, because it will wait until the iframe is loaded when you are rendering your video.";
const NoNativeAudioTag =
- "Use the <Audio /> tag from 'remotion' package, because it will synchronize with the Remotion timeline.";
+ "Use the <Audio /> tag from 'remotion' package, because it will synchronize with the Remotion timeline.";
const NoNativeVideoTag =
- "Use the <Video /> tag from 'remotion' package, because it will synchronize with the Remotion timeline.";
+ "Use the <Video /> tag from 'remotion' package, because it will synchronize with the Remotion timeline.";
export default createRule<Options, MessageIds>({
- name: "warn-native-media-tag",
- meta: {
- type: "problem",
- docs: {
- description: NoNativeImgTag,
- recommended: "warn",
- },
- fixable: undefined,
- schema: [],
- messages: {
- NoNativeImgTag,
- NoNativeIFrameTag,
- NoNativeAudioTag,
- NoNativeVideoTag,
- },
- },
- defaultOptions: [],
- create: (context) => {
- return {
- JSXOpeningElement: (node) => {
- if (node.name.type === "JSXIdentifier" && node.name.name === "img") {
- context.report({
- messageId: "NoNativeImgTag",
- node,
- });
- }
- if (node.name.type === "JSXIdentifier" && node.name.name === "iframe") {
- context.report({
- messageId: "NoNativeIFrameTag",
- node,
- });
- }
- if (node.name.type === "JSXIdentifier" && node.name.name === "video") {
- context.report({
- messageId: "NoNativeVideoTag",
- node,
- });
- }
- if (node.name.type === "JSXIdentifier" && node.name.name === "audio") {
- context.report({
- messageId: "NoNativeAudioTag",
- node,
- });
- }
- },
- TaggedTemplateExpression: (node) => {
- if (node.tag.type !== "MemberExpression") {
- return;
- }
- if (node.tag.object.type !== "Identifier") {
- return;
- }
- if (node.tag.object.name !== "styled") {
- return;
- }
- if (node.tag.property.type !== "Identifier") {
- return;
- }
- if (node.tag.property.name === "img") {
- context.report({
- messageId: "NoNativeImgTag",
- node,
- });
- }
- if (node.tag.property.name === "iframe") {
- context.report({
- messageId: "NoNativeIFrameTag",
- node,
- });
- }
- if (node.tag.property.name === "audio") {
- context.report({
- messageId: "NoNativeAudioTag",
- node,
- });
- }
- if (node.tag.property.name === "video") {
- context.report({
- messageId: "NoNativeVideoTag",
- node,
- });
- }
- },
- };
- },
+ name: 'warn-native-media-tag',
+ meta: {
+ type: 'problem',
+ docs: {
+ description: NoNativeImgTag,
+ recommended: 'warn',
+ },
+ fixable: undefined,
+ schema: [],
+ messages: {
+ NoNativeImgTag,
+ NoNativeIFrameTag,
+ NoNativeAudioTag,
+ NoNativeVideoTag,
+ },
+ },
+ defaultOptions: [],
+ create: (context) => {
+ return {
+ JSXOpeningElement: (node) => {
+ if (node.name.type === 'JSXIdentifier' && node.name.name === 'img') {
+ context.report({
+ messageId: 'NoNativeImgTag',
+ node,
+ });
+ }
+ if (node.name.type === 'JSXIdentifier' && node.name.name === 'iframe') {
+ context.report({
+ messageId: 'NoNativeIFrameTag',
+ node,
+ });
+ }
+ if (node.name.type === 'JSXIdentifier' && node.name.name === 'video') {
+ context.report({
+ messageId: 'NoNativeVideoTag',
+ node,
+ });
+ }
+ if (node.name.type === 'JSXIdentifier' && node.name.name === 'audio') {
+ context.report({
+ messageId: 'NoNativeAudioTag',
+ node,
+ });
+ }
+ },
+ TaggedTemplateExpression: (node) => {
+ if (node.tag.type !== 'MemberExpression') {
+ return;
+ }
+ if (node.tag.object.type !== 'Identifier') {
+ return;
+ }
+ if (node.tag.object.name !== 'styled') {
+ return;
+ }
+ if (node.tag.property.type !== 'Identifier') {
+ return;
+ }
+ if (node.tag.property.name === 'img') {
+ context.report({
+ messageId: 'NoNativeImgTag',
+ node,
+ });
+ }
+ if (node.tag.property.name === 'iframe') {
+ context.report({
+ messageId: 'NoNativeIFrameTag',
+ node,
+ });
+ }
+ if (node.tag.property.name === 'audio') {
+ context.report({
+ messageId: 'NoNativeAudioTag',
+ node,
+ });
+ }
+ if (node.tag.property.name === 'video') {
+ context.report({
+ messageId: 'NoNativeVideoTag',
+ node,
+ });
+ }
+ },
+ };
+ },
});
diff --git a/packages/eslint-plugin/src/tests/even-dimensions.test.ts b/packages/eslint-plugin/src/tests/even-dimensions.test.ts
index 2ad4b01620..d6c1414a47 100644
--- a/packages/eslint-plugin/src/tests/even-dimensions.test.ts
+++ b/packages/eslint-plugin/src/tests/even-dimensions.test.ts
@@ -1,18 +1,18 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/even-dimensions";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/even-dimensions';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("even-dimensions", rule, {
- valid: [
- `
+ruleTester.run('even-dimensions', rule, {
+ valid: [
+ `
import {Composition} from 'remotion';
export const Re = () => {
@@ -21,7 +21,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Composition} from 'remotion';
export const Re = () => {
@@ -30,7 +30,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Still} from 'remotion';
export const Re = () => {
@@ -39,10 +39,10 @@ export const Re = () => {
);
}
`,
- ],
- invalid: [
- {
- code: `
+ ],
+ invalid: [
+ {
+ code: `
import {Composition} from 'remotion';
export const Re = () => {
@@ -51,14 +51,14 @@ export const Re = () => {
);
}
`,
- errors: [
- {
- messageId: "EvenDimensions",
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'EvenDimensions',
+ },
+ ],
+ },
+ {
+ code: `
import {Composition} from 'remotion';
export const Re = () => {
@@ -67,11 +67,11 @@ export const Re = () => {
);
}
`,
- errors: [
- {
- messageId: "EvenDimensions",
- },
- ],
- },
- ],
+ errors: [
+ {
+ messageId: 'EvenDimensions',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/no-background-image.test.ts b/packages/eslint-plugin/src/tests/no-background-image.test.ts
index 7f23e18d82..1278788153 100644
--- a/packages/eslint-plugin/src/tests/no-background-image.test.ts
+++ b/packages/eslint-plugin/src/tests/no-background-image.test.ts
@@ -1,32 +1,32 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/no-background-image";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/no-background-image';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
+ parser: '@typescript-eslint/parser',
});
-ruleTester.run("no-background-image", rule, {
- valid: [
- `const hi = {"background-image": 0}`,
- 'const hi = {backgroundImage: "linear-gradient(to right, black, white)"}',
- `const hi = {backgroundImage: \`linear-gradient($\{hithere\})\`}`,
- ],
- invalid: [
- {
- code: `const hi = {backgroundImage: "url()"}`,
- errors: [
- {
- messageId: "BackgroundImage",
- },
- ],
- },
- {
- code: `const hi = {backgroundImage: \`url($\{hithere\})\`}`,
- errors: [
- {
- messageId: "BackgroundImage",
- },
- ],
- },
- ],
+ruleTester.run('no-background-image', rule, {
+ valid: [
+ `const hi = {"background-image": 0}`,
+ 'const hi = {backgroundImage: "linear-gradient(to right, black, white)"}',
+ `const hi = {backgroundImage: \`linear-gradient($\{hithere\})\`}`,
+ ],
+ invalid: [
+ {
+ code: `const hi = {backgroundImage: "url()"}`,
+ errors: [
+ {
+ messageId: 'BackgroundImage',
+ },
+ ],
+ },
+ {
+ code: `const hi = {backgroundImage: \`url($\{hithere\})\`}`,
+ errors: [
+ {
+ messageId: 'BackgroundImage',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/no-duration-frames-infinity.test.ts b/packages/eslint-plugin/src/tests/no-duration-frames-infinity.test.ts
index bf0252cf43..ee8f7d60e5 100644
--- a/packages/eslint-plugin/src/tests/no-duration-frames-infinity.test.ts
+++ b/packages/eslint-plugin/src/tests/no-duration-frames-infinity.test.ts
@@ -1,18 +1,18 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/no-duration-frames-infinity";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/no-duration-frames-infinity';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("no-duration-frames-infinity", rule, {
- valid: [
- `
+ruleTester.run('no-duration-frames-infinity', rule, {
+ valid: [
+ `
import {Sequence} from 'remotion';
export const Re = () => {
@@ -23,10 +23,10 @@ ruleTester.run("no-duration-frames-infinity", rule, {
);
}
`,
- ],
- invalid: [
- {
- code: `
+ ],
+ invalid: [
+ {
+ code: `
import {Composition} from 'remotion';
export const Re = () => {
@@ -37,7 +37,7 @@ ruleTester.run("no-duration-frames-infinity", rule, {
);
}
`,
- output: `
+ output: `
import {Composition} from 'remotion';
export const Re = () => {
@@ -48,11 +48,11 @@ ruleTester.run("no-duration-frames-infinity", rule, {
);
}
`,
- errors: [
- {
- messageId: "DurationInFrames",
- },
- ],
- },
- ],
+ errors: [
+ {
+ messageId: 'DurationInFrames',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/no-from-0.test.ts b/packages/eslint-plugin/src/tests/no-from-0.test.ts
index 1dfe811c26..f107c0d1d4 100644
--- a/packages/eslint-plugin/src/tests/no-from-0.test.ts
+++ b/packages/eslint-plugin/src/tests/no-from-0.test.ts
@@ -1,18 +1,18 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/no-from-0";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/no-from-0';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("no-duration-frames-infinity", rule, {
- valid: [
- `
+ruleTester.run('no-duration-frames-infinity', rule, {
+ valid: [
+ `
import {Sequence} from 'remotion';
export const Re = () => {
@@ -23,10 +23,10 @@ ruleTester.run("no-duration-frames-infinity", rule, {
);
}
`,
- ],
- invalid: [
- {
- code: `
+ ],
+ invalid: [
+ {
+ code: `
import {Composition, Sequence} from 'remotion';
export const Re = () => {
@@ -37,7 +37,7 @@ ruleTester.run("no-duration-frames-infinity", rule, {
);
}
`,
- output: `
+ output: `
import {Composition, Sequence} from 'remotion';
export const Re = () => {
@@ -48,11 +48,11 @@ ruleTester.run("no-duration-frames-infinity", rule, {
);
}
`,
- errors: [
- {
- messageId: "From0",
- },
- ],
- },
- ],
+ errors: [
+ {
+ messageId: 'From0',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/no-math-random.test.ts b/packages/eslint-plugin/src/tests/no-math-random.test.ts
index 31a0ff1aa7..4d9dabf076 100644
--- a/packages/eslint-plugin/src/tests/no-math-random.test.ts
+++ b/packages/eslint-plugin/src/tests/no-math-random.test.ts
@@ -1,19 +1,19 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/deterministic-randomness";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/deterministic-randomness';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
+ parser: '@typescript-eslint/parser',
});
-ruleTester.run("deterministic-randomness", rule, {
- valid: ['import {random} from "remotion";\nconst hi = random(null)'],
- invalid: [
- {
- code: "Math.random()",
- errors: [
- {
- messageId: "DeterministicRandomness",
- },
- ],
- },
- ],
+ruleTester.run('deterministic-randomness', rule, {
+ valid: ['import {random} from "remotion";\nconst hi = random(null)'],
+ invalid: [
+ {
+ code: 'Math.random()',
+ errors: [
+ {
+ messageId: 'DeterministicRandomness',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/no-mp4-import.test.ts b/packages/eslint-plugin/src/tests/no-mp4-import.test.ts
index b5632886c3..9770f5eeed 100644
--- a/packages/eslint-plugin/src/tests/no-mp4-import.test.ts
+++ b/packages/eslint-plugin/src/tests/no-mp4-import.test.ts
@@ -1,47 +1,47 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/no-mp4-import";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/no-mp4-import';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
+ parser: '@typescript-eslint/parser',
});
-ruleTester.run("no-mp4-import", rule, {
- valid: [
- 'const hi = require("hi")',
- 'import hi from "hi.mp3"',
- 'const falsePosition = ".mp4"; require("hi"+1+".png") ',
- ],
- invalid: [
- {
- code: 'const hi = require("hi.mp4")',
- errors: [
- {
- messageId: "NoMP4Import",
- },
- ],
- },
- {
- code: 'const hi = require("hi" + 2 + ".mp4")',
- errors: [
- {
- messageId: "NoMP4Import",
- },
- ],
- },
- {
- code: 'import "hi.mp4"',
- errors: [
- {
- messageId: "NoMP4Import",
- },
- ],
- },
- {
- code: 'import hi from "hi.mp4"',
- errors: [
- {
- messageId: "NoMP4Import",
- },
- ],
- },
- ],
+ruleTester.run('no-mp4-import', rule, {
+ valid: [
+ 'const hi = require("hi")',
+ 'import hi from "hi.mp3"',
+ 'const falsePosition = ".mp4"; require("hi"+1+".png") ',
+ ],
+ invalid: [
+ {
+ code: 'const hi = require("hi.mp4")',
+ errors: [
+ {
+ messageId: 'NoMP4Import',
+ },
+ ],
+ },
+ {
+ code: 'const hi = require("hi" + 2 + ".mp4")',
+ errors: [
+ {
+ messageId: 'NoMP4Import',
+ },
+ ],
+ },
+ {
+ code: 'import "hi.mp4"',
+ errors: [
+ {
+ messageId: 'NoMP4Import',
+ },
+ ],
+ },
+ {
+ code: 'import hi from "hi.mp4"',
+ errors: [
+ {
+ messageId: 'NoMP4Import',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/no-string-assets.test.ts b/packages/eslint-plugin/src/tests/no-string-assets.test.ts
index 6057aca58e..ea813d23af 100644
--- a/packages/eslint-plugin/src/tests/no-string-assets.test.ts
+++ b/packages/eslint-plugin/src/tests/no-string-assets.test.ts
@@ -1,19 +1,19 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/no-string-assets";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/no-string-assets';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("no-string-assets", rule, {
- valid: [
- // Network image should be allowed
- `
+ruleTester.run('no-string-assets', rule, {
+ valid: [
+ // Network image should be allowed
+ `
import {Img} from 'remotion';
export const Re = () => {
@@ -22,7 +22,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Img} from 'remotion';
export const Re = () => {
@@ -37,7 +37,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Img} from 'remotion';
import img from './img.png';
@@ -47,10 +47,10 @@ export const Re = () => {
);
}
`,
- ],
- invalid: [
- {
- code: `
+ ],
+ invalid: [
+ {
+ code: `
import {Img} from 'remotion';
export const Re = () => {
@@ -59,14 +59,14 @@ export const Re = () => {
);
}
`,
- errors: [
- {
- messageId: "NoStringAssets",
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'NoStringAssets',
+ },
+ ],
+ },
+ {
+ code: `
import {Img} from 'remotion';
export const Re = () => {
@@ -75,14 +75,14 @@ export const Re = () => {
);
}
`,
- errors: [
- {
- messageId: "NoStringAssets",
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'NoStringAssets',
+ },
+ ],
+ },
+ {
+ code: `
import {Audio} from 'remotion';
export const Re = () => {
@@ -91,11 +91,11 @@ export const Re = () => {
);
}
`,
- errors: [
- {
- messageId: "NoStringAssets",
- },
- ],
- },
- ],
+ errors: [
+ {
+ messageId: 'NoStringAssets',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/setup.ts b/packages/eslint-plugin/src/tests/setup.ts
index 3d06ee5fb9..553786781d 100644
--- a/packages/eslint-plugin/src/tests/setup.ts
+++ b/packages/eslint-plugin/src/tests/setup.ts
@@ -1,4 +1,4 @@
-import { describe, it } from "vitest";
+import {describe, it} from 'vitest';
// @ts-expect-error
global.describe = describe;
diff --git a/packages/eslint-plugin/src/tests/staticfile-no-relative.test.ts b/packages/eslint-plugin/src/tests/staticfile-no-relative.test.ts
index 9b2cb08deb..e4e9e28b12 100644
--- a/packages/eslint-plugin/src/tests/staticfile-no-relative.test.ts
+++ b/packages/eslint-plugin/src/tests/staticfile-no-relative.test.ts
@@ -1,18 +1,18 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/staticfile-no-relative";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/staticfile-no-relative';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("staticfile-no-relative", rule, {
- valid: [
- `
+ruleTester.run('staticfile-no-relative', rule, {
+ valid: [
+ `
import {Img, staticFile} from 'remotion';
export const Re = () => {
@@ -21,7 +21,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Img, staticFile} from 'remotion';
export const LeadingSlash = () => {
@@ -30,55 +30,55 @@ export const LeadingSlash = () => {
);
}
`,
- ],
- invalid: [
- {
- code: `
+ ],
+ invalid: [
+ {
+ code: `
import {staticFile} from 'remotion';
staticFile("./relative.png")
`,
- errors: [
- {
- messageId: "RelativePathStaticFile",
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'RelativePathStaticFile',
+ },
+ ],
+ },
+ {
+ code: `
import {staticFile} from 'remotion';
staticFile("./public/relative.png")
`,
- errors: [
- {
- messageId: "RelativePathStaticFile",
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'RelativePathStaticFile',
+ },
+ ],
+ },
+ {
+ code: `
import {staticFile} from 'remotion';
staticFile("public/relative.png")
`,
- errors: [
- {
- messageId: "PublicStaticFile",
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'PublicStaticFile',
+ },
+ ],
+ },
+ {
+ code: `
import {staticFile} from 'remotion';
staticFile("/Users/jonathanburger/remotion/packages/eslint-plugin")
`,
- errors: [
- {
- messageId: "AbsoluteStaticFile",
- },
- ],
- },
- ],
+ errors: [
+ {
+ messageId: 'AbsoluteStaticFile',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/staticfile-no-remote.test.ts b/packages/eslint-plugin/src/tests/staticfile-no-remote.test.ts
index d25a3a78f0..ff7c7e3eba 100644
--- a/packages/eslint-plugin/src/tests/staticfile-no-remote.test.ts
+++ b/packages/eslint-plugin/src/tests/staticfile-no-remote.test.ts
@@ -1,18 +1,18 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/staticfile-no-remote";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/staticfile-no-remote';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("staticfile-no-remote", rule, {
- valid: [
- `
+ruleTester.run('staticfile-no-remote', rule, {
+ valid: [
+ `
import {Img, staticFile} from 'remotion';
export const Re = () => {
@@ -21,31 +21,31 @@ export const Re = () => {
);
}
`,
- ],
- invalid: [
- {
- code: `
+ ],
+ invalid: [
+ {
+ code: `
import {staticFile} from 'remotion';
staticFile("http://relative.png")
`,
- errors: [
- {
- messageId: "RelativePathStaticFile",
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'RelativePathStaticFile',
+ },
+ ],
+ },
+ {
+ code: `
import {staticFile} from 'remotion';
staticFile("https://relative.png")
`,
- errors: [
- {
- messageId: "RelativePathStaticFile",
- },
- ],
- },
- ],
+ errors: [
+ {
+ messageId: 'RelativePathStaticFile',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/use-gif-component.test.ts b/packages/eslint-plugin/src/tests/use-gif-component.test.ts
index 1a7b2d6e98..fab0682aee 100644
--- a/packages/eslint-plugin/src/tests/use-gif-component.test.ts
+++ b/packages/eslint-plugin/src/tests/use-gif-component.test.ts
@@ -1,19 +1,19 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/use-gif-component";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/use-gif-component';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("use-gif-component", rule, {
- valid: [
- // Network image should be allowed
- `
+ruleTester.run('use-gif-component', rule, {
+ valid: [
+ // Network image should be allowed
+ `
import {Img} from 'remotion';
export const Re = () => {
@@ -22,7 +22,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Img, staticFile} from 'remotion';
export const Re = () => {
@@ -31,7 +31,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Img} from 'remotion';
export const Re = () => {
@@ -46,7 +46,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Img} from 'remotion';
import img from './img.png';
@@ -56,7 +56,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Gif} from '@remotion/gif';
import {staticFile} from 'remotion';
@@ -66,10 +66,10 @@ export const Re = () => {
);
}
`,
- ],
- invalid: [
- {
- code: `
+ ],
+ invalid: [
+ {
+ code: `
import {Img} from 'remotion';
export const Re = () => {
@@ -78,11 +78,11 @@ export const Re = () => {
);
}
`,
- errors: [
- {
- messageId: "UseGifComponent",
- },
- ],
- },
- ],
+ errors: [
+ {
+ messageId: 'UseGifComponent',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/v4-import.test.ts b/packages/eslint-plugin/src/tests/v4-import.test.ts
index 29a6879318..990a1b3377 100644
--- a/packages/eslint-plugin/src/tests/v4-import.test.ts
+++ b/packages/eslint-plugin/src/tests/v4-import.test.ts
@@ -1,31 +1,31 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/v4-import";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/v4-import';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
+ parser: '@typescript-eslint/parser',
});
-ruleTester.run("no-mp4-import", rule, {
- valid: [
- 'import {interpolate} from "remotion"',
- 'import {Config} from "@remotion/cli/config"',
- ],
- invalid: [
- {
- code: 'import {Config} from "remotion"',
- errors: [
- {
- messageId: "ImportConfig",
- },
- ],
- },
- {
- code: 'import {Config, interpolate} from "remotion"',
- errors: [
- {
- messageId: "ImportConfig",
- },
- ],
- },
- ],
+ruleTester.run('no-mp4-import', rule, {
+ valid: [
+ 'import {interpolate} from "remotion"',
+ 'import {Config} from "@remotion/cli/config"',
+ ],
+ invalid: [
+ {
+ code: 'import {Config} from "remotion"',
+ errors: [
+ {
+ messageId: 'ImportConfig',
+ },
+ ],
+ },
+ {
+ code: 'import {Config, interpolate} from "remotion"',
+ errors: [
+ {
+ messageId: 'ImportConfig',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/volume-callback.test.ts b/packages/eslint-plugin/src/tests/volume-callback.test.ts
index 23c8ab3599..a1146aee03 100644
--- a/packages/eslint-plugin/src/tests/volume-callback.test.ts
+++ b/packages/eslint-plugin/src/tests/volume-callback.test.ts
@@ -1,18 +1,18 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/volume-callback";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/volume-callback';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("volume-callback", rule, {
- valid: [
- `
+ruleTester.run('volume-callback', rule, {
+ valid: [
+ `
import {Video} from 'remotion';
export const Re = () => {
@@ -21,7 +21,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Video} from 'remotion';
export const Re = () => {
@@ -30,7 +30,7 @@ export const Re = () => {
);
}
`,
- `
+ `
import {Audio} from 'remotion';
export const Re = () => {
@@ -39,7 +39,7 @@ export const Re = () => {
);
}
`,
- `
+ `
const RandomComp = () => null;
export const Re = () => {
@@ -48,10 +48,10 @@ export const Re = () => {
);
}
`,
- ],
- invalid: [
- {
- code: `
+ ],
+ invalid: [
+ {
+ code: `
import {Video, useCurrentFrame} from 'remotion';
export const Re = () => {
@@ -62,14 +62,14 @@ export const Re = () => {
);
}
`,
- errors: [
- {
- messageId: "VolumeCallback",
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'VolumeCallback',
+ },
+ ],
+ },
+ {
+ code: `
import {Video, useCurrentFrame} from 'remotion';
export const Re = () => {
@@ -80,11 +80,11 @@ export const Re = () => {
);
}
`,
- errors: [
- {
- messageId: "VolumeCallback",
- },
- ],
- },
- ],
+ errors: [
+ {
+ messageId: 'VolumeCallback',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/eslint-plugin/src/tests/warn-native-image-tag.test.ts b/packages/eslint-plugin/src/tests/warn-native-image-tag.test.ts
index c1481e7438..5359e7e050 100644
--- a/packages/eslint-plugin/src/tests/warn-native-image-tag.test.ts
+++ b/packages/eslint-plugin/src/tests/warn-native-image-tag.test.ts
@@ -1,70 +1,70 @@
-import { ESLintUtils } from "@typescript-eslint/utils";
-import rule from "../rules/warn-native-media-tag";
+import {ESLintUtils} from '@typescript-eslint/utils';
+import rule from '../rules/warn-native-media-tag';
const ruleTester = new ESLintUtils.RuleTester({
- parser: "@typescript-eslint/parser",
- parserOptions: {
- ecmaFeatures: {
- jsx: true,
- },
- },
+ parser: '@typescript-eslint/parser',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
});
-ruleTester.run("warn-native-media-tag", rule, {
- valid: [
- "const hi = <div></div>",
- "const hi = <Img></Img>",
- "const hi = <IFrame/>",
- "const hi = <Audio/>",
- "const hi = styled(Audio)``",
- ],
- invalid: [
- {
- code: "const hi = <img/>",
- errors: [
- {
- messageId: "NoNativeImgTag",
- },
- ],
- },
- {
- code: "const hi = <img></img>",
- errors: [
- {
- messageId: "NoNativeImgTag",
- },
- ],
- },
- {
- code: "const hi = <iframe></iframe>",
- errors: [
- {
- messageId: "NoNativeIFrameTag",
- },
- ],
- },
- {
- code: "const hi = styled.img`color: blue;`",
- errors: [
- {
- messageId: "NoNativeImgTag",
- },
- ],
- },
- {
- code: "const hi = styled.iframe`color: blue;`",
- errors: [
- {
- messageId: "NoNativeIFrameTag",
- },
- ],
- },
- {
- code: "const hi = styled.video<{type: string}>`color: blue;`",
- errors: [
- {
- messageId: "NoNativeVideoTag",
- },
- ],
- },
- ],
+ruleTester.run('warn-native-media-tag', rule, {
+ valid: [
+ 'const hi = <div></div>',
+ 'const hi = <Img></Img>',
+ 'const hi = <IFrame/>',
+ 'const hi = <Audio/>',
+ 'const hi = styled(Audio)``',
+ ],
+ invalid: [
+ {
+ code: 'const hi = <img/>',
+ errors: [
+ {
+ messageId: 'NoNativeImgTag',
+ },
+ ],
+ },
+ {
+ code: 'const hi = <img></img>',
+ errors: [
+ {
+ messageId: 'NoNativeImgTag',
+ },
+ ],
+ },
+ {
+ code: 'const hi = <iframe></iframe>',
+ errors: [
+ {
+ messageId: 'NoNativeIFrameTag',
+ },
+ ],
+ },
+ {
+ code: 'const hi = styled.img`color: blue;`',
+ errors: [
+ {
+ messageId: 'NoNativeImgTag',
+ },
+ ],
+ },
+ {
+ code: 'const hi = styled.iframe`color: blue;`',
+ errors: [
+ {
+ messageId: 'NoNativeIFrameTag',
+ },
+ ],
+ },
+ {
+ code: 'const hi = styled.video<{type: string}>`color: blue;`',
+ errors: [
+ {
+ messageId: 'NoNativeVideoTag',
+ },
+ ],
+ },
+ ],
});
diff --git a/packages/example-without-zod/src/MyComposition.tsx b/packages/example-without-zod/src/MyComposition.tsx
index 90c3114108..b0d1fe1be4 100644
--- a/packages/example-without-zod/src/MyComposition.tsx
+++ b/packages/example-without-zod/src/MyComposition.tsx
@@ -1,3 +1,3 @@
export const MyComposition = () => {
- return null;
+ return null;
};
diff --git a/packages/example-without-zod/src/Root.tsx b/packages/example-without-zod/src/Root.tsx
index c54089872f..24226bbba7 100644
--- a/packages/example-without-zod/src/Root.tsx
+++ b/packages/example-without-zod/src/Root.tsx
@@ -1,18 +1,18 @@
-import React from "react";
-import { Composition } from "remotion";
-import { MyComposition } from "./MyComposition";
+import React from 'react';
+import {Composition} from 'remotion';
+import {MyComposition} from './MyComposition';
export const Root: React.FC = () => {
- return (
- <>
- <Composition
- id="MyComposition"
- component={MyComposition}
- fps={30}
- height={1080}
- width={1080}
- durationInFrames={60}
- />
- </>
- );
+ return (
+ <>
+ <Composition
+ id="MyComposition"
+ component={MyComposition}
+ fps={30}
+ height={1080}
+ width={1080}
+ durationInFrames={60}
+ />
+ </>
+ );
};
diff --git a/packages/example-without-zod/src/comp-type-tests.tsx b/packages/example-without-zod/src/comp-type-tests.tsx
index a59c5b7846..839599c787 100644
--- a/packages/example-without-zod/src/comp-type-tests.tsx
+++ b/packages/example-without-zod/src/comp-type-tests.tsx
@@ -1,72 +1,72 @@
-import React from "react";
-import { Still } from "remotion";
+import React from 'react';
+import {Still} from 'remotion';
// Test file just for making sure the types are sound
type MyComponentProps = {
- a: number;
- b: string;
+ a: number;
+ b: string;
};
function MyComponent(props: MyComponentProps) {
- return (
- <div>
- {props.a} {props.b}
- </div>
- );
+ return (
+ <div>
+ {props.a} {props.b}
+ </div>
+ );
}
<Still
- component={MyComponent}
- height={1080}
- width={1080}
- id="comps"
- defaultProps={{ a: 3, b: "2" }}
+ component={MyComponent}
+ height={1080}
+ width={1080}
+ id="comps"
+ defaultProps={{a: 3, b: '2'}}
/>;
<Still
- component={MyComponent}
- height={1080}
- width={1080}
- id="comps"
- // @ts-expect-error C should not be allowed
- defaultProps={{ c: "2" }}
+ component={MyComponent}
+ height={1080}
+ width={1080}
+ id="comps"
+ // @ts-expect-error C should not be allowed
+ defaultProps={{c: '2'}}
/>;
// React.FC syntax
const MyComponent2: React.FC<{
- c: number;
-}> = ({ c }) => {
- return <div>{c}</div>;
+ c: number;
+}> = ({c}) => {
+ return <div>{c}</div>;
};
<Still
- component={MyComponent2}
- height={1080}
- width={1080}
- id="comps"
- defaultProps={{ c: 2 }}
+ component={MyComponent2}
+ height={1080}
+ width={1080}
+ id="comps"
+ defaultProps={{c: 2}}
/>;
// React.FC syntax
const MyComponent3: React.FC<{
- a: number;
-}> = ({ a }) => {
- return <div>{a}</div>;
+ a: number;
+}> = ({a}) => {
+ return <div>{a}</div>;
};
// No more optional types
// @ts-expect-error Should be a type error
<Still component={MyComponent3} height={1080} width={1080} id="hithere" />;
<Still
- component={MyComponent3}
- height={1080}
- width={1080}
- id="hithere"
- defaultProps={{ a: 2 }}
+ component={MyComponent3}
+ height={1080}
+ width={1080}
+ id="hithere"
+ defaultProps={{a: 2}}
/>;
const CompWithNoProps: React.FC = () => {
- return <div />;
+ return <div />;
};
<Still component={CompWithNoProps} height={1080} width={1080} id="no-props" />;
diff --git a/packages/example-without-zod/src/index.ts b/packages/example-without-zod/src/index.ts
index e78af8ba34..69bbf506ad 100644
--- a/packages/example-without-zod/src/index.ts
+++ b/packages/example-without-zod/src/index.ts
@@ -1,4 +1,4 @@
-import { registerRoot } from "remotion";
-import { Root } from "./Root";
+import {registerRoot} from 'remotion';
+import {Root} from './Root';
registerRoot(Root);
diff --git a/packages/example/src/BetaText/index.tsx b/packages/example/src/BetaText/index.tsx
index c4206575f0..5b500b7053 100644
--- a/packages/example/src/BetaText/index.tsx
+++ b/packages/example/src/BetaText/index.tsx
@@ -146,7 +146,7 @@ const BetaText = ({
: key === 5
? 'REMOTION'
: key === 3
- ? word1 ?? 'COOL'
+ ? (word1 ?? 'COOL')
: key === 1
? 'LIT'
: 'BETA'
diff --git a/packages/gif/src/canvas.tsx b/packages/gif/src/canvas.tsx
index 0b1df0df10..2add3c61a5 100644
--- a/packages/gif/src/canvas.tsx
+++ b/packages/gif/src/canvas.tsx
@@ -109,13 +109,9 @@ export const Canvas = forwardRef(
const size = useElementSize(canvasRef);
- useImperativeHandle(
- ref,
- () => {
- return canvasRef.current as HTMLCanvasElement;
- },
- [],
- );
+ useImperativeHandle(ref, () => {
+ return canvasRef.current as HTMLCanvasElement;
+ }, []);
useEffect(() => {
if (!size) {
diff --git a/packages/gif/src/index.ts b/packages/gif/src/index.ts
index 465fe3f037..b61f7080db 100644
--- a/packages/gif/src/index.ts
+++ b/packages/gif/src/index.ts
@@ -1,4 +1,4 @@
-export {Gif} from './Gif';
export {getGifDurationInSeconds} from './get-gif-duration-in-seconds';
+export {Gif} from './Gif';
export {preloadGif} from './preload-gif';
export {GifFillMode, RemotionGifProps} from './props';
diff --git a/packages/install-whisper-cpp/src/transcribe.ts b/packages/install-whisper-cpp/src/transcribe.ts
index dc3450e834..4e6b88888a 100644
--- a/packages/install-whisper-cpp/src/transcribe.ts
+++ b/packages/install-whisper-cpp/src/transcribe.ts
@@ -294,7 +294,7 @@ export const transcribe = async <HasTokenLevelTimestamps extends boolean>({
translate: translateToEnglish,
tokenLevelTimestamps,
printOutput,
- tokensPerItem: tokenLevelTimestamps ? 1 : tokensPerItem ?? 1,
+ tokensPerItem: tokenLevelTimestamps ? 1 : (tokensPerItem ?? 1),
language: language ?? null,
signal: signal ?? null,
splitOnWord: splitOnWord ?? null,
diff --git a/packages/it-tests/src/templates/validate-templates.test.ts b/packages/it-tests/src/templates/validate-templates.test.ts
index dc2e3d0b1d..4a5dd9e2a2 100644
--- a/packages/it-tests/src/templates/validate-templates.test.ts
+++ b/packages/it-tests/src/templates/validate-templates.test.ts
@@ -156,5 +156,19 @@ describe('Templates should be valid', () => {
expect(references).toContain(template.templateInMonorepo);
}
});
+ if (!template.shortName.includes('JavaScript')) {
+ it(`${template.shortName} should exclude remotion.config.ts`, async () => {
+ const tsconfig = path.join(
+ process.cwd(),
+ '..',
+ template.templateInMonorepo,
+ 'tsconfig.json',
+ );
+ const contents = readFileSync(tsconfig, 'utf8');
+ const parsed = JSON.parse(contents);
+
+ expect(parsed.exclude).toContain('remotion.config.ts');
+ });
+ }
}
});
diff --git a/packages/lambda/src/api/get-compositions-on-lambda.ts b/packages/lambda/src/api/get-compositions-on-lambda.ts
index 4f887eb7e5..09eafd2849 100644
--- a/packages/lambda/src/api/get-compositions-on-lambda.ts
+++ b/packages/lambda/src/api/get-compositions-on-lambda.ts
@@ -82,7 +82,7 @@ export const getCompositionsOnLambda = async ({
serveUrl,
envVariables,
inputProps: serializedInputProps,
- logLevel: dumpBrowserLogs ? 'verbose' : logLevel ?? 'info',
+ logLevel: dumpBrowserLogs ? 'verbose' : (logLevel ?? 'info'),
timeoutInMilliseconds: timeoutInMilliseconds ?? 30000,
version: VERSION,
bucketName: bucketName ?? null,
diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.ts
index a77a11ca21..882036a378 100644
--- a/packages/lambda/src/api/render-still-on-lambda.ts
+++ b/packages/lambda/src/api/render-still-on-lambda.ts
@@ -197,7 +197,7 @@ export const renderStillOnLambda = (input: RenderStillOnLambdaInput) => {
region: input.region,
serveUrl: input.serveUrl,
jpegQuality: input.jpegQuality ?? 80,
- logLevel: input.dumpBrowserLogs ? 'verbose' : input.logLevel ?? 'info',
+ logLevel: input.dumpBrowserLogs ? 'verbose' : (input.logLevel ?? 'info'),
offthreadVideoCacheSizeInBytes:
input.offthreadVideoCacheSizeInBytes ?? null,
scale: input.scale ?? 1,
diff --git a/packages/lambda/src/client.ts b/packages/lambda/src/client.ts
index 96e015144d..efad02e928 100644
--- a/packages/lambda/src/client.ts
+++ b/packages/lambda/src/client.ts
@@ -28,9 +28,9 @@ import type {WebhookPayload} from './shared/invoke-webhook';
export {CustomCredentials, DeleteAfter} from '@remotion/serverless/client';
export {
+ getAwsClient,
GetAwsClientInput,
GetAwsClientOutput,
- getAwsClient,
} from './api/get-aws-client';
export type {AwsRegion} from './regions';
export {
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 29aa5a144a..39e0b1591e 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -332,7 +332,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({
params.bucketName,
typeof params.outName === 'string' || typeof params.outName === 'undefined'
? null
- : params.outName?.s3OutputProvider ?? null,
+ : (params.outName?.s3OutputProvider ?? null),
);
if (!params.overwrite) {
diff --git a/packages/lambda/src/io/write-file.ts b/packages/lambda/src/io/write-file.ts
index 5e0b573b1a..c86102fadc 100644
--- a/packages/lambda/src/io/write-file.ts
+++ b/packages/lambda/src/io/write-file.ts
@@ -34,7 +34,7 @@ const tryLambdaWriteFile = async ({
: 'public-read',
ExpectedBucketOwner: customCredentials
? undefined
- : expectedBucketOwner ?? undefined,
+ : (expectedBucketOwner ?? undefined),
ContentType: mimeTypes.lookup(key) || 'application/octet-stream',
ContentDisposition: getContentDispositionHeader(downloadBehavior),
}),
diff --git a/packages/lottie/src/index.ts b/packages/lottie/src/index.ts
index aa80f22014..1188e7a7bf 100644
--- a/packages/lottie/src/index.ts
+++ b/packages/lottie/src/index.ts
@@ -1,3 +1,3 @@
-export {Lottie} from './Lottie';
export {getLottieMetadata} from './get-lottie-metadata';
+export {Lottie} from './Lottie';
export type {LottieAnimationData, LottieProps} from './types';
diff --git a/packages/paths/src/index.ts b/packages/paths/src/index.ts
index 8a1aa8ae98..0fafb857e7 100644
--- a/packages/paths/src/index.ts
+++ b/packages/paths/src/index.ts
@@ -26,7 +26,7 @@ export {reversePath} from './reverse-path';
export {scalePath} from './scale-path';
export {serializeInstructions} from './serialize-instructions';
export {translatePath} from './translate-path';
-export {WarpPathFn, warpPath} from './warp-path';
+export {warpPath, WarpPathFn} from './warp-path';
export const PathInternals = {
getBoundingBoxFromInstructions,
diff --git a/packages/player-example/src/CarSlideshow.tsx b/packages/player-example/src/CarSlideshow.tsx
index 2400eff2b2..c78b375488 100644
--- a/packages/player-example/src/CarSlideshow.tsx
+++ b/packages/player-example/src/CarSlideshow.tsx
@@ -34,17 +34,13 @@ const CarSlideshow = ({title, bgColor, color}: Props) => {
return '';
}, [shouldThrowError]);
- useImperativeHandle(
- playerExampleComp,
- () => {
- return {
- triggerError: () => {
- setThrowError(true);
- },
- };
- },
- [],
- );
+ useImperativeHandle(playerExampleComp, () => {
+ return {
+ triggerError: () => {
+ setThrowError(true);
+ },
+ };
+ }, []);
return (
<div
diff --git a/packages/player/src/PlayerControls.tsx b/packages/player/src/PlayerControls.tsx
index 0c74efb561..12d8f4152c 100644
--- a/packages/player/src/PlayerControls.tsx
+++ b/packages/player/src/PlayerControls.tsx
@@ -324,7 +324,7 @@ export const Controls: React.FC<{
playing={player.playing}
/>
) : (
- renderPlayPauseButton({
+ (renderPlayPauseButton({
playing: player.playing,
isBuffering: buffering,
}) ?? (
@@ -332,7 +332,7 @@ export const Controls: React.FC<{
buffering={buffering}
playing={player.playing}
/>
- )
+ ))
)}
</button>
{showVolumeControls ? (
diff --git a/packages/player/src/PlayerUI.tsx b/packages/player/src/PlayerUI.tsx
index 629699aaa8..bf62947aa1 100644
--- a/packages/player/src/PlayerUI.tsx
+++ b/packages/player/src/PlayerUI.tsx
@@ -360,108 +360,104 @@ const PlayerUI: React.ForwardRefRenderFunction<
};
}, [bufferStateDelayInMilliseconds, player.emitter]);
- useImperativeHandle(
- ref,
- () => {
- const methods: PlayerMethods = {
- play: player.play,
- pause: () => {
- // If, after .seek()-ing, the player was explicitly paused, we don't resume
- setHasPausedToResume(false);
+ useImperativeHandle(ref, () => {
+ const methods: PlayerMethods = {
+ play: player.play,
+ pause: () => {
+ // If, after .seek()-ing, the player was explicitly paused, we don't resume
+ setHasPausedToResume(false);
+ player.pause();
+ },
+ toggle,
+ getContainerNode: () => container.current,
+ getCurrentFrame: player.getCurrentFrame,
+ isPlaying: player.isPlaying,
+ seekTo: (f) => {
+ const lastFrame = durationInFrames - 1;
+ const frameToSeekTo = Math.max(0, Math.min(lastFrame, f));
+
+ // continue playing after seeking if the player was playing before
+ if (player.isPlaying()) {
+ const pauseToResume = frameToSeekTo !== lastFrame || loop;
+ setHasPausedToResume(pauseToResume);
player.pause();
- },
- toggle,
- getContainerNode: () => container.current,
- getCurrentFrame: player.getCurrentFrame,
- isPlaying: player.isPlaying,
- seekTo: (f) => {
- const lastFrame = durationInFrames - 1;
- const frameToSeekTo = Math.max(0, Math.min(lastFrame, f));
-
- // continue playing after seeking if the player was playing before
- if (player.isPlaying()) {
- const pauseToResume = frameToSeekTo !== lastFrame || loop;
- setHasPausedToResume(pauseToResume);
- player.pause();
- }
+ }
- if (frameToSeekTo === lastFrame && !loop) {
- player.emitter.dispatchEnded();
- }
+ if (frameToSeekTo === lastFrame && !loop) {
+ player.emitter.dispatchEnded();
+ }
- player.seek(frameToSeekTo);
- },
- isFullscreen: () => {
- const {current} = container;
- if (!current) {
- return false;
- }
+ player.seek(frameToSeekTo);
+ },
+ isFullscreen: () => {
+ const {current} = container;
+ if (!current) {
+ return false;
+ }
- return (
- document.fullscreenElement === current ||
- // @ts-expect-error Types not defined
- document.webkitFullscreenElement === current
- );
- },
- requestFullscreen,
- exitFullscreen,
- getVolume: () => {
- if (mediaMuted) {
- return 0;
- }
+ return (
+ document.fullscreenElement === current ||
+ // @ts-expect-error Types not defined
+ document.webkitFullscreenElement === current
+ );
+ },
+ requestFullscreen,
+ exitFullscreen,
+ getVolume: () => {
+ if (mediaMuted) {
+ return 0;
+ }
- return mediaVolume;
- },
- setVolume: (vol: number) => {
- if (typeof vol !== 'number') {
- throw new TypeError(
- `setVolume() takes a number, got value of type ${typeof vol}`,
- );
- }
+ return mediaVolume;
+ },
+ setVolume: (vol: number) => {
+ if (typeof vol !== 'number') {
+ throw new TypeError(
+ `setVolume() takes a number, got value of type ${typeof vol}`,
+ );
+ }
- if (isNaN(vol)) {
- throw new TypeError(
- `setVolume() got a number that is NaN. Volume must be between 0 and 1.`,
- );
- }
+ if (isNaN(vol)) {
+ throw new TypeError(
+ `setVolume() got a number that is NaN. Volume must be between 0 and 1.`,
+ );
+ }
- if (vol < 0 || vol > 1) {
- throw new TypeError(
- `setVolume() got a number that is out of range. Must be between 0 and 1, got ${typeof vol}`,
- );
- }
+ if (vol < 0 || vol > 1) {
+ throw new TypeError(
+ `setVolume() got a number that is out of range. Must be between 0 and 1, got ${typeof vol}`,
+ );
+ }
- setMediaVolume(vol);
- },
- isMuted: () => isMuted,
- mute: () => {
- setMediaMuted(true);
- },
- unmute: () => {
- setMediaMuted(false);
- },
- getScale: () => scale,
- pauseAndReturnToPlayStart: () => {
- player.pauseAndReturnToPlayStart();
- },
- };
- return Object.assign(player.emitter, methods);
- },
- [
- durationInFrames,
- exitFullscreen,
- loop,
- mediaMuted,
- isMuted,
- mediaVolume,
- player,
- requestFullscreen,
- setMediaMuted,
- setMediaVolume,
- toggle,
- scale,
- ],
- );
+ setMediaVolume(vol);
+ },
+ isMuted: () => isMuted,
+ mute: () => {
+ setMediaMuted(true);
+ },
+ unmute: () => {
+ setMediaMuted(false);
+ },
+ getScale: () => scale,
+ pauseAndReturnToPlayStart: () => {
+ player.pauseAndReturnToPlayStart();
+ },
+ };
+ return Object.assign(player.emitter, methods);
+ }, [
+ durationInFrames,
+ exitFullscreen,
+ loop,
+ mediaMuted,
+ isMuted,
+ mediaVolume,
+ player,
+ requestFullscreen,
+ setMediaMuted,
+ setMediaVolume,
+ toggle,
+ scale,
+ ]);
const VideoComponent = video ? video.component : null;
diff --git a/packages/player/src/ThumbnailUI.tsx b/packages/player/src/ThumbnailUI.tsx
index 4c21248d49..f02575fe92 100644
--- a/packages/player/src/ThumbnailUI.tsx
+++ b/packages/player/src/ThumbnailUI.tsx
@@ -72,17 +72,13 @@ const ThumbnailUI: React.ForwardRefRenderFunction<
useBufferStateEmitter(thumbnail.emitter);
- useImperativeHandle(
- ref,
- () => {
- const methods: ThumbnailMethods = {
- getContainerNode: () => container.current,
- getScale: () => scale,
- };
- return Object.assign(thumbnail.emitter, methods);
- },
- [scale, thumbnail.emitter],
- );
+ useImperativeHandle(ref, () => {
+ const methods: ThumbnailMethods = {
+ getContainerNode: () => container.current,
+ getScale: () => scale,
+ };
+ return Object.assign(thumbnail.emitter, methods);
+ }, [scale, thumbnail.emitter]);
const VideoComponent = video ? video.component : null;
diff --git a/packages/renderer/src/open-browser.ts b/packages/renderer/src/open-browser.ts
index adc6f02999..a1050c0380 100644
--- a/packages/renderer/src/open-browser.ts
+++ b/packages/renderer/src/open-browser.ts
@@ -183,7 +183,7 @@ export const internalOpenBrowser = async ({
'--enable-blink-features=IdleDetection',
'--export-tagged-pdf',
'--intensive-wake-up-throttling-policy=0',
- chromiumOptions.headless ?? true ? '--headless=old' : null,
+ (chromiumOptions.headless ?? true) ? '--headless=old' : null,
'--no-sandbox',
'--disable-setuid-sandbox',
...customGlRenderer,
diff --git a/packages/renderer/src/render-frames.ts b/packages/renderer/src/render-frames.ts
index c43500e77a..6ac7605d8f 100644
--- a/packages/renderer/src/render-frames.ts
+++ b/packages/renderer/src/render-frames.ts
@@ -1049,7 +1049,7 @@ export const renderFrames = (
}
const logLevel: LogLevel =
- verbose || dumpBrowserLogs ? 'verbose' : passedLogLevel ?? 'info';
+ verbose || dumpBrowserLogs ? 'verbose' : (passedLogLevel ?? 'info');
const indent = false;
if (quality) {
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index a0a363e9a4..ea3f1acd73 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -894,7 +894,7 @@ export const renderMedia = ({
const indent = false;
const logLevel =
- verbose || dumpBrowserLogs ? 'verbose' : passedLogLevel ?? 'info';
+ verbose || dumpBrowserLogs ? 'verbose' : (passedLogLevel ?? 'info');
return internalRenderMedia({
proResProfile: proResProfile ?? undefined,
diff --git a/packages/renderer/src/select-composition.ts b/packages/renderer/src/select-composition.ts
index 0f90bdc9e4..035dcdea01 100644
--- a/packages/renderer/src/select-composition.ts
+++ b/packages/renderer/src/select-composition.ts
@@ -316,7 +316,7 @@ export const selectComposition = async (
} = options;
const indent = false;
- const logLevel = passedLogLevel ?? verbose ? 'verbose' : 'info';
+ const logLevel = (passedLogLevel ?? verbose) ? 'verbose' : 'info';
const data = await internalSelectComposition({
id,
diff --git a/packages/renderer/src/take-frame-and-compose.ts b/packages/renderer/src/take-frame-and-compose.ts
index 8f47880a9e..1d3ee9ebfc 100644
--- a/packages/renderer/src/take-frame-and-compose.ts
+++ b/packages/renderer/src/take-frame-and-compose.ts
@@ -84,7 +84,7 @@ export const takeFrameAndCompose = async ({
jpegQuality,
options: {
frame,
- output: shouldMakeBuffer ? null : needsComposing?.tmpFile ?? output,
+ output: shouldMakeBuffer ? null : (needsComposing?.tmpFile ?? output),
},
height,
width,
diff --git a/packages/rive/src/RemotionRiveCanvas.tsx b/packages/rive/src/RemotionRiveCanvas.tsx
index 4612bfd1a3..31723d5ef6 100644
--- a/packages/rive/src/RemotionRiveCanvas.tsx
+++ b/packages/rive/src/RemotionRiveCanvas.tsx
@@ -83,26 +83,22 @@ const RemotionRiveCanvasForwardRefFunction: React.ForwardRefRenderFunction<
file: File;
} | null>(null);
- useImperativeHandle(
- ref,
- () => {
- return {
- getAnimationInstance() {
- return rive?.animation ?? null;
- },
- getArtboard() {
- return rive?.artboard ?? null;
- },
- getRenderer() {
- return rive?.renderer ?? null;
- },
- getCanvas() {
- return riveCanvasInstance ?? null;
- },
- };
- },
- [rive, riveCanvasInstance],
- );
+ useImperativeHandle(ref, () => {
+ return {
+ getAnimationInstance() {
+ return rive?.animation ?? null;
+ },
+ getArtboard() {
+ return rive?.artboard ?? null;
+ },
+ getRenderer() {
+ return rive?.renderer ?? null;
+ },
+ getCanvas() {
+ return riveCanvasInstance ?? null;
+ },
+ };
+ }, [rive, riveCanvasInstance]);
useEffect(() => {
riveCanvas({
diff --git a/packages/studio-server/src/index.ts b/packages/studio-server/src/index.ts
index 4bb90c8647..64ee49b718 100644
--- a/packages/studio-server/src/index.ts
+++ b/packages/studio-server/src/index.ts
@@ -2,8 +2,8 @@ import {formatBytes} from '@remotion/studio-shared';
export {
ApiRoutes,
CopyStillToClipboardRequest,
- OpenInFileExplorerRequest,
getDefaultOutLocation,
+ OpenInFileExplorerRequest,
} from '@remotion/studio-shared';
export type {
AggregateRenderProgress,
@@ -15,9 +15,9 @@ export type {
ModuleMap,
PackageManager,
ProjectInfo,
+ RenderingProgressInput,
RenderJob,
RenderJobWithCleanup,
- RenderingProgressInput,
RequiredChromiumOptions,
StitchingProgressInput,
UiOpenGlOptions,
diff --git a/packages/studio/src/components/CompositionSelector.tsx b/packages/studio/src/components/CompositionSelector.tsx
index 6d93b212c6..b24c00ee99 100644
--- a/packages/studio/src/components/CompositionSelector.tsx
+++ b/packages/studio/src/components/CompositionSelector.tsx
@@ -84,56 +84,50 @@ export const CompositionSelector: React.FC = () => {
[],
);
- useImperativeHandle(
- compositionSelectorRef,
- () => {
- return {
- expandComposition: (compName) => {
- const compositionToExpand = compositions.find(
- (c) => c.id === compName,
- );
- if (!compositionToExpand) {
- return;
- }
+ useImperativeHandle(compositionSelectorRef, () => {
+ return {
+ expandComposition: (compName) => {
+ const compositionToExpand = compositions.find((c) => c.id === compName);
+ if (!compositionToExpand) {
+ return;
+ }
+
+ const {folderName, parentFolderName} = compositionToExpand;
+ if (folderName === null) {
+ return;
+ }
+
+ setFoldersExpanded((previousState) => {
+ const foldersExpandedState: ExpandedFoldersState = {
+ ...previousState,
+ };
+
+ const currentFolder: string | null = folderName;
+ const currentParentName: string | null = parentFolderName;
+ const key = openFolderKey({
+ folderName: currentFolder,
+ parentName: currentParentName,
+ });
- const {folderName, parentFolderName} = compositionToExpand;
- if (folderName === null) {
- return;
+ const splitted = key.split('/');
+ for (let i = 0; i < splitted.length - 1; i++) {
+ const allExceptLast =
+ i === 0
+ ? openFolderKey({
+ folderName: splitted.filter((s) => s !== 'no-parent')[0],
+ parentName: null,
+ })
+ : splitted.slice(0, i + 1).join('/');
+ foldersExpandedState[allExceptLast] = true;
}
- setFoldersExpanded((previousState) => {
- const foldersExpandedState: ExpandedFoldersState = {
- ...previousState,
- };
-
- const currentFolder: string | null = folderName;
- const currentParentName: string | null = parentFolderName;
- const key = openFolderKey({
- folderName: currentFolder,
- parentName: currentParentName,
- });
-
- const splitted = key.split('/');
- for (let i = 0; i < splitted.length - 1; i++) {
- const allExceptLast =
- i === 0
- ? openFolderKey({
- folderName: splitted.filter((s) => s !== 'no-parent')[0],
- parentName: null,
- })
- : splitted.slice(0, i + 1).join('/');
- foldersExpandedState[allExceptLast] = true;
- }
-
- persistExpandedFolders('compositions', foldersExpandedState);
-
- return foldersExpandedState;
- });
- },
- };
- },
- [compositions],
- );
+ persistExpandedFolders('compositions', foldersExpandedState);
+
+ return foldersExpandedState;
+ });
+ },
+ };
+ }, [compositions]);
const items = useMemo(() => {
return createFolderTree(compositions, folders, foldersExpanded);
diff --git a/packages/studio/src/components/ExplorerPanel.tsx b/packages/studio/src/components/ExplorerPanel.tsx
index e1f27b4e7d..52729de284 100644
--- a/packages/studio/src/components/ExplorerPanel.tsx
+++ b/packages/studio/src/components/ExplorerPanel.tsx
@@ -55,22 +55,18 @@ export const ExplorerPanel: React.FC<{
persistSelectedOptionsSidebarPanel('assets');
}, []);
- useImperativeHandle(
- explorerSidebarTabs,
- () => {
- return {
- selectAssetsPanel: () => {
- setPanel('assets');
- persistSelectedOptionsSidebarPanel('assets');
- },
- selectCompositionPanel: () => {
- setPanel('compositions');
- persistSelectedOptionsSidebarPanel('compositions');
- },
- };
- },
- [],
- );
+ useImperativeHandle(explorerSidebarTabs, () => {
+ return {
+ selectAssetsPanel: () => {
+ setPanel('assets');
+ persistSelectedOptionsSidebarPanel('assets');
+ },
+ selectCompositionPanel: () => {
+ setPanel('compositions');
+ persistSelectedOptionsSidebarPanel('compositions');
+ },
+ };
+ }, []);
return (
<div style={container} className="css-reset">
diff --git a/packages/studio/src/components/NewComposition/RemInput.tsx b/packages/studio/src/components/NewComposition/RemInput.tsx
index c300b1fde3..ce4d5b4ea5 100644
--- a/packages/studio/src/components/NewComposition/RemInput.tsx
+++ b/packages/studio/src/components/NewComposition/RemInput.tsx
@@ -84,13 +84,9 @@ const RemInputForwardRef: React.ForwardRefRenderFunction<
};
}, [isFocused, isHovered, rightAlign, props.style, status]);
- useImperativeHandle(
- ref,
- () => {
- return inputRef.current as HTMLInputElement;
- },
- [],
- );
+ useImperativeHandle(ref, () => {
+ return inputRef.current as HTMLInputElement;
+ }, []);
useEffect(() => {
if (!inputRef.current) {
diff --git a/packages/studio/src/components/NewComposition/RemInputTypeColor.tsx b/packages/studio/src/components/NewComposition/RemInputTypeColor.tsx
index 194459e316..03c72474bb 100644
--- a/packages/studio/src/components/NewComposition/RemInputTypeColor.tsx
+++ b/packages/studio/src/components/NewComposition/RemInputTypeColor.tsx
@@ -43,13 +43,9 @@ const RemInputTypeColorForwardRef: React.ForwardRefRenderFunction<
};
}, [isFocused, isHovered, props.style, status]);
- useImperativeHandle(
- ref,
- () => {
- return inputRef.current as HTMLInputElement;
- },
- [],
- );
+ useImperativeHandle(ref, () => {
+ return inputRef.current as HTMLInputElement;
+ }, []);
useEffect(() => {
if (!inputRef.current) {
diff --git a/packages/studio/src/components/NewComposition/RemTextarea.tsx b/packages/studio/src/components/NewComposition/RemTextarea.tsx
index 1777ae8d40..6a7fd182bb 100644
--- a/packages/studio/src/components/NewComposition/RemTextarea.tsx
+++ b/packages/studio/src/components/NewComposition/RemTextarea.tsx
@@ -40,13 +40,9 @@ const RemTextareaFRFunction: React.ForwardRefRenderFunction<
const inputRef = useRef<HTMLTextAreaElement>(null);
const {tabIndex} = useZIndex();
- useImperativeHandle(
- ref,
- () => {
- return inputRef.current as HTMLTextAreaElement;
- },
- [],
- );
+ useImperativeHandle(ref, () => {
+ return inputRef.current as HTMLTextAreaElement;
+ }, []);
const style = useMemo(() => {
return {
diff --git a/packages/studio/src/components/Notifications/NotificationCenter.tsx b/packages/studio/src/components/Notifications/NotificationCenter.tsx
index 7ce3d1b1e4..a8fdcd1c8f 100644
--- a/packages/studio/src/components/Notifications/NotificationCenter.tsx
+++ b/packages/studio/src/components/Notifications/NotificationCenter.tsx
@@ -90,15 +90,11 @@ export const NotificationCenter: React.FC = () => {
[],
);
- useImperativeHandle(
- notificationCenter,
- () => {
- return {
- addNotification,
- };
- },
- [addNotification],
- );
+ useImperativeHandle(notificationCenter, () => {
+ return {
+ addNotification,
+ };
+ }, [addNotification]);
return (
<div style={container}>
diff --git a/packages/studio/src/components/OptionsPanel.tsx b/packages/studio/src/components/OptionsPanel.tsx
index f05cb2e118..c0f9a4e8e9 100644
--- a/packages/studio/src/components/OptionsPanel.tsx
+++ b/packages/studio/src/components/OptionsPanel.tsx
@@ -84,18 +84,14 @@ export const OptionsPanel: React.FC<{
persistSelectedOptionsSidebarPanel('renders');
}, []);
- useImperativeHandle(
- optionsSidebarTabs,
- () => {
- return {
- selectRendersPanel: () => {
- setPanel('renders');
- persistSelectedOptionsSidebarPanel('renders');
- },
- };
- },
- [],
- );
+ useImperativeHandle(optionsSidebarTabs, () => {
+ return {
+ selectRendersPanel: () => {
+ setPanel('renders');
+ persistSelectedOptionsSidebarPanel('renders');
+ },
+ };
+ }, []);
const {compositions, canvasContent} = useContext(
Internals.CompositionManager,
diff --git a/packages/studio/src/components/RenderQueue/context.tsx b/packages/studio/src/components/RenderQueue/context.tsx
index f6d4aab025..521f506194 100644
--- a/packages/studio/src/components/RenderQueue/context.tsx
+++ b/packages/studio/src/components/RenderQueue/context.tsx
@@ -32,17 +32,13 @@ export const RenderQueueContextProvider: React.FC<{
};
}, [jobs]);
- useImperativeHandle(
- renderJobsRef,
- () => {
- return {
- updateRenderJobs: (newJobs) => {
- setJobs(newJobs);
- },
- };
- },
- [],
- );
+ useImperativeHandle(renderJobsRef, () => {
+ return {
+ updateRenderJobs: (newJobs) => {
+ setJobs(newJobs);
+ },
+ };
+ }, []);
return (
<RenderQueueContext.Provider value={value}>
diff --git a/packages/studio/src/components/Timeline/TimelinePlayCursorSyncer.tsx b/packages/studio/src/components/Timeline/TimelinePlayCursorSyncer.tsx
index 96a183f53f..2a8b73d668 100644
--- a/packages/studio/src/components/Timeline/TimelinePlayCursorSyncer.tsx
+++ b/packages/studio/src/components/Timeline/TimelinePlayCursorSyncer.tsx
@@ -40,7 +40,7 @@ export const TimelinePlayCursorSyncer: React.FC = () => {
? canvasContent.compositionId
: null;
const zoom = compositionId
- ? zoomMap[compositionId] ?? TIMELINE_MIN_ZOOM
+ ? (zoomMap[compositionId] ?? TIMELINE_MIN_ZOOM)
: null;
if (zoom && video) {
diff --git a/packages/studio/src/components/Timeline/TimelineSlider.tsx b/packages/studio/src/components/Timeline/TimelineSlider.tsx
index 1d1f8cd94f..439749cba8 100644
--- a/packages/studio/src/components/Timeline/TimelineSlider.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSlider.tsx
@@ -63,26 +63,22 @@ const Inner: React.FC = () => {
};
}, [timelinePosition, videoConfig.durationInFrames, timelineWidth]);
- useImperativeHandle(
- redrawTimelineSliderFast,
- () => {
- return {
- draw: (frame, width?: number) => {
- const {current} = ref;
- if (!current) {
- throw new Error('unexpectedly did not have ref to timelineslider');
- }
+ useImperativeHandle(redrawTimelineSliderFast, () => {
+ return {
+ draw: (frame, width?: number) => {
+ const {current} = ref;
+ if (!current) {
+ throw new Error('unexpectedly did not have ref to timelineslider');
+ }
- current.style.transform = `translateX(${getXPositionOfItemInTimelineImperatively(
- frame,
- getCurrentDuration(),
- width ?? (sliderAreaRef.current?.clientWidth as number) ?? 0,
- )}px)`;
- },
- };
- },
- [],
- );
+ current.style.transform = `translateX(${getXPositionOfItemInTimelineImperatively(
+ frame,
+ getCurrentDuration(),
+ width ?? (sliderAreaRef.current?.clientWidth as number) ?? 0,
+ )}px)`;
+ },
+ };
+ }, []);
useEffect(() => {
const currentRef = ref.current;
diff --git a/packages/studio/src/components/TimelineInOutToggle.tsx b/packages/studio/src/components/TimelineInOutToggle.tsx
index 67795efde8..c6c942edf5 100644
--- a/packages/studio/src/components/TimelineInOutToggle.tsx
+++ b/packages/studio/src/components/TimelineInOutToggle.tsx
@@ -279,23 +279,19 @@ export const TimelineInOutPointToggle: React.FC = () => {
};
}, [confId, keybindings, onInMark, onInOutClear, onOutMark]);
- useImperativeHandle(
- inOutHandles,
- () => {
- return {
- clearMarks: () => {
- if (!confId) {
- return;
- }
+ useImperativeHandle(inOutHandles, () => {
+ return {
+ clearMarks: () => {
+ if (!confId) {
+ return;
+ }
- onInOutClear(confId);
- },
- inMarkClick: onInMark,
- outMarkClick: onOutMark,
- };
- },
- [confId, onInMark, onInOutClear, onOutMark],
- );
+ onInOutClear(confId);
+ },
+ inMarkClick: onInMark,
+ outMarkClick: onOutMark,
+ };
+ }, [confId, onInMark, onInOutClear, onOutMark]);
return (
<>
diff --git a/packages/studio/src/error-overlay/remotion-overlay/Overlay.tsx b/packages/studio/src/error-overlay/remotion-overlay/Overlay.tsx
index b49c7a0d3e..96a6b116a5 100644
--- a/packages/studio/src/error-overlay/remotion-overlay/Overlay.tsx
+++ b/packages/studio/src/error-overlay/remotion-overlay/Overlay.tsx
@@ -52,13 +52,9 @@ export const Overlay: React.FC = () => {
});
}, []);
- useImperativeHandle(
- setErrorsRef,
- () => {
- return {setErrors, addError};
- },
- [addError],
- );
+ useImperativeHandle(setErrorsRef, () => {
+ return {setErrors, addError};
+ }, [addError]);
if (errors.type === 'clear') {
return null;
diff --git a/packages/template-audiogram/tsconfig.json b/packages/template-audiogram/tsconfig.json
index bb881cc903..faa8d16d1e 100644
--- a/packages/template-audiogram/tsconfig.json
+++ b/packages/template-audiogram/tsconfig.json
@@ -11,5 +11,6 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-blank/tsconfig.json b/packages/template-blank/tsconfig.json
index bb881cc903..faa8d16d1e 100644
--- a/packages/template-blank/tsconfig.json
+++ b/packages/template-blank/tsconfig.json
@@ -11,5 +11,6 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-code-hike/tsconfig.json b/packages/template-code-hike/tsconfig.json
index 084df63683..a1c86cde4e 100644
--- a/packages/template-code-hike/tsconfig.json
+++ b/packages/template-code-hike/tsconfig.json
@@ -1,17 +1,17 @@
{
- "compilerOptions": {
- "target": "ES2021",
- "module": "Preserve",
- "moduleResolution": "Bundler",
- "jsx": "react-jsx",
- "outDir": "./dist",
- "strict": true,
- "noEmit": true,
- "lib": ["ES2021"],
- "esModuleInterop": true,
- "skipLibCheck": true,
- "forceConsistentCasingInFileNames": true,
- "noUnusedLocals": true
- },
- "exclude": ["public"]
+ "compilerOptions": {
+ "target": "ES2021",
+ "module": "Preserve",
+ "moduleResolution": "Bundler",
+ "jsx": "react-jsx",
+ "outDir": "./dist",
+ "strict": true,
+ "noEmit": true,
+ "lib": ["ES2021"],
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "noUnusedLocals": true
+ },
+ "exclude": ["public", "remotion.config.ts"]
}
diff --git a/packages/template-helloworld/tsconfig.json b/packages/template-helloworld/tsconfig.json
index bb881cc903..faa8d16d1e 100644
--- a/packages/template-helloworld/tsconfig.json
+++ b/packages/template-helloworld/tsconfig.json
@@ -11,5 +11,6 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-next-app-tailwind/tsconfig.json b/packages/template-next-app-tailwind/tsconfig.json
index fcb631c1b0..2f85e90fc0 100644
--- a/packages/template-next-app-tailwind/tsconfig.json
+++ b/packages/template-next-app-tailwind/tsconfig.json
@@ -28,5 +28,5 @@
".next/types/**/*.ts",
"remotion/webpack-override.mjs"
],
- "exclude": ["node_modules"]
+ "exclude": ["node_modules", "remotion.config.ts"]
}
diff --git a/packages/template-next-app/tsconfig.json b/packages/template-next-app/tsconfig.json
index 0266bde2fd..73d689f417 100644
--- a/packages/template-next-app/tsconfig.json
+++ b/packages/template-next-app/tsconfig.json
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
- "lib": [
- "dom",
- "dom.iterable",
- "esnext"
- ],
+ "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@@ -25,13 +21,6 @@
}
]
},
- "include": [
- "next-env.d.ts",
- "**/*.ts",
- "**/*.tsx",
- ".next/types/**/*.ts"
- ],
- "exclude": [
- "node_modules"
- ]
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
+ "exclude": ["node_modules", "remotion.config.ts"]
}
diff --git a/packages/template-next-pages/tsconfig.json b/packages/template-next-pages/tsconfig.json
index f2b2c6b44d..cef6699d29 100644
--- a/packages/template-next-pages/tsconfig.json
+++ b/packages/template-next-pages/tsconfig.json
@@ -17,5 +17,5 @@
"noUnusedLocals": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
- "exclude": ["node_modules"]
+ "exclude": ["node_modules", "remotion.config.ts"]
}
diff --git a/packages/template-overlay/tsconfig.json b/packages/template-overlay/tsconfig.json
index bb881cc903..faa8d16d1e 100644
--- a/packages/template-overlay/tsconfig.json
+++ b/packages/template-overlay/tsconfig.json
@@ -11,5 +11,6 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-remix/tsconfig.json b/packages/template-remix/tsconfig.json
index d182c35f07..778ed59059 100644
--- a/packages/template-remix/tsconfig.json
+++ b/packages/template-remix/tsconfig.json
@@ -17,7 +17,7 @@
"paths": {
"~/*": ["./app/*"]
},
- // Remix takes care of building everything in `remix build`.
"noEmit": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-skia/tsconfig.json b/packages/template-skia/tsconfig.json
index a50998b64a..3e0e970460 100644
--- a/packages/template-skia/tsconfig.json
+++ b/packages/template-skia/tsconfig.json
@@ -1,15 +1,16 @@
{
- "compilerOptions": {
- "target": "ES2018",
- "module": "commonjs",
- "jsx": "react-jsx",
- "outDir": "./dist",
- "strict": true,
- "noEmit": true,
- "lib": ["es2015"],
- "esModuleInterop": true,
- "skipLibCheck": true,
- "forceConsistentCasingInFileNames": true,
- "noUnusedLocals": false
- }
+ "compilerOptions": {
+ "target": "ES2018",
+ "module": "commonjs",
+ "jsx": "react-jsx",
+ "outDir": "./dist",
+ "strict": true,
+ "noEmit": true,
+ "lib": ["es2015"],
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "noUnusedLocals": false
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-stargazer/tsconfig.json b/packages/template-stargazer/tsconfig.json
index 900990487a..e7291f0bc0 100644
--- a/packages/template-stargazer/tsconfig.json
+++ b/packages/template-stargazer/tsconfig.json
@@ -12,5 +12,6 @@
"forceConsistentCasingInFileNames": true,
"strictNullChecks": true,
"noUnusedLocals": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-three/tsconfig.json b/packages/template-three/tsconfig.json
index bb881cc903..faa8d16d1e 100644
--- a/packages/template-three/tsconfig.json
+++ b/packages/template-three/tsconfig.json
@@ -11,5 +11,6 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-tiktok/tsconfig.json b/packages/template-tiktok/tsconfig.json
index 0a292af5f2..faa8d16d1e 100644
--- a/packages/template-tiktok/tsconfig.json
+++ b/packages/template-tiktok/tsconfig.json
@@ -1,15 +1,16 @@
{
- "compilerOptions": {
- "target": "ES2018",
- "module": "commonjs",
- "jsx": "react-jsx",
- "outDir": "./dist",
- "strict": true,
- "noEmit": true,
- "lib": ["es2015"],
- "esModuleInterop": true,
- "skipLibCheck": true,
- "forceConsistentCasingInFileNames": true,
- "noUnusedLocals": true
- }
+ "compilerOptions": {
+ "target": "ES2018",
+ "module": "commonjs",
+ "jsx": "react-jsx",
+ "outDir": "./dist",
+ "strict": true,
+ "noEmit": true,
+ "lib": ["es2015"],
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "noUnusedLocals": true
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-tts-azure/tsconfig.json b/packages/template-tts-azure/tsconfig.json
index 1f23a898cc..06571f9bf7 100644
--- a/packages/template-tts-azure/tsconfig.json
+++ b/packages/template-tts-azure/tsconfig.json
@@ -11,5 +11,6 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/template-tts-google/tsconfig.json b/packages/template-tts-google/tsconfig.json
index 1f23a898cc..06571f9bf7 100644
--- a/packages/template-tts-google/tsconfig.json
+++ b/packages/template-tts-google/tsconfig.json
@@ -11,5 +11,6 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"noUnusedLocals": true
- }
+ },
+ "exclude": ["remotion.config.ts"]
}
diff --git a/packages/test-utils/src/composition-manager-context.ts b/packages/test-utils/src/composition-manager-context.ts
index c35618176f..52931a65b2 100644
--- a/packages/test-utils/src/composition-manager-context.ts
+++ b/packages/test-utils/src/composition-manager-context.ts
@@ -1,51 +1,51 @@
-import type { ComponentType } from "react";
-import React from "react";
-import type { CompositionManagerContext } from "remotion";
+import type {ComponentType} from 'react';
+import React from 'react';
+import type {CompositionManagerContext} from 'remotion';
const Mock: React.FC = () => null;
export const makeMockCompositionManagerContext =
- (): CompositionManagerContext => {
- return {
- currentCompositionMetadata: {
- durationInFrames: 100,
- fps: 30,
- height: 100,
- width: 100,
- props: {},
- defaultCodec: null,
- },
- folders: [],
- registerComposition: () => undefined,
- registerFolder: () => undefined,
- unregisterComposition: () => undefined,
- unregisterFolder: () => undefined,
- setCurrentCompositionMetadata: () => undefined,
- compositions: [
- {
- id: "markup",
- component: React.lazy(() =>
- Promise.resolve({
- default: Mock as ComponentType<unknown>,
- })
- ),
- nonce: 0,
- defaultProps: undefined,
- folderName: null,
- parentFolderName: null,
- schema: null,
- calculateMetadata: null,
- durationInFrames: 100,
- fps: 30,
- height: 100,
- width: 100,
- },
- ],
- canvasContent: {
- type: "composition",
- compositionId: "markup",
- },
- setCanvasContent: () => undefined,
- updateCompositionDefaultProps: () => undefined,
- };
- };
+ (): CompositionManagerContext => {
+ return {
+ currentCompositionMetadata: {
+ durationInFrames: 100,
+ fps: 30,
+ height: 100,
+ width: 100,
+ props: {},
+ defaultCodec: null,
+ },
+ folders: [],
+ registerComposition: () => undefined,
+ registerFolder: () => undefined,
+ unregisterComposition: () => undefined,
+ unregisterFolder: () => undefined,
+ setCurrentCompositionMetadata: () => undefined,
+ compositions: [
+ {
+ id: 'markup',
+ component: React.lazy(() =>
+ Promise.resolve({
+ default: Mock as ComponentType<unknown>,
+ }),
+ ),
+ nonce: 0,
+ defaultProps: undefined,
+ folderName: null,
+ parentFolderName: null,
+ schema: null,
+ calculateMetadata: null,
+ durationInFrames: 100,
+ fps: 30,
+ height: 100,
+ width: 100,
+ },
+ ],
+ canvasContent: {
+ type: 'composition',
+ compositionId: 'markup',
+ },
+ setCanvasContent: () => undefined,
+ updateCompositionDefaultProps: () => undefined,
+ };
+ };
diff --git a/packages/test-utils/src/index.ts b/packages/test-utils/src/index.ts
index 8089c59fb9..b08ec99c1b 100644
--- a/packages/test-utils/src/index.ts
+++ b/packages/test-utils/src/index.ts
@@ -1,2 +1,2 @@
-export * from "./composition-manager-context";
-export * from "./timeline-context";
+export * from './composition-manager-context';
+export * from './timeline-context';
diff --git a/packages/test-utils/src/timeline-context.ts b/packages/test-utils/src/timeline-context.ts
index 7b3b0a450d..55507b58bd 100644
--- a/packages/test-utils/src/timeline-context.ts
+++ b/packages/test-utils/src/timeline-context.ts
@@ -1,19 +1,19 @@
-import type { TimelineContextValue } from "remotion";
+import type {TimelineContextValue} from 'remotion';
export const makeTimelineContext = (frame: number): TimelineContextValue => {
- return {
- rootId: "",
- frame: {
- "my-comp": frame,
- },
- playing: false,
- imperativePlaying: {
- current: false,
- },
- playbackRate: 1,
- setPlaybackRate: () => {
- throw new Error("playback rate");
- },
- audioAndVideoTags: { current: [] },
- };
+ return {
+ rootId: '',
+ frame: {
+ 'my-comp': frame,
+ },
+ playing: false,
+ imperativePlaying: {
+ current: false,
+ },
+ playbackRate: 1,
+ setPlaybackRate: () => {
+ throw new Error('playback rate');
+ },
+ audioAndVideoTags: {current: []},
+ };
};