Skip to content

Formatters

Sean Lip edited this page Mar 23, 2024 · 2 revisions

Frontend

We use prettier to format frontend code. It is configured based on gts. It is run as a pre-commit hook, i.e. it is executed every time you make a commit.

You can set up a prettier extension for vscode as well to format files when saving. Execute npx prettier . --write to format the code manually from the terminal.

Also, if you're using VSCode, here is a .vscode/settings.json that you can use:

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true,
  "prettier.configPath": "./.prettierrc.json",
  "prettier.ignorePath": "./.prettierignore",
  "git.ignoreLimitWarning": true
}

Core documentation


Developing Oppia


Developer Reference

Clone this wiki locally