eslint-plugin-putout
Version:
ESLint plugin for 🐊Putout
24 lines (17 loc) • 510 B
JavaScript
;
module.exports.category = 'object';
module.exports.report = () => 'Remove empty import specifiers';
module.exports.filter = ({text, node, getCommentsInside}) => {
const comments = getCommentsInside(node);
if (comments.length)
return false;
return text.includes('{}');
};
module.exports.fix = ({text}) => {
return text
.replace('import {} from', 'import')
.replace(/,? {}/, '');
};
module.exports.include = () => [
'ImportDeclaration',
];