UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

31 lines (29 loc) 957 B
/* eslint-disable @repo/internal/react/require-jsdoc */ import { isNodeOfType } from 'eslint-codemod-utils'; import { isPropertyName } from './common'; export var RestrictedCapitalisation = { lint: function lint(node, _ref) { var context = _ref.context, config = _ref.config; if (RestrictedCapitalisation._check(node, { context: context, config: config })) { context.report({ node: node, messageId: 'noRestrictedCapitalisation' }); } }, _check: function _check(node, _ref2) { var config = _ref2.config; if (!config.patterns.includes('restricted-capitalisation')) { return false; } // Prevent text transform being used to uppercase all characters if (isPropertyName(node, 'textTransform') && isNodeOfType(node.parent, 'Property') && isNodeOfType(node.parent.value, 'Literal')) { return node.parent.value.value === 'uppercase'; } return true; } };