Skip to content

yml/no-boolean-key

disallow boolean mapping keys

📖 Rule Details

YAML resolves some plain scalars as booleans. When those values are used as mapping keys, downstream processors can mishandle them, as reported in issue #280. A common example is the no: "Norway problem," where a key intended as text resolves to false.

This rule reports boolean mapping keys in any YAML document. Which plain scalars resolve to booleans depends on the document's YAML version. YAML 1.1 additionally resolves the y/yes, n/no, on, and off families, while the YAML 1.2 core schema resolves only true/false and the True/TRUE and False/FALSE case variants.

Now loading...

🔧 Options

Nothing.

⚠️ When Not To Use It

You do not need this rule if your codebase intentionally allows boolean mapping keys and downstream consumers handle them safely.

🚀 Version

This rule was introduced in eslint-plugin-yml v3.7.0

🔍 Implementation