eslint-plugin-destructuring
Version:
destructuring specific linting rules for ESLint
21 lines (18 loc) • 621 B
JavaScript
;
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {}
},
create: function noRename(context) {
return {
Property: function Property(node) {
if (node.parent.type === 'ObjectPattern' && node.shorthand === false && node.value && node.value.type === 'Identifier' && node.key.type !== 'Literal') {
context.report(node, 'Do not use destructuring rename for valid identifiers.');
}
}
};
}
};