Skip to content

Commit f05b374

Browse files
committed
chore: lint
1 parent 75fd2de commit f05b374

6 files changed

Lines changed: 12 additions & 10 deletions

File tree

.oxlintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"plugins": ["unicorn", "typescript", "oxc"],
44
"rules": {
55
"no-unused-expressions": "off",
6+
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
67
"typescript/unbound-method": "off",
78
"typescript/no-floating-promises": "off",
89
"typescript/no-implied-eval": "off",

src/rules/handlers/_utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ function isLiterallyInScope(pathname: string, base: string): boolean {
158158
* 0 when it has no fixed count.
159159
*
160160
* Only a prefix whose every segment matches exactly one path segment can be
161-
* stripped by count. A catch-all or modifier param (`/:lang?/old`,
162-
* `/x/:seg*​/old`) matches a varying number, and so does a group spanning a
163-
* separator (`/x{/a}?/old`) — splitting it here leaves its braces unbalanced.
161+
* stripped by count. A catch-all or modifier param (`/:lang?/old`, or a
162+
* `:seg*` segment mid-prefix) matches a varying number, and so does a group
163+
* spanning a separator (`/x{/a}?/old`) — splitting it here leaves its braces
164+
* unbalanced.
164165
* Counting any of those strips the wrong number of segments off the request
165166
* path, so they return 0 and fall through to the literal comparison, which
166167
* rejects (400) instead of forwarding a silently mis-stripped path.

src/rules/match.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ const OPAQUE_SEGMENT_RE = /[()\\]/;
243243
const CONCRETE_SEGMENT_RE = /^[^:*(){}\\]+$/;
244244

245245
// A param that can match *zero* segments (`:x?`, `:x*`). rou3 reads such a
246-
// pattern as broader than the `**` that appears to absorb it (`/a/*/:path*`
247-
// matches `/a/x`, which `/a/*/**` does not), so it must never be absorbed.
246+
// pattern as broader than the `**` that appears to absorb it (`/a/*/:path*`
247+
// matches `/a/x`, which `/a/*/**` does not), so it must never be absorbed.
248248
const ZERO_MATCHABLE_SEGMENT_RE = /^:.*[?*]$/;
249249

250250
/**

test/rules/compiler.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ describe("generated code shape", () => {
216216
it("a compiled matcher with no override predicate still keeps a subsumed rule", () => {
217217
// The divergence this pins: `createMatcherFromFind`'s dependency-free default
218218
// predicate (`canOverrideRouteShape`) is not exact for modifier params — it
219-
// cannot prove either direction between `/mod/reset/*/**` and the
220-
// `/mod/reset/*/:path*` that actually subsumes it. Ordering matched layers
219+
// cannot prove either direction between `/mod/reset/*/**` and the
220+
// `/mod/reset/*/:path*` that actually subsumes it. Ordering matched layers
221221
// must therefore never consult a predicate, or the compiled default falls
222222
// back on arrival order and fails open: the broader pattern's `cors: false`
223223
// lands last and deletes the narrower rule. `evaluateCompiled` builds

test/rules/match.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe("createMatcherFromFind override guard", () => {
144144
expect(canOverrideRouteShape("/admin/**", "/**")).toBe(false);
145145
expect(canOverrideRouteShape("/admin/**", "/public/**")).toBe(false);
146146
// …and the modifier-param shape fails closed in the direction rou3 orders
147-
// it: `/a/*/:path*` matches `/a/x`, which `/a/*/**` does not, so the
147+
// it: `/a/*/:path*` matches `/a/x`, which `/a/*/**` does not, so the
148148
// catch-all is the *narrower* pattern and must not absorb it.
149149
expect(canOverrideRouteShape("/a/*/**", "/a/*/:path*")).toBe(false);
150150
// …as does the optional-group shape, for the same reason one level down:

test/rules/merge.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe("merge algorithm", () => {
2727
// pattern's, and its `false` reset deletes the narrower pattern's rule outright.
2828
// This is the default (no `preMerge`, no compiler) path.
2929
describe("matched layers are merged in containment order, not findAllRoutes order", () => {
30-
// Two distinct upstream shapes: `/api/*/:path*` subsumes `/api/*/**` and comes
30+
// Two distinct upstream shapes: `/api/*/:path*` subsumes `/api/*/**` and comes
3131
// back last in BOTH registration orders (rou3 sorts it there), while
3232
// `/admin/:page?` subsumes `/admin` and gets no specificity sort at all (both
3333
// weigh 0 in `pushSorted`, so config order survives) — hence both orders below.
@@ -627,7 +627,7 @@ describe("mergeMatchedRouteRules (pure)", () => {
627627
// Layer ordering must be decided by the build-time rank alone: the only
628628
// predicate a compiled matcher has by default is `canOverrideRouteShape`,
629629
// which is conservative but *not* exact for modifier params (it cannot see
630-
// that `/api/*/:path*` subsumes the `/api/*/**` it appears to sit under, so
630+
// that `/api/*/:path*` subsumes the `/api/*/**` it appears to sit under, so
631631
// it decides neither direction), leaving a predicate-driven order to fall
632632
// back on arrival order — which fails open exactly here. No `canOverride`
633633
// is passed below.

0 commit comments

Comments
 (0)