Skip to content

add-constant

Default severity: note

Reports a string literal when it appears for the third time in one file. A named constant keeps repeated protocol values, states, and keys consistent.

if state == "ready" { start() }
if next == "ready" { queue() }
if previous == "ready" { resume() }
const stateReady = "ready"
if state == stateReady { start() }