🔀 Merge chore/straighten-oxc-rules into main
CI / release-gate (push) Successful in 3s
CI / build (push) Successful in 23s
CI / publish (push) Skipped
CI / maintain (push) Failing after 14s

This commit is contained in:
tmu committed 2026-09-16 21:50:14 +00:00
commit 73e5bc0093
5 files changed
+47 -25

No files matched your search

+2
View File
@@ -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",
+3
View File
@@ -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
+4 -4
View File
@@ -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
+28 -5
View File
@@ -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)
+10 -16
View File
@@ -19,10 +19,8 @@ export const getPrimitiveUnionMatcherW: <T extends string | number>() => <
>(
pattern: Simplify<P>,
) => UnaryFn<T, PatternReturns<P>> = () => (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: <T extends string | number>() => <
>(
pattern: Simplify<PatternPrimitiveUnionPartial<R, T>>,
) => UnaryFn<T, R> = () => (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: <T extends string | number>() => <
export const getPrimitiveUnionMatcherPartialW: <
T extends string | number,
>() => <P extends PatternPrimitiveUnionPartial<unknown, T>>(
/*
`Simplify<P>` is the inference hook: callers infer `P` from the argument.
the second half pins the impl parameter's `R` to `PatternReturns<P>`.
that makes the `= getPrimitiveUnionMatcherPartial` assignment type-check.
neither half works alone.
without the witness the union's `_` arm demands `_ ∈ keyof P`.
without `Simplify<P>` the parameter types do not compare.
*/
// `Simplify<P>` is the inference hook: callers infer `P` from the argument.
// the second half pins the impl parameter's `R` to `PatternReturns<P>`.
// that makes the `= getPrimitiveUnionMatcherPartial` assignment type-check.
// neither half works alone.
// without the witness the union's `_` arm demands `_ ∈ keyof P`.
// without `Simplify<P>` the parameter types do not compare.
pattern: Simplify<P> & PatternPrimitiveUnionPartial<PatternReturns<P>, T>,
) => UnaryFn<T, PatternReturns<P>> = getPrimitiveUnionMatcherPartial;