UNPKG

544 BJavaScriptView Raw
1"use strict";
2
3const ruleComposer = require('eslint-rule-composer');
4const eslint = require('eslint');
5const newCapRule = new eslint.Linter().getRules().get('new-cap');
6
7/**
8 * Returns whether a node is under a decorator or not.
9 * @param {ASTNode} node CallExpression node
10 * @returns {Boolean} Returns true if the node is under a decorator.
11 */
12function isDecorator(node) {
13 return node.parent.type === "Decorator";
14}
15
16module.exports = ruleComposer.filterReports(
17 newCapRule,
18 (problem, metadata) => !isDecorator(problem.node)
19);