UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

35 lines 1.22 kB
import { createLintRule } from '../utils/create-lint-rule'; import { JSXElement as _JSXElement } from './node-types/jsx-element'; import { StyledComponent } from './node-types/styled-component'; var rule = createLintRule({ meta: { name: 'no-html-heading', type: 'suggestion', hasSuggestions: true, docs: { description: 'Discourage direct usage of HTML heading elements in favor of Atlassian Design System heading components.', recommended: true, severity: 'warn' }, messages: { noHtmlHeading: "This <{{ name }}> should be replaced with a heading component from the Atlassian Design System. ADS headings include ensure accessible implementations and provide access to ADS styling features like design tokens." } }, create: function create(context) { return { // transforms styled.<heading>(...) usages CallExpression: function CallExpression(node) { StyledComponent.lint(node, { context: context }); }, // transforms <heading css={...}> usages JSXElement: function JSXElement(node) { _JSXElement.lint(node, { context: context }); } }; } }); export default rule;