@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
25 lines (21 loc) • 655 B
JavaScript
import { isNodeOfType } from 'eslint-codemod-utils';
import { blockedEventNameLookup } from './blocked-event-name-lookup';
export function isBlockedEventBinding(property) {
if (!isNodeOfType(property, 'Property')) {
return false;
}
// are we looking at the "type" property?
const key = property.key;
if (!isNodeOfType(key, 'Identifier')) {
return false;
}
if (key.name !== 'type') {
return false;
}
// is the "type" property value blocked?
const value = property.value;
if (!isNodeOfType(value, 'Literal')) {
return false;
}
return typeof value.value === 'string' && blockedEventNameLookup.has(value.value);
}