@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
35 lines • 1.14 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-select',
type: 'suggestion',
hasSuggestions: true,
docs: {
description: 'Discourage direct usage of HTML select elements in favor of the Atlassian Design System select component.',
recommended: true,
severity: 'warn'
},
messages: {
noHtmlSelect: `This <{{ name }}> should be replaced with the select component from the Atlassian Design System. ADS select components have event tracking, ensure accessible implementations, and provide access to ADS styling features like design tokens.`
}
},
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;