@theda/eslint-plugin
v0.3.0
Published
ESLint rules for Theda apps — catches direct use of time, randomness, fetch, and console in handler files
Readme
@theda/eslint-plugin
ESLint rules for Theda apps — catches direct use of time, randomness, fetch, and console in handler files.
Install
npm install -D @theda/eslint-plugin eslintSetup
// eslint.config.js
import theda from "@theda/eslint-plugin";
export default [
theda.configs.recommended,
{
ignores: ["dist/", "node_modules/", ".theda/"],
},
];Rules
The recommended config enables these rules:
| Rule | Description |
|------|-------------|
| no-direct-date | Prevents new Date() and Date.now() — use ctx.time() instead |
| no-direct-random | Prevents Math.random() and crypto.randomUUID() — use ctx.newId() instead |
| no-direct-fetch | Prevents fetch() in handler files — use ctx.httpFetch instead |
| no-direct-console | Prevents console.log() in handler files — use ctx.log() instead |
These rules help keep your handlers deterministic and testable. Side effects should go through the context object so they can be mocked in tests and tracked by the platform.
License
Apache-2.0
