@atlaskit/eslint-plugin-ui-styling-standard
Version:
The eslint plugin to enforce and educate on Atlassian's UI Styling Standard
18 lines • 450 B
JavaScript
function hasSafeKey(property) {
if (property.computed) {
return property.key.type === 'Literal';
}
return true;
}
export function isSafeProperty(property, isSafePropertyValue) {
if (property.type === 'SpreadElement') {
return false;
}
if (property.method || property.shorthand || property.kind !== 'init') {
return false;
}
if (!hasSafeKey(property)) {
return false;
}
return isSafePropertyValue(property.value);
}