loading

v33.0.2

select option

Ink ESLint Plugin

An ESLint plugin with ink specific rules

How to install the plugin

You can install it with:

yarn add @carta/eslint-plugin-ink-rules

add it to your .eslintrc file as a plugin:

{
"plugins": ["@carta/ink-rules"]
}

and extend the plugin's recommended rules:

{
"extends": ["plugin:@carta/ink-rules/recommended"]
}

If you want to separately configure each rule you can follow the ESLint documentation, but we highly recommend using the pre-existing configuration so your code is always up to date with the recommended ink guidelines and no accidental errors are introduced.

Rules List

These are the rules we currently have in the linter. They are sectioned into different categories according to what the rule does and are in alphabetical order. They each have a recommended severity, which are the same severities set through the recommended configuration of the plugin.

Possible Errors

RuleShort DescriptionSeverity
checkbox-with-idEnforces the use of id on NewCheckbox and Checkboxerror
no-ink-classesDisallows the usage of .ink-* classeserror

Accessibility & UX

RuleShort DescriptionSeverity
field-with-htmlforSuggests the use of htmlFor in Fields and matching ids in the internal inputswarning
no-placeholdersDisallows the usage of placeholders in inputs outside tableswarning

Deprecation

RuleShort DescriptionSeverity
no-deprecated-propsDisallows the usage of deprecated props in specific componentserror
no-deprecated-componentsDisallows usage and alerts for the deletion date of deprecated componentserror

How to contribute to the plugin

Want to contribute to the plugin? Great! If you feel there is a missing rule that could improve the developer's experience, you can find more information on how to contribute in our Repository.

Is this page helpful?