Repository navigation
Description
Why
On #81 the owner asked for functions rather than stateful classes:
i'm not a big fan of using stateful OOP when largely pure functional approaches result in simpler and less dynamic and therefore less error prone runtime execution.
Review enforces that today. This issue is to make lint enforce it, starting from eslint-plugin-functional, as the owner asked. A trial found that the plugin doesn't load in this repository, so this issue also proposes writing the rules ourselves.
What would be banned
- Classes, except
Errorsubclasses (ParseError,ConfigError), the usual way to type errors. this, which only means something inside a class or afunctionused as a method.
Local, contained mutation stays allowed. Examples are the accumulator lists in oxCrap's walks, the loop state in allow.ts and coverage.ts, and let. The owner accepted these on #81 as "largely pure".
What it would flag today (trial, 2026-11-23):
no-classesflags 4 classes, with 146 uses ofthisinside them;src/store/useReceiptStore.tsReceiptStore: app state, genuinely stateful;e2e/screenplay/actor.tsandscripts/oxcrap/features/screenplay/actor.tsActor: stateful test helpers;scripts/oxcrap/run.tsRun: holds only an immutableHost.
Each one needs converting, or keeping with a disable comment and a reason. That's a design decision per class, so it belongs in the pull request for this issue.
Candidates
Answers from 2026-11-23.
eslint-plugin-functional 10.0.1, through oxlint's jsPlugins
- Is it needed? We'd use 2 of its rules:
no-classes, withignoreIdentifierPattern: "Error$", andno-this-expressions. - Is it the real one? Yes,
eslint-functional/eslint-plugin-functional. - Is it maintained? Yes. It has two maintainers, 10.0.0 was released 2026-06-03, and 10.0.1 on 2026-09-16.
- Does the license allow it? It's MIT.
- What comes with it? About 160 packages in a scratch install. Its peer dependencies are
eslint^9 or ^10, which we don't use, andtypescript≥ 4.7.4. It also pulls in@typescript-eslint/utils,ts-api-utilsandis-immutable-type. - Is it safe? No.
npm auditreports 2 high: GHSA-ggr8-5vv4-36mx, stack exhaustion indeepmerge-ts< 8.0.0. The plugin pinsdeepmerge-ts^7.1.5, so there is no fixed release; npm's suggested fix is a downgrade to 3.7.2. For us the exposure is small, since it only merges our own rule options in dev tooling, but it is a known unfixed vulnerability. - Does it fit here? No, it doesn't load.
- Under this repo's TypeScript 7: loading fails with
TypeError: Cannot read properties of undefined (reading 'Intrinsic')atts-api-utils. That package needs the TypeScript compiler's JS API, which TypeScript 7 doesn't have. This is the same gap that dropped Stryker's TypeScript checker (test: Add mutation testing with Stryker, starting with oxCrap #77). - Under TypeScript 6, in a scratch folder, it loads. It found 4
no-classes, 146no-this-expressionsand 43no-let, and lint went from about 0.28 s to about 0.83 s. immutable-dataneeds type information, which oxlint's JS plugins can't give it. It crashes on every file where it checks an array method, and each crash drops the other rules' results for that file. Another project reports the same gap.- oxlint's JS plugins are alpha and not subject to semver (announcement).
- Under this repo's TypeScript 7: loading fails with
Writing it ourselves: a local oxlint JS plugin
- What it is: about 30 lines in one file, such as
scripts/lint/functional.ts, loaded with"jsPlugins": ["./scripts/lint/functional.ts"]. oxlint supports local plugin files, and Node runs TypeScript ones natively. - What it covers: two rules matching the plugin's:
- a
ClassDeclaration/ClassExpressionvisitor that skips classes extendingError; - a
ThisExpressionvisitor.
- a
- What it avoids: it needs no type information and adds no dependency, so the TypeScript 7 gap and the vulnerability don't apply.
- What it costs:
- Maintenance: the plugin's tests are ours to write. It's tooling, so it gets unit tests, and it falls in scope for oxCrap and mutation testing once those cover more than
scripts/oxcrap/. - Stability: it relies on the same alpha JS plugin API.
- Maintenance: the plugin's tests are ours to write. It's tooling, so it gets unit tests, and it falls in scope for oxCrap and mutation testing once those cover more than
Already installed: oxlint's max-classes-per-file: 0
- What it bans: every class, with no new code or dependency.
- What it costs: it can't exempt
Errorsubclasses, soParseErrorandConfigErrorwould each need a disable comment. It also leavesthisin afunctionused as a method unflagged.
Recommendation
Write the two rules ourselves. eslint-plugin-functional doesn't load under TypeScript 7, and its version has a known unfixed high vulnerability. max-classes-per-file works, but it bans typed errors and leaves this alone. The local plugin is small, has no dependency, and bans exactly what the owner asked for.
Open questions
- The four classes: convert or keep each one?
ReceiptStoreis the app's store, so converting it touches the React side.- The two
Actors follow the screenplay pattern used in the e2e tests and feature contracts. Runconverts easily.
- Scope: should the rule cover the whole repo, as
func-styledoes, or start withscripts/? - Where the reasons live: a
.meta.mdsidecar for the plugin, or a section in an existing doc.
Activity
DetweilerRyan commentedon Nov 24, 2026
Decisions given in a Claude Code session, 2026-11-24, before the overnight run. The owner asked for the work to be done without their input where possible, with stacked pull requests. If an undecided choice comes up, the owner said "Pick the reversible default": choose the most reversible option and list it under "Decisions made" in the pull request.
Ban classes and this with a local oxlint plugin
Disable no-this per line and skip typeof this
Fix what the seventh fact-check round found in the sidecar
Fix what the eighth fact-check round found in the sidecar
Fix what the ninth fact-check round found in the sidecar
Fix what the seventh fact-check round found in the sidecar
Fix what the eighth fact-check round found in the sidecar
Fix what the ninth fact-check round found in the sidecar