UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

35 lines 1.08 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-code', type: 'suggestion', hasSuggestions: true, docs: { description: 'Discourage direct usage of HTML code elements in favor of the Atlassian Design System code component.', recommended: true, severity: 'warn' }, messages: { noHtmlCode: `This <{{ name }}> should be replaced with the code component from the Atlassian Design System. The ADS code component ensures accessible implementations and consistent ADS styling.` } }, create(context) { return { // transforms styled.<anchor>(...) usages CallExpression(node) { StyledComponent.lint(node, { context }); }, // transforms <anchor css={...}> usages JSXElement(node) { JSXElement.lint(node, { context }); } }; } }); export default rule;