Last Updated: Jan 10, 2026
An ESLint plugin with ink specific rules
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.
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
| Rule | Short Description | Severity |
|---|---|---|
| checkbox-with-id | Enforces the use of id on NewCheckbox and Checkbox | error |
| no-ink-classes | Disallows the usage of .ink-* classes | error |
Accessibility & UX
| Rule | Short Description | Severity |
|---|---|---|
| field-with-htmlfor | Suggests the use of htmlFor in Fields and matching ids in the internal inputs | warning |
| no-placeholders | Disallows the usage of placeholders in inputs outside tables | warning |
Deprecation
| Rule | Short Description | Severity |
|---|---|---|
| no-deprecated-props | Disallows the usage of deprecated props in specific components | error |
| no-deprecated-components | Disallows usage and alerts for the deletion date of deprecated components | error |
Checkbox with id
Recommended Severity: error
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.
Link to the rule on AST Explorer.
No ink classes
This rule prevents the usage of .ink-* hardcoded classes. These class names are a part of a private API used internally for the Ink library, and are being deprecated. Instead, use Ink components themselves to ensure compatibility with future versions of the library.
Recommended Severity: error
Field with htmlFor
This rule suggests the use of htmlFor in Fields and id in inputs, and reinforces that those two props should be the same. Matching the htmlFor and id props improves accessibility - if they don't match, the input is not linked to the label inside Field, and consequently cannot be hovered, focused, or selected when clicking the label.
Recommended Severity: warning
Link to the rule on AST Explorer.
No placeholders
This rule suggests avoiding the use of placeholder in inputs except when inside a table cell. Using placeholders in inputs can cause accessibility issues and a bad user experience. An empty input tells the user that they still need to add information, while placeholders may cause confusion.
Recommended Severity: warning
Link to the rule on AST Explorer.
No deprecated props
This rule disallows the use of deprecated props in ink components. These props will eventually be deleted. Avoid using them to mitigate the risk of your product breaking in the near future.
At the moment the components and props affected by this rule are:
| Component | Prop | Replacement Prop |
|---|---|---|
| Alert | type | variant |
| ListItem | statusColor | variant |
| ListItem | statusIcon | variant |
| ListItem | statusDashed | variant |
| ListItem | statusInverse | variant |
| ListItem | statusSpinner | variant= "pending" |
| Monologue | marginBottom | Box bottom |
| Monologue | marginTop | Box top |
| NewInput | inputRef | externalRef |
| Status | color | variant |
| Status | icon | variant |
| Status | isDashed | variant |
| Status | isInverse | variant |
| Status | isSpinner | variant= "pending" |
Recommended Severity: error
Link to the rule on AST Explorer.
No deprecated components
This rule disallows the use of deprecated components. If these components are already in use, they should be replaced with their newer counterparts. These components will be deleted on their determined date. Follow each migration guide to replace older components and reach out to the ink team if you have any problems.
At the moment the components affected by this rule are:
To migrate off of these components, go to their specific page to see their migration guide.
To check the code for this plugin, go to our Repository.
How to install the plugin
Categories
Rules