Docs/Lint rules

Tools

Lint rules

efs lint checks the syntax tree, so it runs instantly and needs no type information. The same rules appear in the editor as you type.

RuleDefault
discarded-effectwarningAn effect built as a statement in an effect body is never run (Console.log(x) without run).
throw-in-effectwarningthrow in an effect body becomes a defect; use fail.
prefer-failhintreturn run Effect.fail(e) is fail e.
unused-bindingwarningA local binding is never used.
prefer-constwarningA let that is never reassigned should be const.
pascal-casewarningServices, errors, schemas, machines, components, states, events and messages are PascalCase.
unknown-eventerrorA machine handles an event it does not declare.
unreachable-statewarningNo transition enters a machine state.
message-namingwarningEffect UI messages are past-tense facts (ClickedSave), not commands (SetName).
strict-equalityhint== already compiles to ===.
multiple-withwarningChained with A with B provides layers one at a time; provide them together.
run-effect-inside-effectwarningEffect.run* inside an effect body starts a separate program; use run.
missing-concurrency-optionhintEffect.all and Effect.forEach are sequential unless concurrency is set.
new-promise-in-effecthintnew Promise in an effect body; use Effect.callback or Effect.tryPromise.
global-console-in-effect, global-date-in-effect, global-fetch-in-effect, global-random-in-effect, global-timers-in-effect, process-env-in-effecthintGlobals used directly in an effect body that have Effect services: Console, Clock/DateTime, HttpClient, Random, Effect.sleep/Schedule, Config.

The rules about globals only apply directly in effect bodies, not in plain callbacks: Effect.sync(() => Date.now()) is the right way to use them.

Silence a rule for one line with a comment on the line above:

EffScriptTry it
// efs-ignore: unused-bindingconst draft = run load();

// efs-ignore alone silences every rule for that line. To turn a rule off for a project, list it under "lint": { "disabled": [...] } in efs.json.

For type-aware checks (unhandled errors, layer mistakes and about 150 more), run efs check --effect, which adds the Effect Language Service's diagnostics. See TypeScript interop.

Edit this page on GitHub →
MIT licensedBuilt with EffScript, Effect UI and Tailwind CSSGitHub