UNPKG

@atlaskit/eslint-plugin-design-system

Version:

The essential plugin for use with the Atlassian Design System.

35 lines (33 loc) 857 B
/* eslint-disable @repo/internal/react/require-jsdoc */ import { isNodeOfType } from 'eslint-codemod-utils'; export const RestrictedCapitalisation = { lint(node, { context, config }) { if (RestrictedCapitalisation._check(node, { context, config })) { context.report({ node, messageId: 'noRestrictedCapitalisation' }); } }, _check(node, { config }) { if (!config.patterns.includes('restricted-capitalisation')) { return false; } if (!isNodeOfType(node, 'Property')) { return false; } // Prevent text transform being used to uppercase all characters if (isNodeOfType(node.key, 'Identifier') && node.key.name === 'textTransform' && isNodeOfType(node.value, 'Literal')) { return node.value.value === 'uppercase'; } return false; } };