@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
35 lines • 1.07 kB
JavaScript
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: 'Replace <{{ name }}> with Code from @atlaskit/code/code for inline code. Preserve the code text; use CodeBlock for a multi-line code block rather than changing its semantics.'
}
},
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;