UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

35 lines • 1.11 kB
import { createLintRule } from '../utils/create-lint-rule'; import { JSXElement } from './node-types/jsx-element'; import { StyledComponent } from './node-types/styled-component'; const rule = createLintRule({ meta: { name: 'no-html-textarea', type: 'suggestion', hasSuggestions: true, docs: { description: 'Discourage direct usage of HTML textarea elements in favor of the Atlassian Design System textarea component.', recommended: true, severity: 'warn' }, messages: { noHtmlTextarea: 'Replace <{{ name }}> with Textarea from @atlaskit/textarea/text-area. Preserve the field name, value, change handler and label association; use the supported sizing props for its intended height.' } }, create(context) { return { // transforms styled.<textarea>(...) usages CallExpression(node) { StyledComponent.lint(node, { context }); }, // transforms <textarea css={...}> usages JSXElement(node) { JSXElement.lint(node, { context }); } }; } }); export default rule;