Skip to content

middleware: fix lint and formatting, remove dead code - #64

Merged
carlrafting merged 1 commit into
devfrom
claude/middleware-cleanup
Nov 23, 2026
Merged

carlrafting merged 1 commit into
devfrom
claude/middleware-cleanup

Conversation

@carlrafting

Copy link
Copy Markdown
Owner

Summary

Brings middleware/ to a clean deno fmt and deno lint state (it had 15 lint errors and 8 unformatted files) without changing the published API.

  • Formatting: deno fmt on logger.ts, static.ts, csrf.ts, both test files and example/serve.ts. The only change in csrf.ts is indentation.
  • main.test.ts: use the import-map @std/assert specifier instead of an unversioned jsr: import; prefix unused params with _.
  • main.ts: fix the module doc comment so its example renders as a code block.
  • aiblock: drop the empty Options interface and the unused parameter (aiblock() takes no arguments; nothing in the repo passed one). Blank lines in the fetched blocklist are now ignored, since an empty entry would match every user agent and block all requests. The upstream list has no blank lines today, so behavior is unchanged.
  • session: remove the unused ulid import, TTL constant and kvKey, plus about 55 lines of commented-out legacy code. Drop the unused url and key options. Export rotateSession, which its JSDoc already documents as usable.
  • auth: remove the unused only and except options and honor signin (default /signin, as before). Document that the cookie check is not real authentication.

session, auth and csrf are not in the package exports and nothing else in the repo imports them, so none of this changes published API.

Not in this PR

  • session, auth and csrf are not finished or redesigned. auth still trusts any authenticated cookie.
  • deno doc --lint still reports 17 errors, mostly missing JSDoc on exports.
  • The readme still documents only compose.

Test plan

  • deno fmt --check, deno lint, deno check and deno task test pass in middleware/ (3 tests)
  • Workspace-wide deno check and the routes tests pass
  • CI is green on this PR: test legs and type check blocking; format and lint should now pass for middleware/ (other packages may still report problems)

🤖 Generated with Claude Code

Bring middleware/ to a clean `deno fmt` and `deno lint` state without
changing the published API.

- Format logger, static, csrf, the tests and the example with deno fmt.
- main.test.ts: use the import-map `@std/assert` specifier and prefix
  unused parameters with an underscore.
- main.ts: fix the module doc comment so its example renders as a code
  block.
- aiblock: drop the empty Options interface and unused parameter, and
  ignore blank lines in the fetched blocklist, since an empty entry
  would match every user agent.
- session: remove the unused ulid import, TTL constant, kvKey and the
  commented-out legacy implementation, drop the unused `url` and `key`
  options, and export rotateSession as its JSDoc describes.
- auth: remove the unused `only` and `except` options, honor `signin`
  (default unchanged) and document that the cookie check is not real
  authentication.

session, auth and csrf are not part of the package exports and are not
imported elsewhere in the repo.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@carlrafting
carlrafting force-pushed the claude/middleware-cleanup branch from 2cd1f45 to 134fe75 Compare November 23, 2026 08:30
@carlrafting
carlrafting merged commit 69ff319 into dev Nov 23, 2026
12 checks passed
@carlrafting
carlrafting deleted the claude/middleware-cleanup branch November 23, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant