@atlaskit/eslint-plugin-ui-styling-standard
Version:
The eslint plugin to enforce and educate on Atlassian's UI Styling Standard
23 lines (21 loc) • 795 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isTypeWrapper = isTypeWrapper;
/**
* TypeScript-only wrappers around an expression that ESTree does not model. None of them change
* the runtime value, so a rule reading a style key, value or argument should look through them:
*
* - `['.foo' satisfies `.${typeof FOO_CLASS}`]: {…}`
* - `color: 'red !important' as const`
* - `css({…} as const)`
* - `<T>{…}` and `value!`
*/
var TYPE_WRAPPER_TYPES = new Set(['TSAsExpression', 'TSNonNullExpression', 'TSSatisfiesExpression', 'TSTypeAssertion']);
/**
* Whether `node` is a TypeScript wrapper (`as`, `satisfies`, `<T>`, `!`) around an expression.
*/
function isTypeWrapper(node) {
return Boolean(node && TYPE_WRAPPER_TYPES.has(node.type));
}