UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

38 lines 1.31 kB
import { createLintRule } from '../utils/create-lint-rule'; import { StyleProperty } from './transformers'; const rule = createLintRule({ meta: { name: 'use-tokens-shape', type: 'problem', fixable: 'code', hasSuggestions: true, docs: { description: 'Enforces usage of shape design tokens rather than hard-coded values.', recommended: false, severity: 'error' }, messages: { noRawShapeValues: 'The use of shape tokens is preferred over the direct application of border radius and border width properties.' } }, create(context) { return { 'CallExpression[callee.name="css"] ObjectExpression Property': node => StyleProperty.lint(node, { context }), 'CallExpression[callee.name="keyframes"] ObjectExpression Property': node => StyleProperty.lint(node, { context }), 'CallExpression[callee.name="cssMap"] ObjectExpression Property': node => StyleProperty.lint(node, { context }), 'CallExpression[callee.object.name=styled] ObjectExpression Property': node => StyleProperty.lint(node, { context }), 'CallExpression[callee.object.name=styled2] ObjectExpression Property': node => StyleProperty.lint(node, { context }) }; } }); export default rule;