Repository navigation
Check no-conditional-none-branch only on event handlers - #257
Merged
Merged
Conversation
6 of 7 tasks
SandroMaglione
force-pushed
the
oxlint-plugin-consumer-rules
branch
from
November 1, 2026 09:56
b06a1a6 to
d68e45b
Compare
Machine.can queries events, not invocation outcomes or eventless transitions, so no-conditional-none-branch now checks only resolvers of handlers in a state's `on` record. This removes the false positive on the devtools invoke-outcomes example, whose onSnapshot resolver selects a titled `none` branch while the worker starts, and its suppression comment. Also restore the no-conflicting-invocation-identity README example that the formatter had collapsed into `invoke: ;`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SandroMaglione
force-pushed
the
oxlint-plugin-consumer-rules
branch
from
November 1, 2026 22:56
d68e45b to
cb011ff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
effect-machine/no-conditional-none-branchnow checks only event handlers in a state'sonrecord.Machine.canqueries events, not invocation outcomes (onSnapshot,onDone, …) or eventlessalwaystransitions, so a resolver there may select anonebranch conditionally. Dogfooding in #260 hit this false positive on the devtoolsinvoke-outcomes-example.ts, whoseonSnapshotresolver selects a titlednonebranch while the worker starts. This PR removes that suppression comment, and new valid tests coveronSnapshotandalways.The README's
no-conflicting-invocation-identityexample, which the formatter had collapsed intoinvoke: ;, is restored as two object literals.Rules evaluated and not added
This PR originally ported seven rules from a production consumer. After review, none were kept:
no-runsync-machine-can: an application/React convention rather than a machine-model check.no-guarded-none: a guardednonefalls through to an ancestor handler when the guard fails, which is the same behavior as the suggesteddeclinableresolver. The rule only forced a longer spelling.no-duplicate-sibling-transitions: its fix can change behavior. A transition's callbacks readstaterelative to the declaring state, so the same guard gives a different result when moved to the parent. It also treated an unresolved root as non-parallel.no-public-event-self-raise: a convention whose detection misses the common layout of events declared in another module.no-shadowing-none: reports the documented pattern of deliberately ignoring an ancestor's event, and its fix duplicates handlers.no-raise-only-resolve: reports the only way to transition and raise in one handler whenever the machine has any parallel state, even if the raised event never crosses regions.no-large-machine-in-component: a file-organization policy with an arbitrary threshold.Changeset
patchfor@typeonce/oxlint-plugin-effect-machine)Validation
pnpm check(includespnpm lint, which now reports no finding on the devtools example without the suppression)🤖 Generated with Claude Code