UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

38 lines 1.32 kB
import { createLintRule } from '../utils/create-lint-rule'; import { StyleProperty } from './transformers/style-property'; const rule = createLintRule({ meta: { name: 'use-tokens-space', type: 'problem', fixable: 'code', hasSuggestions: true, docs: { description: 'Enforces usage of space design tokens rather than hard-coded values.', recommended: false, severity: 'error' }, messages: { noRawSpacingValues: 'The use of spacing primitives or tokens is preferred over the direct application of spacing 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;