@atlaskit/eslint-plugin-design-system
Version:
The essential plugin for use with the Atlassian Design System.
31 lines (26 loc) • 884 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isBlockedEventBinding = isBlockedEventBinding;
var _eslintCodemodUtils = require("eslint-codemod-utils");
var _blockedEventNameLookup = require("./blocked-event-name-lookup");
function isBlockedEventBinding(property) {
if (!(0, _eslintCodemodUtils.isNodeOfType)(property, 'Property')) {
return false;
}
// are we looking at the "type" property?
var key = property.key;
if (!(0, _eslintCodemodUtils.isNodeOfType)(key, 'Identifier')) {
return false;
}
if (key.name !== 'type') {
return false;
}
// is the "type" property value blocked?
var value = property.value;
if (!(0, _eslintCodemodUtils.isNodeOfType)(value, 'Literal')) {
return false;
}
return typeof value.value === 'string' && _blockedEventNameLookup.blockedEventNameLookup.has(value.value);
}