🎥 Make videos programmatically with React
Preserve custom React rules in the ESLint flat config
JonnyBurger0ae63a1e209b
diff --git a/bun.lock b/bun.lockindex e17b5a4e36..451f056aad 100644--- a/bun.lock+++ b/bun.lock@@ -768,11 +768,13 @@"typescript-eslint": "8.71.2",},"devDependencies": {+ "@eslint/compat": "2.1.1","@eslint/js": "9.19.0","@remotion/eslint-config-internal": "workspace:*","@remotion/eslint-plugin": "workspace:*","@typescript/native-preview": "catalog:","eslint": "catalog:",+ "eslint-plugin-react": "7.37.4",},"peerDependencies": {"eslint": "^9.0.0 || ^10.0.0",@@ -3725,7 +3727,7 @@"@eslint-community/regexpp": ["@eslint-community/[email protected]", "", {}, "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ=="],- "@eslint/compat": ["@eslint/[email protected]", "", { "peerDependencies": { "eslint": "9.19.0" }, "optionalPeers": ["eslint"] }, "sha512-jhgiIrsw+tRfcBQ4BFl2C3vCrIUw2trCY0cnDvGZpwTtKCEDmZhAtMfrEUP/KpnwM6PrO0T+Ltm+ccW74olG3Q=="],+ "@eslint/compat": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/core": "^1.2.1" }, "peerDependencies": { "eslint": "^8.40 || 9 || 10" }, "optionalPeers": ["eslint"] }, "sha512-rMcy8GSrwNzcISX/BlTDY/GLB4eCopEuy9woIls3To+15OLxykZrxxq+WUcylCPCQ6F4MujjBM1DX5V1aqI3Vw=="],"@eslint/config-array": ["@eslint/[email protected]", "", { "dependencies": { "@eslint/object-schema": "2.1.6", "debug": "4.4.0", "minimatch": "3.1.2" } }, "sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w=="],@@ -10021,6 +10023,8 @@"@eslint-community/eslint-utils/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],+ "@eslint/compat/@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ=="],+"@eslint/config-helpers/@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ=="],"@eslint/eslintrc/espree": ["[email protected]", "", { "dependencies": { "acorn": "8.14.0", "acorn-jsx": "5.3.2", "eslint-visitor-keys": "4.2.1" } }, "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg=="],@@ -10613,6 +10617,8 @@"@remotion/eslint-config-flat/eslint-plugin-react-hooks": ["[email protected]", "", { "dependencies": { "@babel/core": "^7.24.4", "@babel/parser": "^7.24.4", "hermes-parser": "^0.25.1", "zod": "^3.25.0 || ^4.0.0", "zod-validation-error": "^3.5.0 || ^4.0.0" }, "peerDependencies": { "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" } }, "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g=="],+ "@remotion/eslint-config-internal/@eslint/compat": ["@eslint/[email protected]", "", { "peerDependencies": { "eslint": "9.19.0" }, "optionalPeers": ["eslint"] }, "sha512-jhgiIrsw+tRfcBQ4BFl2C3vCrIUw2trCY0cnDvGZpwTtKCEDmZhAtMfrEUP/KpnwM6PrO0T+Ltm+ccW74olG3Q=="],+"@remotion/eslint-config-internal/@typescript-eslint/eslint-plugin": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@eslint-community/regexpp": "4.12.1", "@typescript-eslint/scope-manager": "8.12.2", "@typescript-eslint/type-utils": "8.12.2", "@typescript-eslint/utils": "8.12.2", "@typescript-eslint/visitor-keys": "8.12.2", "graphemer": "1.4.0", "ignore": "5.3.2", "natural-compare": "1.4.0", "ts-api-utils": "1.4.0" }, "peerDependencies": { "@typescript-eslint/parser": "8.12.2", "eslint": "9.19.0", "typescript": "5.8.2" }, "optionalPeers": ["typescript"] }, "sha512-gQxbxM8mcxBwaEmWdtLCIGLfixBMHhQjBqR8sVWNTPpcj45WlYL2IObS/DNMLH1DBP0n8qz+aiiLTGfopPEebw=="],"@remotion/eslint-config-internal/@typescript-eslint/parser": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.12.2", "@typescript-eslint/types": "8.12.2", "@typescript-eslint/typescript-estree": "8.12.2", "@typescript-eslint/visitor-keys": "8.12.2", "debug": "4.4.0" }, "peerDependencies": { "eslint": "9.19.0", "typescript": "5.8.2" }, "optionalPeers": ["typescript"] }, "sha512-MrvlXNfGPLH3Z+r7Tk+Z5moZAc0dzdVjTgUgwsdGweH7lydysQsnSww3nAmsq8blFuRD5VRlAr9YdEFw3e6PBw=="],diff --git a/packages/docs/docs/eslint-config.mdx b/packages/docs/docs/eslint-config.mdxindex b1e575f4d3..1c8e648a73 100644--- a/packages/docs/docs/eslint-config.mdx+++ b/packages/docs/docs/eslint-config.mdx@@ -31,6 +31,8 @@ import {config} from '@remotion/eslint-config-flat';export default config;```+The flat config also registers `eslint-plugin-react`, so you can enable additional `react/*` rules in a config object after `...config`. Its recommended preset is not enabled by default.+To apply Remotion-specific rules only to part of an existing project, use `makeConfig()`:```js title="eslint.config.mjs"diff --git a/packages/eslint-config-flat/package.json b/packages/eslint-config-flat/package.jsonindex b40c5e57c5..4f07db62fd 100644--- a/packages/eslint-config-flat/package.json+++ b/packages/eslint-config-flat/package.json@@ -29,8 +29,10 @@"eslint": "^9.0.0 || ^10.0.0"},"devDependencies": {+ "@eslint/compat": "2.1.1","@remotion/eslint-plugin": "workspace:*","@eslint/js": "9.19.0",+ "eslint-plugin-react": "7.37.4","@remotion/eslint-config-internal": "workspace:*","eslint": "catalog:","@typescript/native-preview": "catalog:"diff --git a/packages/eslint-config-flat/src/index.ts b/packages/eslint-config-flat/src/index.tsindex b01cad746c..cc145c0c76 100644--- a/packages/eslint-config-flat/src/index.ts+++ b/packages/eslint-config-flat/src/index.ts@@ -1,6 +1,8 @@+import {fixupPluginRules} from '@eslint/compat';import eslint from '@eslint/js';import remotionPlugin from '@remotion/eslint-plugin';import type {Linter} from 'eslint';+import reactPlugin from 'eslint-plugin-react';import hooksPlugin from 'eslint-plugin-react-hooks';import tseslint from 'typescript-eslint';@@ -25,6 +27,10 @@ export const makeConfig = ({tseslint.configs.recommended,{plugins: {+ // React's types still describe the legacy APIs restored by this wrapper.+ react: fixupPluginRules(+ reactPlugin as unknown as Parameters<typeof fixupPluginRules>[0],+ ),'react-hooks': hooksPlugin,},languageOptions: {@@ -42,6 +48,17 @@ export const makeConfig = ({'no-use-before-define': 'off','@typescript-eslint/no-use-before-define': 'off','@typescript-eslint/no-empty-object-type': 'off',+ 'react/jsx-key': 'off',+ 'react/jsx-no-target-blank': 'off',+ // Fragments leave room for adding more compositions to Root.tsx.+ 'react/jsx-no-useless-fragment': 'off',+ // Remotion rerenders on every frame, so index keys are acceptable.+ 'react/no-array-index-key': 'off',+ },+ settings: {+ react: {+ version: 'detect',+ },},},{