UNPKG

490 BJavaScriptView Raw
1const eslint = require('eslint');
2const ruleComposer = require('eslint-rule-composer');
3
4const rule = new eslint.Linter().getRules().get('no-extra-parens');
5
6module.exports = ruleComposer.filterReports(
7 rule,
8 (problem) => {
9 if (problem.node.type === 'ConditionalExpression'
10 && (problem.node.parent.type === 'ConditionalExpression' || problem.node.parent.type === 'SpreadElement')
11 ) {
12 return false;
13 }
14
15 return problem;
16 }
17);