Skip to content

Code Style

Paulius Juzenas edited this page Jan 8, 2025 · 1 revision

I (Paulius) recommend taking a look at the Google TypeScript Style Guide. While we don't follow it one to one it's still a good resource for determining good code style.

Some highlights include:

  • Avoid using any whenever possible.
  • Avoid using as whenever possible. Prefer explicitly typing with :.
  • Do not use default exports.

Eslint

The project has eslint configured. Eslint is a so called linter. That is a program which looks over the code and enforces a certain style. For example line length, use of semi colons and much more.

To use eslint simply run npm run lint.

Eslint can also fix certain issues so you don't have to do it yourself. Simply add the "fix" flag like so npm run eslint -- --fix*.

If all the warning annoy you they can be turned off with the "quiet" flag like so npm run eslint -- --quiet*.

*Note: The extra double dash is required here because we want to pass the flag to the eslint command and not the npm command.

Sidebar

Clone this wiki locally