Skip to content

🎥 Make videos programmatically with React

Docs: New formatting guide for contributors

Jonny Burger0b63fa13cb9b
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 286d77c515..e83cb07567 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -12,13 +12,21 @@
"./packages/lambda-python/src",
"./packages/lambda-python/remotion_lambda_sdk"
],
- "[php]": {
- "editor.defaultFormatter": "DEVSENSE.phptools-vscode"
- },
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
- "python.formatting.provider": "none",
+ "[javascript]": {
+ "editor.formatOnSave": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[typescript]": {
+ "editor.formatOnSave": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[typescriptreact]": {
+ "editor.formatOnSave": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
"typescript.preferences.autoImportFileExcludePatterns": [
"@types/node/test.d.ts"
],
diff --git a/packages/docs/docs/contributing/formatting.md b/packages/docs/docs/contributing/formatting.md
new file mode 100644
index 0000000000..b891b6ed20
--- /dev/null
+++ b/packages/docs/docs/contributing/formatting.md
@@ -0,0 +1,42 @@
+---
+image: /generated/articles-docs-contributing-formatting.png
+title: Formatting in the Remotion repo
+sidebar_label: Formatting
+crumb: Contributing
+---
+
+The Remotion codebase uses Prettier and ESLint for formatting and requires all code to be formatted correctly before it is merged.
+
+## Prettier
+
+In VS Code, you can install the [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode). Extensions for other editors are available on the [Prettier website](https://prettier.io/docs/en/editors.html).
+
+The editor should automatically pick up our `.vscode/settings.json` file and format your code when you save a file.
+
+To manually format a whole package, run `pnpm exec prettier src --write` on a package. Example:
+
+```bash
+cd packages/renderer
+pnpm exec prettier src --write
+```
+
+## ESLint
+
+ESLint will warn about code style issues and errors. You can install the [ESLint VS Code](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extension to get warnings in the editor as you write code. Extensions for other editors are available on the [ESLint website](https://eslint.org/docs/user-guide/integrations).
+
+You can also run `pnpm run lint` in any package to check if there are any errors. Example:
+
+```bash
+cd packages/renderer
+pnpm run lint
+```
+
+## Testing everything
+
+You can run
+
+```bash
+pnpm run stylecheck
+```
+
+in the root to test locally if the whole repo is well-formatted and will pass the continuous integration checks.
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 2f98b22f9f..367f58fda2 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -676,6 +676,7 @@ module.exports = {
"contributing/feature",
"contributing/option",
"contributing/docs",
+ "contributing/formatting",
"contributing/bounty",
"contributing/rust",
],
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 695c086244..058e30812c 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -510,6 +510,13 @@ export const articles = [
compId: "articles-docs-contributing-feature",
crumb: "Contributing",
},
+ {
+ id: "contributing/formatting",
+ title: "Formatting in the Remotion repo",
+ relativePath: "docs/contributing/formatting.md",
+ compId: "articles-docs-contributing-formatting",
+ crumb: "Contributing",
+ },
{
id: "contributing/index",
title: "Contributing to Remotion",
diff --git a/packages/docs/static/generated/articles-docs-contributing-formatting.png b/packages/docs/static/generated/articles-docs-contributing-formatting.png
new file mode 100644
index 0000000000..a7e4f71ff8
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-contributing-formatting.png differ