loading

v33.3.1

select option

checkbox-with-id

Enforces the use of ids on NewCheckboxes and Checkboxes

In order to properly work, each Ink checkbox needs an id. This rule prevents non-functional checkboxes by enforcing the use of ids on Checkbox and NewCheckbox and throwing an error when an id is not provided.

Severity

Recommended Severity: error

rules: {
'@carta/ink-rules/checkbox-with-id': 2,
}

Components affected by this rule

Checkbox and NewCheckbox.

Examples

<NewCheckbox />
<Checkbox />
<NewCheckbox id="any-id" />
<Checkbox id="any-other-id" />

Don't

Use Checkboxes without ids

Do

Add ids to your Checkboxes so they can properly work

<NewCheckbox />
<Checkbox />

Don't

Use Checkboxes without ids

<NewCheckbox id="any-id" />
<Checkbox id="any-other-id" />

Do

Add ids to your Checkboxes so they can properly work

How this rule works

To investigate how this rule works, check out this gist on AST Explorer.

Is this page helpful?