@burglekitt/gmt-eslint
v1.0.0
Published
Shared ESLint configuration for gmt projects
Keywords
Readme
@burglekitt/gmt-eslint
Shared ESLint flat configuration for @burglekitt/gmt projects. Enforces the Temporal-only policy by banning all Date APIs via ESLint rules.
Installation
npm
npm install --save-dev @burglekitt/gmt-eslint eslint @typescript-eslint/parseryarn
yarn add --dev @burglekitt/gmt-eslint eslint @typescript-eslint/parserpnpm
pnpm add --save-dev @burglekitt/gmt-eslint eslint @typescript-eslint/parserbun
bun add --save-dev @burglekitt/gmt-eslint eslint @typescript-eslint/parserUsage
Modern ESLint (Flat Config)
// eslint.config.mjs
import gmtEslintConfig from "@burglekitt/gmt-eslint";
export default [...gmtEslintConfig];ESLint RC (.eslintrc.js)
// .eslintrc.js
const gmtEslintConfig = require("@burglekitt/gmt-eslint");
module.exports = [...gmtEslintConfig];ESLint RC (CommonJS)
// .eslintrc.cjs
const gmtEslintConfig = require("@burglekitt/gmt-eslint");
module.exports = [...gmtEslintConfig];ESLint RC (JSON)
// .eslintrc.json
{
"extends": ["@burglekitt/gmt-eslint"]
}Note: JSON format requires the package to export a named configuration. For best compatibility, use the
eslint.config.mjs(flat config) approach or.eslintrc.js/.eslintrc.cjswith CommonJS require.
Banned patterns
| Pattern | Rule | Suggestion |
|---|---|---|
| Date (global reference) | no-restricted-globals | Use getUtcNow(), getNow(), getUnixNow(), or getZonedNow(timezone) |
| new Date(...) | no-restricted-syntax | Use getUtcNow(), getNow(), or getZonedNow(timezone) |
| Date.now() | no-restricted-properties | Use getUnixNow('milliseconds' \| 'seconds') or getNow() |
| Date.UTC(...) | no-restricted-properties | Use convertUtcDateTimeToUnix('YYYY-MM-DDTHH:mm:ss', 'milliseconds' \| 'seconds') |
| Date.parse(...) | no-restricted-properties | Use convertZonedToUnix(value) |
| $date.getTimezoneOffset() | no-restricted-syntax | Use getZonedNow(timezone), other gmt zoned helpers such as convertZonedToUnix(value), or Temporal.ZonedDateTime |
Why Temporal?
Temporal solves fundamental issues with JavaScript's Date object:
- Immutability — no accidental mutations
- Timezone awareness — explicit, unambiguous timezone handling
- No DST bugs — proper daylight saving time logic
- Precision — nanosecond precision where needed
All banned Date APIs have Temporal equivalents that are safer, clearer, and more correct.
