UNPKG

eslint-plugin-you-dont-need-momentjs

Version:
20 lines (19 loc) 543 B
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' ); } }); }, }; };