Skip to content

Type Script and Miscellaneous Resources

TypeScript

TypeScript is a superset of JavaScript that adds type annotations and other features to JavaScript. It is the language used to write Obsidian plugins. You technically don’t need TypeScript to write Obsidian plugins, but it is highly recommended.

Understanding JavaScript

Surrounding Tools

Build Systems

You need a build system to compile your TypeScript code into JavaScript code and bundle it into a main.js file that Obsidian can load.

There are a multitude of build systems out there, but the two most popular for Obsidian plugins are Esbuild and Rollup. The sample plugin comes with Esbuid set up since October 2021, but a lot of older plugins use Rollup.

Eslint

Eslint is a linter for JavaScript and TypeScript. Linters help you write better code by pointing out potential problems and enforcing a consistent style. The sample plugin comes set up with a basic Eslint configuration, but I recommend using a stricter configuration such as the one used by Create T3 App. An example of a plugin that used an Eslint configuration similar to the one used by Create T3 App is Meta Bind with it’s Eslint configuration.

Prettier

Prettier is a code formatter that helps you write consistent code. I highly recommend using it, especially as it helps contributors to conform to the code style of your plugin.

Testing

See Testing Frameworks and Utilities.