lib/rules/no-extra-parens.js
function checkExpressionOrExportStatement(node) {
            const firstToken = isParenthesised(node) ? sourceCode.getTokenBefore(node) : sourceCode.getFirstToken(node);
            const secondToken = sourceCode.getTokenAfter(firstToken, astUtils.isNotOpeningParenToken);
            const thirdToken = secondToken ? sourceCode.getTokenAfter(secondToken) : null;
            const tokenAfterClosingParens = secondToken ? sourceCode.getTokenAfter(secondToken, astUtils.isNotClosingParenToken) : null;

            if (
                astUtils.isOpeningParenToken(firstToken) &&
                (
                    astUtils.isOpeningBraceToken(secondToken) ||
                    secondToken.type === "Keyword" && (
                        secondToken.value === "function" ||
                        secondToken.value === "class" ||
                        secondToken.value === "let" &&
                            tokenAfterClosingParens &&
                            (
                                astUtils.isOpeningBracketToken(tokenAfterClosingParens) ||
                                tokenAfterClosingParens.type === "Identifier"
                            )
                    ) ||
                    secondToken && secondToken.type === "Identifier" && secondToken.value === "async" && thirdToken && thirdToken.type === "Keyword" && thirdToken.value === "function"
                )
            ) {
                tokensToIgnore.add(secondToken);
            }

            if (hasExcessParens(node)) {
                report(node);
            }
        }
function checkExpressionOrExportStatement(node) {
            const firstToken = isParenthesised(node) ? sourceCode.getTokenBefore(node) : sourceCode.getFirstToken(node);
            const secondToken = sourceCode.getTokenAfter(firstToken, astUtils.isNotOpeningParenToken);
            const thirdToken = secondToken ? sourceCode.getTokenAfter(secondToken) : null;
            const tokenAfterClosingParens = secondToken ? sourceCode.getTokenAfter(secondToken, astUtils.isNotClosingParenToken) : null;

            if (
                astUtils.isOpeningParenToken(firstToken) &&
                (
                    astUtils.isOpeningBraceToken(secondToken) ||
                    secondToken.type === "Keyword" && (
                        secondToken.value === "function" ||
                        secondToken.value === "class" ||
                        secondToken.value === "let" &&
                            tokenAfterClosingParens &&
                            (
                                astUtils.isOpeningBracketToken(tokenAfterClosingParens) ||
                                tokenAfterClosingParens.type === "Identifier"
                            )
                    ) ||
                    secondToken && secondToken.type === "Identifier" && secondToken.value === "async" && thirdToken && thirdToken.type === "Keyword" && thirdToken.value === "function"
                )
            ) {
                tokensToIgnore.add(secondToken);
            }

            if (hasExcessParens(node)) {
                report(node);
            }
        }
function checkExpressionOrExportStatement ( node ) { const firstToken = isParenthesised ( node ) ? sourceCode . getTokenBefore ( node ) : sourceCode . getFirstToken ( node ) ; const secondToken = sourceCode . getTokenAfter ( firstToken , astUtils . isNotOpeningParenToken ) ; const thirdToken = secondToken ? sourceCode . getTokenAfter ( secondToken ) : null ; const tokenAfterClosingParens = secondToken ? sourceCode . getTokenAfter ( secondToken , astUtils . isNotClosingParenToken ) : null ; if ( astUtils . isOpeningParenToken ( firstToken ) && ( astUtils . isOpeningBraceToken ( secondToken ) || secondToken . type === "Keyword" && ( secondToken . value === "function" || secondToken . value === "class" || secondToken . value === "let" && tokenAfterClosingParens && ( astUtils . isOpeningBracketToken ( tokenAfterClosingParens ) || tokenAfterClosingParens . type === "Identifier" ) ) || secondToken && secondToken . type === "Identifier" && secondToken . value === "async" && thirdToken && thirdToken . type === "Keyword" && thirdToken . value === "function" ) ) { tokensToIgnore . add ( secondToken ) ; } if ( hasExcessParens ( node ) ) { report ( node ) ; } }
Checks the parentheses for an ExpressionStatement or ExportDefaultDeclaration
@param {ASTNode} node The ExpressionStatement.expression or ExportDefaultDeclaration.declaration node
@returns {void}
Checks the parentheses for an ExpressionStatement or ExportDefaultDeclaration