Skip to content

lintAsl

function lintAsl(params): LintDiagnostic[];

Defined in: src/lint.ts:217

Lint an ASL definition and return every finding, instead of throwing on the first.

Runs the same structural traversal as validateAsl (every fault that would make the render path throw comes back as an error), plus rules a definition can violate while still rendering:

code severity rule
unreachable-state warning no path from the scope’s StartAt reaches the state
dangling-transition error StartAt / Next / Default / Choices[].Next / Catch[].Next names a state missing from its scope
choice-without-default warning a Choice has no Default
duplicate-state-name warning a state name is reused in another States block
end-with-next error End: true together with Next
unsupported-retry-catch error Retry / Catch on a Pass, Wait, Choice, Succeed or Fail state
query-language-mismatch error a JSONPath-only field (InputPath, Parameters, ResultPath, …) in a JSONata state, or Arguments / Output / Items in a JSONPath state, judged by the resolved QueryLanguage

Structural codes (invalid-structure, invalid-state-type, invalid-field, missing-transition) mirror validateAsl’s messages one to one. A string that is not valid JSON yields a single invalid-json error.

LintAslParams

Object parameters

LintDiagnostic[]

Diagnostics in traversal order; empty when the definition is clean

const diagnostics = lintAsl({ definition: asl });
const errors = diagnostics.filter((diagnostic) => diagnostic.severity === 'error');
for (const { path, code, message } of diagnostics) {
console.log(`${path} [${code}] ${message}`);
}