eslint-plugin-you-dont-need-momentjs
Version:
Check better alternatives you can use without momentjs
20 lines (19 loc) • 543 B
JavaScript
module.exports = function(context) {
return {
ImportDeclaration: function(node) {
node.specifiers.forEach(function(specifier) {
if (
(specifier.type === 'ImportDefaultSpecifier' ||
specifier.type === 'ImportNamespaceSpecifier') &&
specifier.local.type === 'Identifier' &&
specifier.local.name === 'moment'
) {
context.report(
node,
'Use date-fns or Native Date methods instead of moment.js'
);
}
});
},
};
};