diff --git a/.oxlintrc.json b/.oxlintrc.json index 7c4a227..a75aed8 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -13,6 +13,8 @@ "eslint/no-undefined": "off", "eslint/sort-keys": "off", "eslint/id-length": "off", + "eslint/capitalized-comments": "off", + "eslint/no-ternary": "off", "import/no-named-export": "off", "eslint/one-var": "off", "import/group-exports": "off", diff --git a/CHANGELOG.md b/CHANGELOG.md index 43df84f..64385dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- allow ternaries and lowercase comments in oxlint +- switch `src/primitive.ts` prose from block comments to line comments + ## [0.1.8] - 2026-09-16 - upgrade dependencies diff --git a/backlog.tasks b/backlog.tasks index 2e5197b..f32e774 100644 --- a/backlog.tasks +++ b/backlog.tasks @@ -6,10 +6,10 @@ Backlog and tracking for tiny-pattern-ts. Managed in vscode-todotasks format. Setup: ☐ Split off template into separate package => pi --session 01a07dde-7050-7054-bb36-1606d7eb2bc3 @high -☐ straighten oxc rules - ☐ oxc forbids ternary => remove oxc rule - ☐ oxc wants comments to start comments with a capital letter => remove oxc rule - ☐ there already exists a /* */ block comment in primitive.ts, => change to multi-line comment +✔ straighten oxc rules @done + ✔ oxc forbids ternary => remove oxc rule @done + ✔ oxc wants comments to start comments with a capital letter => remove oxc rule @done + ✔ there already exists a /* */ block comment in primitive.ts, => change to multi-line comment @done v1.0: ☐ API surface is stable and fully typed diff --git a/development/tooling.md b/development/tooling.md index b619050..d07e768 100644 --- a/development/tooling.md +++ b/development/tooling.md @@ -104,25 +104,48 @@ Type-aware oxlint is enabled via `options.typeAware: true` in `.oxlintrc.json` #### Decision (2026-09) -Known type-aware false positives are silenced with source-level `oxlint-disable` -directives (see `src/pattern.ts`, `src/match.ts`, `src/index.test.ts`), not with -rules disabled in `.oxlintrc.json`. +A type-aware rule that false-positives is silenced with a source-level +`oxlint-disable` directive (see `src/pattern.ts`, `src/match.ts`, +`src/index.test.ts`), not by turning the rule off in `.oxlintrc.json`. #### Why - The disable sits next to the code it silences, visible to anyone reading the source. +- The rule stays on everywhere else, so only the mis-firing line is exempted. #### Rejected -- A project-wide disable in `.oxlintrc.json`: it hides the suppression from the - reader of the affected code. +- A project-wide disable in `.oxlintrc.json` for a false positive: it hides the + exemption from the reader of the affected code and switches the rule off + repo-wide for a one-site problem. #### Known issue - A source-level disable is a _human_ last resort. AI agents must not add one; they fix the type at its root (see [AGENTS.md § Never do](../AGENTS.md#never-do)). +### Unwanted stylistic rules are turned off in the config + +#### Decision (2026-09) + +A stylistic rule the project rejects is `"off"` in the `.oxlintrc.json` `rules` +map, not silenced at a use site. Current entries: `eslint/capitalized-comments` +(comments may start lowercase) and `eslint/no-ternary` (ternaries are allowed), +joining the oxfmt-superseded rules already off. + +#### Why + +- The rule is wrong for the whole project, not mis-firing at one site, so there + is no line to annotate. +- Keeping the two mechanisms separate keeps a source-level `oxlint-disable` + meaningful: it marks a lone exception. + +#### Rejected + +- A source-level `oxlint-disable` per use: the same exemption repeated at every + site, and oxfmt can move the site. + ### `check:tsc` runs first #### Decision (2026-09) diff --git a/src/primitive.ts b/src/primitive.ts index 6759784..5046949 100644 --- a/src/primitive.ts +++ b/src/primitive.ts @@ -19,10 +19,8 @@ export const getPrimitiveUnionMatcherW: () => < >( pattern: Simplify

, ) => UnaryFn> = () => (pattern) => (shape) => - /* - Rewrite not to use any is possible, was evaluated and solutions were - more complex than the current solution. - */ + // Rewrite not to use any is possible, was evaluated and solutions were + // more complex than the current solution. // oxlint-disable-next-line typescript/no-explicit-any typescript/no-unsafe-type-assertion (pattern[shape] as any)(shape); @@ -50,10 +48,8 @@ export const getPrimitiveUnionMatcherPartial: () => < >( pattern: Simplify>, ) => UnaryFn = () => (pattern) => (shape) => - /* - Rewrite not to use any is possible, was evaluated and solutions were - more complex than the current solution. - */ + // Rewrite not to use any is possible, was evaluated and solutions were + // more complex than the current solution. // oxlint-disable-next-line typescript/no-explicit-any typescript/no-unsafe-type-assertion (pattern[shape] ?? (pattern as any)["_"])(shape); @@ -65,13 +61,11 @@ export const getPrimitiveUnionMatcherPartial: () => < export const getPrimitiveUnionMatcherPartialW: < T extends string | number, >() =>

>( - /* - `Simplify

` is the inference hook: callers infer `P` from the argument. - the second half pins the impl parameter's `R` to `PatternReturns

`. - that makes the `= getPrimitiveUnionMatcherPartial` assignment type-check. - neither half works alone. - without the witness the union's `_` arm demands `_ ∈ keyof P`. - without `Simplify

` the parameter types do not compare. - */ + // `Simplify

` is the inference hook: callers infer `P` from the argument. + // the second half pins the impl parameter's `R` to `PatternReturns

`. + // that makes the `= getPrimitiveUnionMatcherPartial` assignment type-check. + // neither half works alone. + // without the witness the union's `_` arm demands `_ ∈ keyof P`. + // without `Simplify

` the parameter types do not compare. pattern: Simplify

& PatternPrimitiveUnionPartial, T>, ) => UnaryFn> = getPrimitiveUnionMatcherPartial;