UNPKG

@miovision/eslint-plugin-disallow-date

Version:

An ESLint plugin to disallow usage of JavaScript Date objects.

25 lines (23 loc) 668 B
/** * @fileoverview description * @author Ryan Skoblenick */ 'use strict'; module.exports = (context) => { return { 'NewExpression': (node) => { if (node.type === 'NewExpression' && node.callee.type === 'Identifier' && node.callee.name === 'Date') { context.report(node, `Usage of \`${node.callee.name}\` objects is prohibited.`); } }, 'CallExpression': (node) => { if (node.type === 'CallExpression' && node.callee.type === 'Identifier' && node.callee.name === 'Date') { context.report(node, `Usage of \`${node.callee.name}\` objects is prohibited.`); } }, }; };