Skip to content

Move every @enfect/oxlint rule to error #533

Open

Description

@thomasfosterau

Owner request (2026-10-30). Follow-up to #532, which swapped @mpsuesser/oxlint-plugin-effect for @enfect/oxlint 0.9.0 (configs.recommended, every rule at error) and kept the existing staged-rollout allowances in vite.config.ts. It supersedes the per-rule pay-down list in #436.

Goal: every effect/* rule at error with zero sites. Remove each override, or keep it only as a genuine can't-apply with its reason written next to it. No disable comments.

Site counts are from vp lint --format json on the #532 branch. For off rules, the count is what the rule reports with the override removed.

Global warn (staged rollout, #436)

Rule Sites Reason in config
require-safety-comment-for-type-assertion 782 modules predate the preset
casting-awareness 629 awareness prompt that fires on every as, including the narrowings AsFields needs; kept visible as a warning on purpose
prefer-option-over-null 549 predates the preset
avoid-native-object-helpers 348 predates the preset
avoid-non-null-assertion 237 predates the preset
imperative-loops 212 predates the preset
avoid-any 143 predates the preset
effect-run-in-body 127 predates the preset
no-chained-type-assertions 106 predates the preset
no-barrel-imports 92 (outside the schema tier) predates the preset
no-unsafe-dictionary-type 83 predates the preset; never bind effect's Record as Record (#275)
no-runtime-typeof 78 predates the preset
use-clock-service 72 predates the preset
avoid-direct-json 70 predates the preset
prefer-effect-is 70 predates the preset
avoid-untagged-errors 64 predates the preset

Global off

Rule Sites Reason
prefer-namespace-imports 147 Hard-codes abbreviations (Arr, P, R) with no options, so it can't be satisfied under the full-name convention shared with consumers. Candidate can't-apply.

off in overrides

Rule Scope Sites Reason
avoid-ts-ignore **/*.types.ts 303 @ts-expect-error is how type-level tests assert. Candidate can't-apply.
avoid-ts-ignore src/Endpoint.ts 20 effect's unexported ErrorNoStream guard can't be satisfied by a generic error list. Upstream effect gap.
no-barrel-imports schema tier (14 files) 12 The ./schema entry may resolve only effect (test/entry-points.test.ts). Candidate can't-apply.
avoid-sync-fs configs, fixtures, artifact tests 21 Run in bare Node before any Effect runtime exists.
avoid-node-imports same 7 same
avoid-process-env same 2 same
use-filesystem-service / use-path-service / use-command-executor-service same 2 each same
use-console-service, avoid-native-fetch, effect-promise-vs-trypromise same 0 same. These overrides can be removed now.
use-temp-file-scoped test/declaration-emit.test.ts 2 Temp directory made in beforeAll and removed in afterAll, outside any Effect scope.

Rules not listed are already at error with zero sites.

Activity

  1. thomasfosterau commented on Oct 30, 2026

    @thomasfosterau
    OwnerAuthor

    Counts and reasons come from the #532 branch, now PR #534.


    Generated by Claude Code

  2. thomasfosterau commented on Oct 30, 2026

    @thomasfosterau
    OwnerAuthor

    Count update from #537: test/emitted/** now leaves lint (it is type-checked against the built declarations, so type-aware lint there would depend on dist/). That removes 1 effect/no-barrel-imports site (92 → 91) and 2 effect/prefer-option-over-null sites (549 → 547). No other effect/* count changed. The new type-aware (tsgolint) remainder is tracked in #536.


    Generated by Claude Code

  3. thomasfosterau commented on Nov 7, 2026

    @thomasfosterau
    OwnerAuthor

    Status from the 2026-11-07 backlog sweep: one slice done, the rest parked.

    • Done: chore(lint): drop the three zero-site overrides in the bare-Node block (#533) #563 removes the three zero-site overrides in the bare-Node block (use-console-service, avoid-native-fetch, effect-promise-vs-trypromise).
    • Remaining warn tier (counts from vp check on trunk 6771efd): require-safety-comment-for-type-assertion 782, casting-awareness 629, prefer-option-over-null 546, avoid-native-object-helpers 347, avoid-non-null-assertion 237, imperative-loops 212, avoid-any 143, effect-run-in-body 127, no-chained-type-assertions 106, no-barrel-imports 91, no-unsafe-dictionary-type 83, no-runtime-typeof 77, use-clock-service 72, avoid-direct-json 70, prefer-effect-is 69, avoid-untagged-errors 64. Each is a multi-PR job, too big for this sweep. Working them one rule per PR, smallest first, is still the plan.

    Decision needed (owner): the issue lists four overrides as "candidate can't-apply". Which ones may stay, with the reason next to them in vite.config.ts?

    1. prefer-namespace-imports (global off): it hard-codes Arr / P / R and has no options. Recommend: keep as can't-apply, since the full-name import convention is shared with the consumers.
    2. avoid-ts-ignore in **/*.types.ts: @ts-expect-error is how type-level tests assert, and AGENTS.md says so. Recommend: keep as can't-apply.
    3. avoid-ts-ignore in src/Endpoint.ts (20): effect doesn't export its ErrorNoStream guard. Recommend: keep, and file upstream to have the guard exported or relaxed. I can send the draft to the orchestrator for filing if you want it.
    4. no-barrel-imports in the schema tier (12): test/entry-points.test.ts pins effect as the only external of ./schema. Recommend: keep as can't-apply.

    If all four are accepted, the "Done" state is: the warn tier above reaches zero (except casting-awareness, which stays at warn by design per #436), plus these four overrides with their reasons.


    Generated by Claude Code

  4. thomasfosterau commented on Nov 12, 2026

    @thomasfosterau
    OwnerAuthor

    effect/prefer-option-over-null: plan (547 sites on trunk 928131a)

    What the rule matches. It's purely syntactic (@enfect/oxlint 0.10.0): one report per TSUnionType whose direct members include null or undefined. Things it does not flag:

    • types derived from a schema (typeof S.Type, Schema.NullOr<…>["Type"])
    • === null checks
    • bare data: null
    • x?: T
    • Option<T>

    The sites are mostly undefined. 497 of the 547 are | undefined; only 38 are | null and 12 are | null | undefined. About 200 are the ?: T | undefined options spelling that AGENTS.md's exactOptionalPropertyTypes bullet prescribes. That bullet gives way to the family rule (options-object members are readonly x?: T, with no | undefined); the bullet is rewritten in the last PR.

    Category Sites Fix
    A: internal 142 Option
    B-opt: published options members 120 readonly x?: T. A request type that HttpApi decodes from Schema.optional is derived from its schema instead.
    B-sig: published params, returns and required props 42 Option returns and optional params (Middleware.negotiate, checkQueryParameters, Lid.LidMap.id, Handlers.resolveIncluded, ApiError detail/source, Document.href, …)
    B-tp: type-parameter sentinels (X extends Fields | undefined = undefined) 33 never as the sentinel, [X] extends [never]
    C: wire shapes 41 Derive from the schemas (typeof X.Type). null stays on the wire, which JSON:API requires, with no flagged site.
    D: tests, examples, type tests 163 Moves with the types they assert
    E: foreign boundaries (Headers.get, URLSearchParams.get, nullable-schema matching) 6 Option.fromNullOr at the boundary

    Every site has an honest spelling that the rule doesn't flag, so no override is needed. Aliasing (type Absent = undefined) and void also evade the rule; they are rejected as gaming it.

    PR split. It starts after #594, #615 and #617. The published breaks all land before the next release, so the apps migrate once.

    1. A (internal)
    2. B-tp (sentinels and their type tests), Breaking: explicit type arguments only
    3. B-opt and B-sig for the server modules (Assemble, Handlers, ResourceHandlers, Document, Endpoint, Query, FlatQuery, Group, Filter, Resource, Lid, Relationship), Breaking
    4. B-opt and B-sig for the other modules (Client, Conformance, Middleware, Negotiation, Registry, ServerErrors, ApiError, Idempotency), Breaking
    5. C and E: schema-derived wire types
    6. The remaining D; the rule goes to error, the count comment is updated, and the AGENTS.md bullet is rewritten

    Migration note for the apps (draft).

    • Options no longer accept an explicit undefined. Under exactOptionalPropertyTypes, omit the key instead.
    • "Maybe" results are now Option; Option.getOrUndefined keeps the old behaviour.
    • At the type level, "absent" is never. Only explicit type arguments are affected.
    • Wire shapes are unchanged.

    Generated by Claude Code

  5. 1 remaining item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions