Tools
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.
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 |
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 |
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 |
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?