Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 1.03 KB

no-valueless-arguments.md

File metadata and controls

36 lines (22 loc) · 1.03 KB

no-valueless-arguments

✅ The extends: 'recommended' property in a configuration file enables this rule.

Similar to HTML attributes, component arguments will default to an empty string when they are not explicitly assigned a value. This behavior isn't documented anywhere so depending on it isn't recommended and usually the result of a user-error. Since it is valid syntax, accidental use of this behavior can be hard to detect and cause confusing bugs.

Examples

This rule forbids the following:

<Editor @defaultText />
<SomeComponent @valuelessByAccident{{@canBeAModifier}} />

This rule allows the following:

<Editor @defaultText="" />

Migration

Explicitly assign a value to all arguments.

Related Rules

References