charlike
Version:
Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options
36 lines (27 loc) • 853 B
JavaScript
/**
* @fileoverview Rule to disallow use of new operator with the `require` function
* @author Wil Moore III
*/
;
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {
description: "disallow `new` operators with calls to `require`",
category: "Node.js and CommonJS",
recommended: false
},
schema: []
},
create(context) {
return {
NewExpression(node) {
if (node.callee.type === "Identifier" && node.callee.name === "require") {
context.report(node, "Unexpected use of new with require.");
}
}
};
}
};