Skip to content

🎥 Make videos programmatically with React

`remotion`: Raise v5 Node and ESLint requirements (#9533)

Jonny Burger2867bb2144cd
diff --git a/packages/core/src/no-react.ts b/packages/core/src/no-react.ts
index 84990a86d9..baa03e4750 100644
--- a/packages/core/src/no-react.ts
+++ b/packages/core/src/no-react.ts
@@ -66,8 +66,9 @@ export const NoReactInternals = {
getOffthreadVideoSource,
getExpectedMediaFrameUncorrected,
ENABLE_V5_BREAKING_CHANGES,
- MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES ? 18 : 16,
+ MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES ? 22 : 16,
MIN_BUN_VERSION: ENABLE_V5_BREAKING_CHANGES ? '1.1.3' : '1.0.3',
+ MIN_ESLINT_VERSION: ENABLE_V5_BREAKING_CHANGES ? '8.57.0' : '7.15.0',
colorNames,
DATE_TOKEN,
FILE_TOKEN,
diff --git a/packages/docs/docs/5-0-migration.mdx b/packages/docs/docs/5-0-migration.mdx
index 1c69daf075..51d3c51bcc 100644
--- a/packages/docs/docs/5-0-migration.mdx
+++ b/packages/docs/docs/5-0-migration.mdx
@@ -33,7 +33,9 @@ Run `npm i `, `yarn`, `pnpm i` or `bun i` respectively afterwards.
## Runtime requirements
-The minimum Node version is now 18.0.0. The minimum Bun version is 1.1.3.
+The minimum Node version is now <MinNodeVersion />. The minimum Bun version is <MinBunVersion />.
+
+If you use `@remotion/eslint-config`, the minimum ESLint version is now <MinEslintVersion />.
## `selectComposition()` and `getCompositions()` now require `inputProps`
diff --git a/packages/docs/src/components/AvailableFrom.tsx b/packages/docs/src/components/AvailableFrom.tsx
index 2249e1eb17..58a9b3806d 100644
--- a/packages/docs/src/components/AvailableFrom.tsx
+++ b/packages/docs/src/components/AvailableFrom.tsx
@@ -51,3 +51,7 @@ export const MinNodeVersion: React.FC = () => {
export const MinBunVersion: React.FC = () => {
return <span>{NoReactInternals.MIN_BUN_VERSION}</span>;
};
+
+export const MinEslintVersion: React.FC = () => {
+ return <span>{NoReactInternals.MIN_ESLINT_VERSION}</span>;
+};
diff --git a/packages/docs/src/theme/MDXComponents.js b/packages/docs/src/theme/MDXComponents.js
index f3411a7a8e..5134f7498f 100644
--- a/packages/docs/src/theme/MDXComponents.js
+++ b/packages/docs/src/theme/MDXComponents.js
@@ -10,6 +10,7 @@ import {YouTube} from '../../components/YouTube';
import {
AvailableFrom,
MinBunVersion,
+ MinEslintVersion,
MinNodeVersion,
} from '../components/AvailableFrom';
import {CompatibilityTable} from '../components/CompatibilityTable';
@@ -30,6 +31,7 @@ export default {
TsType,
MinNodeVersion,
MinBunVersion,
+ MinEslintVersion,
Options,
Credits,
YouTube,
diff --git a/packages/eslint-config/src/patch-eslint.ts b/packages/eslint-config/src/patch-eslint.ts
index 1f14d43af2..25a5a6271c 100644
--- a/packages/eslint-config/src/patch-eslint.ts
+++ b/packages/eslint-config/src/patch-eslint.ts
@@ -12,6 +12,29 @@
import fs from 'fs';
import path from 'path';
+const getMinEslintVersion = () => {
+ const packageJson = JSON.parse(
+ fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8'),
+ ) as {version: string};
+ const isV5Package = Number(packageJson.version.split('.')[0]) >= 5;
+
+ try {
+ const {NoReactInternals} = require('remotion/no-react') as {
+ NoReactInternals: {
+ ENABLE_V5_BREAKING_CHANGES: boolean;
+ MIN_ESLINT_VERSION: string;
+ };
+ };
+ if (NoReactInternals.ENABLE_V5_BREAKING_CHANGES) {
+ return NoReactInternals.MIN_ESLINT_VERSION;
+ }
+ } catch {
+ // @remotion/eslint-config can be installed without remotion.
+ }
+
+ return isV5Package ? '8.57.0' : null;
+};
+
export const allowESLintShareableConfig = () => {
const isModuleResolutionError: (ex: unknown) => boolean = (ex) =>
typeof ex === 'object' &&
@@ -228,12 +251,29 @@ export const allowESLintShareableConfig = () => {
.toString();
const eslintPackageObject = JSON.parse(eslintPackageJson);
const eslintPackageVersion = eslintPackageObject.version;
- const versionMatch = /^([0-9]+)\./.exec(eslintPackageVersion); // parse the SemVer MAJOR part
+ const versionMatch = /^([0-9]+)\.([0-9]+)\./.exec(eslintPackageVersion);
if (!versionMatch) {
throw new Error('Unable to parse ESLint version: ' + eslintPackageVersion);
}
const eslintMajorVersion = Number(versionMatch[1]);
+ const eslintMinorVersion = Number(versionMatch[2]);
+ const minEslintVersion = getMinEslintVersion();
+ if (minEslintVersion !== null) {
+ const minVersionMatch = /^([0-9]+)\.([0-9]+)\./.exec(minEslintVersion)!;
+ const minMajorVersion = Number(minVersionMatch[1]);
+ const minMinorVersion = Number(minVersionMatch[2]);
+ if (
+ eslintMajorVersion < minMajorVersion ||
+ (eslintMajorVersion === minMajorVersion &&
+ eslintMinorVersion < minMinorVersion)
+ ) {
+ throw new Error(
+ `Remotion 5 requires ESLint ${minEslintVersion} or later. You currently have ESLint ${eslintPackageVersion}.`,
+ );
+ }
+ }
+
if (!(eslintMajorVersion >= 6 && eslintMajorVersion <= 9)) {
throw new Error(
'The patch-eslint.js script has only been tested with ESLint version 6.x, 7.x, and 8.x, and 9.x.' +