Skip to content

chore: enable anti-slop lint rules for mobile and extension - #5379

Merged
iscekic merged 3 commits into
mainfrom
anti-slop
Aug 19, 2026
Merged

chore: enable anti-slop lint rules for mobile and extension#5379
iscekic merged 3 commits into
mainfrom
anti-slop

Conversation

@iscekic

@iscekic iscekic commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

What

Enables seven anti-slop oxlint rules and zod-utils/no-inline-zod-schema for apps/mobile and apps/extension, and fixes all 543 existing violations (215 files).

Rules on: no-chained-type-assertions, no-known-value-widening, no-object-parameters, no-reflect-apply, no-reflect-get, no-runtime-typeof, no-unknown-returns, zod-utils/no-inline-zod-schema. Test files, test helpers, and apps/extension/scripts are exempt.

How

  • anti-slop is vendored (MIT) at tools/oxlint/anti-slop/ and registered as a jsPlugins entry in both app oxlint configs. There is no real npm package; oxlint-plugin-anti-slop on npm is a name squat — do not install it.
  • zod-utils runs as an oxlint jsPlugin through tools/oxlint/zod-utils.mjs. The rule's type-aware check is optional (it falls back to syntactic detection), but its getParserServices call throws under oxlint before reaching that branch; the wrapper hands it a stub parserServices with program: null, which lands it on the syntactic path. No ESLint anywhere.

Fix patterns

  • Hand-rolled JSON/payload guards → module-level zod schemas with the same tolerant fallbacks.
  • typeof on already-typed values → non-typeof narrowing (!== undefined, Array.isArray, in, discriminants).
  • Wide Record/anonymous annotations → satisfies or named types.
  • unknown returns → generics or named domain types.
  • Honest exceptions carry a scoped disable with the reason: CDP-injected functions (cannot import), generic payload walkers (Sentry scrub, ReactNode trees), environment probes, open dictionaries indexed by dynamic keys.
  • Consolidated the duplicated tRPC error-code parser onto readTrpcErrorField in lib/trpc-error.ts.

Verification

  • apps/mobile: lint, typecheck, check:unused clean; 4932/4932 tests pass.
  • apps/extension: lint, typecheck clean; 1395/1395 tests pass.
  • Root: pnpm lint and pnpm typecheck clean.
  • Canary-checked that no-inline-zod-schema fires under both real app configs through the stub wrapper.

…mobile and extension

Vendor dmmulroy/anti-slop (MIT) at tools/oxlint/anti-slop and enable
seven of its rules for apps/mobile and apps/extension. Test files,
test helpers, and extension scripts are exempt.

zod-utils/no-inline-zod-schema needs type information, which oxlint
JS plugins cannot access, so it runs through a minimal ESLint setup
scoped to the same folders and wired into both lint scripts.

Scope the global brace-expansion override to keep minimatch@3
(an ESLint dependency) on its compatible 1.x line.
…nd extension

543 violations across 215 files. Hand-rolled JSON and payload guards
now parse with module-level zod schemas; typeof narrowing of already
typed values uses non-typeof discriminants; wide Record and anonymous
return-type annotations become satisfies or named types; unknown
returns become generics or named domain types.

Where the rule cannot be satisfied honestly (CDP-injected functions,
generic payload walkers, ReactNode trees, environment probes), a
scoped disable comment states the reason.

Consolidate the duplicated tRPC error-code parser onto
readTrpcErrorField in lib/trpc-error.ts.
@iscekic iscekic self-assigned this Aug 19, 2026
@iscekic iscekic changed the title Enable anti-slop lint rules for mobile and extension chore: enable anti-slop lint rules for mobile and extension Aug 19, 2026
The rule's type-aware check is optional — it falls back to syntactic
detection when parserServices carries no program — but its
getParserServices call throws before that branch when the tseslint
node maps are missing, which they always are under oxlint.

tools/oxlint/zod-utils.mjs wraps the rule and hands it a stub with
program: null, so it runs as a plain oxlint jsPlugin. This removes
eslint, typescript-eslint, eslint.config.mjs, the lint-script eslint
steps, and the minimatch@3 brace-expansion override they needed.
@iscekic
iscekic enabled auto-merge (squash) August 19, 2026 16:11
@iscekic
iscekic merged commit cb7088a into main Aug 19, 2026
69 checks passed
@iscekic
iscekic deleted the anti-slop branch August 19, 2026 16:21
@kilo-code-bot

kilo-code-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Reviewed the anti-slop/zod-utils lint enablement and 215-file violation fixes; remaining risk is pre-existing gateway Zod null handling, not introduced on commentable changed lines.

Files Reviewed (215 files)
  • apps/extension/.oxlintrc.json
  • apps/extension/entrypoints/background.ts
  • apps/extension/entrypoints/sidepanel/*
  • apps/extension/src/shared/*
  • apps/extension/vitest.setup.ts
  • apps/extension/wxt.config.ts
  • apps/mobile/.oxlintrc.json
  • apps/mobile/src/app/**
  • apps/mobile/src/components/**
  • apps/mobile/src/lib/**
  • apps/mobile/src/test/render-with-providers.tsx
  • package.json
  • pnpm-lock.yaml
  • tools/oxlint/anti-slop/**
  • tools/oxlint/zod-utils.mjs

Reviewed by grok-4.6 · Input: 309.8K · Output: 24.2K · Cached: 1.5M

Review guidance: REVIEW.md from base branch main

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.

2 participants