🎥 Make videos programmatically with React
Select the scaffolded ESLint version for the local Node runtime
JonnyBurger67a567f37a45
diff --git a/packages/create-video/src/patch-package-json.ts b/packages/create-video/src/patch-package-json.tsindex afd8a481b0..5f428c3b25 100644--- a/packages/create-video/src/patch-package-json.ts+++ b/packages/create-video/src/patch-package-json.ts@@ -1,3 +1,4 @@+import {spawnSync} from 'node:child_process';import fs from 'node:fs';import path from 'node:path';import {listOfRemotionPackages} from './list-of-remotion-packages';@@ -42,11 +43,58 @@ export const patchPackageJson = (return [d, depsField[d]];})- .reduce((a, b) => {+ .reduce<Record<string, string>>((a, b) => {return {...a, [b[0]]: b[1]};}, {});});+ if (+ newDevDependencies?.['@remotion/eslint-config-flat'] &&+ /^10\./.test(newDevDependencies.eslint ?? '')+ ) {+ // Bun's process.versions.node describes its compatibility target, not the+ // Node.js executable that will run npm scripts in the generated project.+ const nodeVersion = process.versions.bun+ ? spawnSync('node', ['--version'], {+ encoding: 'utf8',+ windowsHide: true,+ timeout: 10000,+ }).stdout?.trim()+ : process.versions.node;+ const version = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(nodeVersion ?? '');+ const major = version ? Number(version[1]) : null;+ const minor = version ? Number(version[2]) : null;+ const supportsEslint10 =+ major !== null &&+ minor !== null &&+ (major >= 24 ||+ (major === 22 && minor >= 13) ||+ (major === 20 && minor >= 19));++ if (!supportsEslint10) {+ const eslint9NodeRequirement = '^18.18.0 || ^20.9.0 || >=21.1.0';+ if (+ major !== null &&+ minor !== null &&+ !(+ major >= 22 ||+ (major === 21 && minor >= 1) ||+ (major === 20 && minor >= 9) ||+ (major === 18 && minor >= 18)+ )+ ) {+ throw new Error(+ `This template's ESLint configuration requires Node.js ${eslint9NodeRequirement}. Found ${nodeVersion}.`,+ );+ }++ newDevDependencies.eslint = '9.39.5';+ if (others.engines?.node === '^20.19.0 || ^22.13.0 || >=24') {+ others.engines.node = eslint9NodeRequirement;+ }+ }+ }+const updateScripts = (scriptsToUpdate: Record<string, string>) => {for (const [key, value] of Object.entries(scriptsToUpdate)) {scriptsToUpdate[key] = value.replace(/remotion\b/g, 'remotionb');diff --git a/packages/docs/docs/eslint-config.mdx b/packages/docs/docs/eslint-config.mdxindex 1c8e648a73..d7816f6829 100644--- a/packages/docs/docs/eslint-config.mdx+++ b/packages/docs/docs/eslint-config.mdx@@ -47,6 +47,8 @@ The JavaScript, TypeScript, and React Hooks rules still apply to the whole projeESLint 10 is supported from Remotion <AvailableFrom v="4.0.536" inline />. It requires Node.js 20.19 or later on the 20.x release line, 22.13 or later on the 22.x release line, or 24 and later.+When creating a project, templates using the flat config select ESLint 9 if your Node.js version cannot run ESLint 10. ESLint 9 requires Node.js 18.18 or later on the 18.x release line, 20.9 or later on the 20.x release line, or 21.1 and later. Templates may have additional Node.js requirements.+## ESLint 8 and earlierInstall the legacy config: