Repository navigation
Minor Changes
-
ef32f11:
missedPipeableOpportunitynow treats data-first and data-last calls as steps of a nested call chain, not only unary and curried calls.Option.map(Option.flatMap(option, f), g) // now reported, fixes to option.pipe(Option.flatMap(f), Option.map(g)) Layer.fresh(Layer.effect(Cache, makeCache)) // now reported, fixes to makeCache.pipe(Layer.effect(Cache), Layer.fresh)
pipeableMinArgCountnow counts every unary, curried, data-first or data-last call that is not already in a pipe, so withpipeableMinArgCount: 1a singleEffect.map(e, f)is also reported ase.pipe(Effect.map(f)).A data-first or data-last call with explicit type arguments is not piped, since the pipe form would drop them, and a data-last call is only piped when its other arguments have no side effects, since the pipe form evaluates its input first.
-
16d85ae: Add the
preferEffectNumberdiagnostic (groupeffectNative, off by default). It reports hand-written numeric code that has a directeffect/Numberequivalent: clamps, rounding to N digits, sums and products, increment and decrement callbacks, subtraction comparators, range checks and zero-checked divisions. It also reportsn => n++callbacks,Math.max(...values)andNumber()/parseFloatresults checked withisNaN.// before const percent = Math.min(100, Math.max(0, value)) const total = values.reduce((a, b) => a + b, 0) const average = count === 0 ? 0 : total / count // after the quick fix const percent = Num.clamp(value, { minimum: 0, maximum: 100 }) const total = Num.sumAll(values) const average = Opt.getOrElse(Num.divide(total, count), () => 0)
A rewrite that keeps the behavior is a quick fix that adds any missing
import * as Num from "effect/Number"(andOpt,Order) import. A rewrite that may change it (a NaN minimum in a range check, a product with 0 and NaN, reordered effectful operands, untyped or JavaScript operands) is offered as a suggestion whose title says why. Cases whose rewrite would run an effectful operand a different number of times, lose a comment, or cannot tell the clamped value from its bounds get no quick fix.Piping flows now also recognize
Array.sort(values, order)as a data-first step, and Effect v4 duals typed as an intersection of function types, such asRef.update(ref, f).
Patch Changes
-
54fbe02:
apiStabilityLeakgives each member of a namespace re-export its own analysis budget. Before, all members ofexport * as Ns from "./module"shared one budget, so on a large module the later members could run out of it and miss their findings, depending on which files the checker had analyzed first.// index.ts export * as HttpClient from "./HttpClient.ts" // now always reports `HttpClient` exposes `Classifier`, an experimental API, // reached through `WithCircuitBreaker.Options`
-
4d7e1a2: CI: run the heavy Rust and compile jobs on namespace.so runners (
namespace-profile-linux-default), as the Effect repository does: Validate tsrs, the Oxlint builds and the perf build. Jobs that run the Go test suite (Validate, Update Upstreams) stay on GitHub-hosted runners, sinceinternal/effecttestpeaks near 8GB and does not fit the profile's 4x8 machine. On namespace runners, the setup action caches the pnpm store withnscloud-cache-action. -
96f1a61: Speed up the Oxlint type-aware pass (
--tsrs-lintand the tsgolint mode) when many Effect rules are enabled. Each Effect rule runs as its own Oxlint rule, and before this change every rule redid the per-file setup: resolving the plugin options and overrides, and scanning the whole file for@effect-diagnosticsdirectives. That setup is now prepared once per file and shared by all Effect rules, and files without any@effect-diagnosticscomment skip the directive scan entirely (this also helps the tsc and language-service paths).With all Effect rules at
error, tsrs CPU time drops by about 37-42% on t3code, opencode and the Effect monorepo, with identical diagnostics (#1104). -
f8a1f86: Update the TypeScript next tag to
typescript@next, which shipstypescript-gocommit23091b541b898c22c9695f72b417bdb631261c37, update the TypeScript beta tag totypescript@beta, and update the TypeScript latest tag totypescript@latest.