@amritk/lint 0.3.0 → 0.3.1

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 CHANGED
@@ -220,15 +220,15 @@ The `bench/` suite pits `@amritk/lint` head-to-head against **[Spectral](https:/
220
220
 
221
221
  | document | size | mjst | Spectral | speedup | findings (mjst / Spectral) |
222
222
  | --- | ---: | ---: | ---: | ---: | ---: |
223
- | petstore (Swagger) | 17 KB | ~6 ms | ~124 ms | **~19×** | 2 / 2 |
224
- | digitalocean | 105 KB | ~37 ms | ~477 ms | **~13×** | 3507 / 4319 |
225
- | openai | 2.8 MB | ~1.3 s | errored¹ | — | 1176 / — |
223
+ | petstore (Swagger) | 17 KB | ~7 ms | ~100 ms | **~14×** | 2 / 2 |
224
+ | digitalocean | 105 KB | ~31 ms | ~355 ms | **~12×** | 2411 / 4319 |
225
+ | openai | 2.8 MB | ~1.4 s | errored¹ | — | 1278 / — |
226
226
 
227
227
  ¹ Spectral's JSONPath engine (`nimma`) throws on the 2.8 MB OpenAI spec under Bun, so that row is mjst-only; mjst lints it end to end.
228
228
 
229
229
  Each `lint` figure is the mean wall time of one whole pass — **every rule, not a subset** — dominated by real work: JSONPath matching, the rule functions, and the dereference pass. A fresh document is parsed on every iteration on both sides, matching how the tools are actually called. The finding counts differ because the two rulesets are not byte-identical (different rule implementations and `$ref` resolution), so this is a **throughput** comparison rather than a correctness parity check — but on petstore both land on the same two findings.
230
230
 
231
- **Assembling the ruleset** is timed separately, because a process pays it once and then lints many documents: `createOpenApiRuleset` (compiling every rule's JSONPath and wiring up functions and format detectors) measures **~0.06 ms**, versus **~0.4 ms** for `new Spectral()` + `setRuleset(oas)`. The benchmark warms up before timing and reports the mean over a fixed time budget; micro-benchmark figures vary by machine and runtime.
231
+ **Assembling the ruleset** is timed separately, because a process pays it once and then lints many documents: `createOpenApiRuleset` (compiling every rule's JSONPath and wiring up functions and format detectors) measures **~0.09 ms**, versus **~0.35 ms** for `new Spectral()` + `setRuleset(oas)`. The benchmark warms up before timing and reports the mean over a fixed time budget; micro-benchmark figures vary by machine and runtime.
232
232
 
233
233
  ---
234
234
 
@@ -12,7 +12,7 @@ const compare = (a, b) => {
12
12
  return Math.sign(Number(a) - Number(b));
13
13
  // Match Spectral: when either side is a real number or a numeric string,
14
14
  // compare numerically so mixed inputs like [2, "10"] read as ordered.
15
- if ((typeof a === 'number' || Number.isNaN(Number(a))) && (typeof b === 'number' || !Number.isNaN(Number(b)))) {
15
+ if ((typeof a === 'number' || !Number.isNaN(Number(a))) && (typeof b === 'number' || !Number.isNaN(Number(b)))) {
16
16
  return Math.min(1, Math.max(-1, Number(a) - Number(b)));
17
17
  }
18
18
  if (typeof a !== 'string' || typeof b !== 'string')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amritk/lint",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A fast, format-agnostic JSON/YAML style-guide linter with JSON Schema and custom rules.",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -51,12 +51,12 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@amritk/runtime-validators": "0.7.0",
55
- "@amritk/yaml": "0.3.0",
54
+ "@amritk/runtime-validators": "0.7.1",
55
+ "@amritk/yaml": "0.3.1",
56
56
  "jsonc-parser": "^3.3.1"
57
57
  },
58
58
  "devDependencies": {
59
- "@amritk/resolve-refs": "0.4.0",
59
+ "@amritk/resolve-refs": "0.4.1",
60
60
  "@stoplight/spectral-core": "^1.23.1",
61
61
  "@stoplight/spectral-parsers": "^1.0.5",
62
62
  "@stoplight/spectral-rulesets": "^1.22.6"