@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
35 lines • 1.17 kB
JavaScript
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: 'Replace <{{ name }}> with Heading from @atlaskit/heading/heading. Preserve the semantic h1-h6 level with as, and choose size separately for the intended visual hierarchy.'
}
},
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;