@noctcore/eslint-plugin-contracts 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/docs/rules/env-var-schema-parity.md +1 -1
- package/docs/rules/require-registered-keys.md +1 -1
- package/docs/rules/require-schema-parse-at-boundary.md +1 -1
- package/docs/rules/translation-key-exists.md +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -78,21 +78,21 @@ export default [
|
|
|
78
78
|
<!-- begin generated rules -->
|
|
79
79
|
<!-- Generated by `bun run docs:readmes` from each rule's meta. Do not edit by hand. -->
|
|
80
80
|
|
|
81
|
-
✅ in `recommended` (error) · ⚙️ needs options · 🔧 `--fix` · 💡 suggestions · 💭 needs type info · ❌ deprecated
|
|
81
|
+
✅ on in `recommended` (error) · 🔘 opt-in: not on in `recommended`, enable it yourself · ⚙️ needs options · 🔧 `--fix` · 💡 suggestions · 💭 needs type info · ❌ deprecated
|
|
82
82
|
|
|
83
|
-
| Rule | Description |
|
|
83
|
+
| Rule | Description | Preset | ⚙️ | 🔧 | 💡 | 💭 |
|
|
84
84
|
| --- | --- | :-: | :-: | :-: | :-: | :-: |
|
|
85
|
-
| [`env-var-schema-parity`](https://noctcore.github.io/eslint-plugins/rules/contracts/env-var-schema-parity/) | Require every `process.env.FOO` / `import.meta.env.FOO` key to be declared in a schema file (`.env.example` or a zod-env module), so config access and config declaration cannot drift apart. |
|
|
85
|
+
| [`env-var-schema-parity`](https://noctcore.github.io/eslint-plugins/rules/contracts/env-var-schema-parity/) | Require every `process.env.FOO` / `import.meta.env.FOO` key to be declared in a schema file (`.env.example` or a zod-env module), so config access and config declaration cannot drift apart. | 🔘 | ⚙️ | | | |
|
|
86
86
|
| [`fetch-must-check-ok`](https://noctcore.github.io/eslint-plugins/rules/contracts/fetch-must-check-ok/) | Require a fetch response to be checked with `.ok` or a status comparison before `.json()` parses its body. | ✅ | | | | |
|
|
87
87
|
| [`money-must-be-decimal`](https://noctcore.github.io/eslint-plugins/rules/contracts/money-must-be-decimal/) | Disallow monetary values typed as the JS primitive `number`. Money-named fields explicitly typed `: number` lose precision to float rounding; use a Decimal money type instead. | ✅ | | | | |
|
|
88
88
|
| [`no-direct-process-env`](https://noctcore.github.io/eslint-plugins/rules/contracts/no-direct-process-env/) | Disallow direct `process.env` access. Force every consumer through a typed, validated config accessor so a missing variable fails at boot, not at use. | ✅ | | | | |
|
|
89
89
|
| [`no-error-stringify`](https://noctcore.github.io/eslint-plugins/rules/contracts/no-error-stringify/) | Disallow stringifying an error with bare `${error}` interpolation, `error.toString()`, or `error + ""`. These drop the cause chain. Use `error instanceof Error ? error.message : String(error)` instead. | ✅ | | | | |
|
|
90
90
|
| [`require-error-cause`](https://noctcore.github.io/eslint-plugins/rules/contracts/require-error-cause/) | Require re-thrown errors inside a `catch` to forward the caught error as `{ cause }`. A `throw new SomeError(...)` that omits the cause severs the chain to the original failure. | ✅ | | 🔧 | | |
|
|
91
|
-
| [`require-registered-keys`](https://noctcore.github.io/eslint-plugins/rules/contracts/require-registered-keys/) | Require the key/name argument of configured sink APIs (storage, event channels, cache keys) to be an imported constant from a registry module, not a raw string literal. |
|
|
92
|
-
| [`require-schema-parse-at-boundary`](https://noctcore.github.io/eslint-plugins/rules/contracts/require-schema-parse-at-boundary/) | Disallow asserting external boundary data with `as T` instead of parsing it at runtime. Flags casts of `JSON.parse`, `res.json()`, web storage, URL search params, message-event data and LLM tool input, directly or through a `const`; use a zod/valibot parse. |
|
|
91
|
+
| [`require-registered-keys`](https://noctcore.github.io/eslint-plugins/rules/contracts/require-registered-keys/) | Require the key/name argument of configured sink APIs (storage, event channels, cache keys) to be an imported constant from a registry module, not a raw string literal. | 🔘 | ⚙️ | | | |
|
|
92
|
+
| [`require-schema-parse-at-boundary`](https://noctcore.github.io/eslint-plugins/rules/contracts/require-schema-parse-at-boundary/) | Disallow asserting external boundary data with `as T` instead of parsing it at runtime. Flags casts of `JSON.parse`, `res.json()`, web storage, URL search params, message-event data and LLM tool input, directly or through a `const`; use a zod/valibot parse. | 🔘 | | | | |
|
|
93
93
|
| [`restrict-throw-to-taxonomy`](https://noctcore.github.io/eslint-plugins/rules/contracts/restrict-throw-to-taxonomy/) | Restrict `throw` to an approved error taxonomy. Flags throwing a non-allowlisted error class and throwing a non-Error value (string, object, number, ...). | ✅ | | | | |
|
|
94
94
|
| [`schema-enum-field-consistency`](https://noctcore.github.io/eslint-plugins/rules/contracts/schema-enum-field-consistency/) | Disallow a zod field that is an enum in one object schema of a module from being `z.string()` in another, which widens the wire type every consumer then narrows by hand. | ✅ | | | | |
|
|
95
|
-
| [`translation-key-exists`](https://noctcore.github.io/eslint-plugins/rules/contracts/translation-key-exists/) | Require every static i18next / react-i18next translation key (`t(...)`, `i18n.t(...)`, `<Trans i18nKey>`) to exist in the catalog of the namespace in scope. |
|
|
95
|
+
| [`translation-key-exists`](https://noctcore.github.io/eslint-plugins/rules/contracts/translation-key-exists/) | Require every static i18next / react-i18next translation key (`t(...)`, `i18n.t(...)`, `<Trans i18nKey>`) to exist in the catalog of the namespace in scope. | 🔘 | ⚙️ | | | |
|
|
96
96
|
| [`wire-message-naming`](https://noctcore.github.io/eslint-plugins/rules/contracts/wire-message-naming/) | A message-schema const ending in a role suffix (default Event/Command/Query) whose zod object declares `type: z.literal(...)` must set that literal to kebab-case(const name minus its role suffix). | ✅ | | 🔧 | | |
|
|
97
97
|
| [`zod-schema-naming`](https://noctcore.github.io/eslint-plugins/rules/contracts/zod-schema-naming/) | Every exported zod schema is a PascalCase const suffixed `Schema`, paired with a same-named inferred type (`export type Foo = z.infer<typeof FooSchema>`). | ✅ | | | | |
|
|
98
98
|
<!-- end generated rules -->
|
package/dist/index.cjs
CHANGED
|
@@ -2602,7 +2602,7 @@ var rules = {
|
|
|
2602
2602
|
|
|
2603
2603
|
// src/index.ts
|
|
2604
2604
|
var NAMESPACE = "noctcore-contracts";
|
|
2605
|
-
var VERSION = "0.7.
|
|
2605
|
+
var VERSION = "0.7.2";
|
|
2606
2606
|
var plugin = {
|
|
2607
2607
|
meta: { name: "@noctcore/eslint-plugin-contracts", version: VERSION },
|
|
2608
2608
|
rules,
|
package/dist/index.js
CHANGED
|
@@ -2558,7 +2558,7 @@ var rules = {
|
|
|
2558
2558
|
|
|
2559
2559
|
// src/index.ts
|
|
2560
2560
|
var NAMESPACE = "noctcore-contracts";
|
|
2561
|
-
var VERSION = "0.7.
|
|
2561
|
+
var VERSION = "0.7.2";
|
|
2562
2562
|
var plugin = {
|
|
2563
2563
|
meta: { name: "@noctcore/eslint-plugin-contracts", version: VERSION },
|
|
2564
2564
|
rules,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> Every `process.env.FOO` / `import.meta.env.FOO` key must be declared in a schema file.
|
|
4
4
|
|
|
5
5
|
<!-- begin generated rule header -->
|
|
6
|
-
|
|
6
|
+
🔘 Opt-in: `off` in `recommended` · ⚙️ Needs options (see Options) · 💭 Type information: not needed
|
|
7
7
|
<!-- end generated rule header -->
|
|
8
8
|
|
|
9
9
|
## Why
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> The key/name argument of a configured sink API must be an imported constant, not a raw string.
|
|
4
4
|
|
|
5
5
|
<!-- begin generated rule header -->
|
|
6
|
-
|
|
6
|
+
🔘 Opt-in: `off` in `recommended` · ⚙️ Needs options (see Options) · 💭 Type information: not needed
|
|
7
7
|
<!-- end generated rule header -->
|
|
8
8
|
|
|
9
9
|
## Why
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> Parse external boundary data at runtime — don't assert its shape with `as T`.
|
|
4
4
|
|
|
5
5
|
<!-- begin generated rule header -->
|
|
6
|
-
Opt-in: `off` in `recommended` · 💭 Type information: not needed
|
|
6
|
+
🔘 Opt-in: `off` in `recommended` · 💭 Type information: not needed
|
|
7
7
|
<!-- end generated rule header -->
|
|
8
8
|
|
|
9
9
|
## Why
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> Every static translation key must exist in the catalog of the namespace in scope.
|
|
4
4
|
|
|
5
5
|
<!-- begin generated rule header -->
|
|
6
|
-
|
|
6
|
+
🔘 Opt-in: `off` in `recommended` · ⚙️ Needs options (see Options) · 💭 Type information: used when available
|
|
7
7
|
<!-- end generated rule header -->
|
|
8
8
|
|
|
9
9
|
## Why
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noctcore/eslint-plugin-contracts",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "ESLint rules for
|
|
3
|
+
"version": "0.7.2",
|
|
4
|
+
"description": "ESLint rules for IO contracts and config: checked fetch responses, parsed boundary data, error cause and taxonomy, zod schema and wire naming, env access, decimal money and translation keys.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs",
|