1 | ;
|
2 |
|
3 | const ruleComposer = require('eslint-rule-composer');
|
4 | const eslint = require('eslint');
|
5 | const 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 | */
|
12 | function isDecorator(node) {
|
13 | return node.parent.type === "Decorator";
|
14 | }
|
15 |
|
16 | module.exports = ruleComposer.filterReports(
|
17 | newCapRule,
|
18 | (problem, metadata) => !isDecorator(problem.node)
|
19 | );
|