Skip to content

🎥 Make videos programmatically with React

easier

Jonny Burger289081069bf6
diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts
index ee536cda11..875d0859b9 100644
--- a/packages/eslint-plugin/src/index.ts
+++ b/packages/eslint-plugin/src/index.ts
@@ -26,25 +26,39 @@ const rules = {
'v4-config-import': v4Import,
};
-export = {
- rules,
- configs: {
- recommended: {
- rules: {
- '@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',
- },
- plugins: ['@remotion'],
- },
+const recommendedRuleConfig = {
+ '@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',
+} as const;
+
+const configs = {
+ recommended: {
+ rules: recommendedRuleConfig,
+ plugins: ['@remotion'],
},
} as const;
+
+const flatPlugin = {
+ rules: recommendedRuleConfig,
+ plugins: {
+ '@remotion': {
+ rules: rules,
+ },
+ },
+};
+
+export = {
+ configs,
+ rules,
+ flatPlugin,
+};
diff --git a/packages/template-next-app-tailwind/eslint.config.mjs b/packages/template-next-app-tailwind/eslint.config.mjs
index e1bdaa4233..beeedf26a8 100644
--- a/packages/template-next-app-tailwind/eslint.config.mjs
+++ b/packages/template-next-app-tailwind/eslint.config.mjs
@@ -1,6 +1,7 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
+import remotion from "@remotion/eslint-plugin";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -10,22 +11,13 @@ const compat = new FlatCompat({
});
const [nextPlugin] = compat.extends("plugin:@next/next/recommended");
-const [remotionPlugin] = compat.extends(
- "plugin:@remotion/eslint-plugin/recommended",
-);
const eslintConfig = [
...compat.extends("next/typescript"),
nextPlugin,
{
- ...remotionPlugin,
+ ...remotion.flatPlugin,
files: ["src/remotion/**"],
- rules: {
- ...remotionPlugin.rules,
- ...Object.entries(nextPlugin.rules).reduce((acc, [key]) => {
- return { ...acc, [key]: "off" };
- }, {}),
- },
},
];
diff --git a/packages/template-next-app/eslint.config.mjs b/packages/template-next-app/eslint.config.mjs
index e1bdaa4233..beeedf26a8 100644
--- a/packages/template-next-app/eslint.config.mjs
+++ b/packages/template-next-app/eslint.config.mjs
@@ -1,6 +1,7 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
+import remotion from "@remotion/eslint-plugin";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -10,22 +11,13 @@ const compat = new FlatCompat({
});
const [nextPlugin] = compat.extends("plugin:@next/next/recommended");
-const [remotionPlugin] = compat.extends(
- "plugin:@remotion/eslint-plugin/recommended",
-);
const eslintConfig = [
...compat.extends("next/typescript"),
nextPlugin,
{
- ...remotionPlugin,
+ ...remotion.flatPlugin,
files: ["src/remotion/**"],
- rules: {
- ...remotionPlugin.rules,
- ...Object.entries(nextPlugin.rules).reduce((acc, [key]) => {
- return { ...acc, [key]: "off" };
- }, {}),
- },
},
];
diff --git a/packages/template-next-pages/eslint.config.mjs b/packages/template-next-pages/eslint.config.mjs
index e1bdaa4233..beeedf26a8 100644
--- a/packages/template-next-pages/eslint.config.mjs
+++ b/packages/template-next-pages/eslint.config.mjs
@@ -1,6 +1,7 @@
import { dirname } from "path";
import { fileURLToPath } from "url";
import { FlatCompat } from "@eslint/eslintrc";
+import remotion from "@remotion/eslint-plugin";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@@ -10,22 +11,13 @@ const compat = new FlatCompat({
});
const [nextPlugin] = compat.extends("plugin:@next/next/recommended");
-const [remotionPlugin] = compat.extends(
- "plugin:@remotion/eslint-plugin/recommended",
-);
const eslintConfig = [
...compat.extends("next/typescript"),
nextPlugin,
{
- ...remotionPlugin,
+ ...remotion.flatPlugin,
files: ["src/remotion/**"],
- rules: {
- ...remotionPlugin.rules,
- ...Object.entries(nextPlugin.rules).reduce((acc, [key]) => {
- return { ...acc, [key]: "off" };
- }, {}),
- },
},
];