# Tooling

URL: https://zerodev.ca/docs/prism/developer-documentation/tooling

> Lint, typecheck and the code style Prism modules follow.



## Checks

From the Prism folder:

```bash
npm run typecheck
npm run typecheck:modules
npm run lint
```

`npm run typecheck` verifies the core framework against `tsconfig.backend.json`. `npm run typecheck:modules` verifies all modules in `modules/` against `tsconfig.module.json`. `npm run lint:fix` fixes what it can. For web views and anything in `src/web`, also run this in `src/web`:

```bash
bun x tsc --noEmit
```

Do not build the web app yourself. Prism builds it on start whenever the source changes, and module views are compiled when they load.

## Type Declarations

Type declarations live in `src/types/`:

* `src/types/prism/`: Core framework declarations and third-party package augmentations (`index.d.ts`, `packages.d.ts`).
* `src/types/modules/`: Module base classes and handler interfaces (`index.d.ts`, `types.d.ts`).

`package.json` maps subpath imports with explicit `types` targets:

```json title="package.json"
{
  "imports": {
    "#prism": {
      "types": "./src/types/prism/index.d.ts",
      "default": "./src/prism/index.js"
    },
    "#prism/modules": {
      "types": "./src/types/modules/index.d.ts",
      "default": "./src/modules/index.js"
    }
  }
}
```

This configuration gives editor autocomplete and type safety without co-located `.d.ts` files or compilation steps.

## Lint Rules

The lint fails on:

* Comments that explain code.
* Optional chaining (`?.`) and nullish coalescing (`??`).
* `else if`. Use early returns, a lookup table or `switch`.
* `var`, `==` and unused variables.

## Style

Official modules also follow these:

* 4 spaces, ESM, one class per file.
* No constants or variables that are only used once. Inline them.
* No helper that only renames another call.
* No `||` fallbacks for values. Check explicitly.
* Plain method names such as `get`, `load`, `start` and `handle`.
* Code in `src/`, config and setup in `resources/`. No `lib` folders.
* No module-specific code in Prism itself or in `src/web`. Everything a module shows comes from its own pages, config and lang.
* Every string translated into all 16 languages.
* No em or en dashes, in code or text.

## Git

Each official module lives in its own git worktree on an orphan `module/<name>` branch, checked out into `modules/<name>`.
