How to use the eslint-utils.isNotOpeningParenToken function in eslint-utils

To help you get started, we’ve selected a few eslint-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sikidamjanovic / cowrite / node_modules / @typescript-eslint / eslint-plugin / dist / rules / indent-new-do-not-use / index.js View on Github external
'ClassDeclaration[superClass], ClassExpression[superClass]'(node) {
                const classToken = sourceCode.getFirstToken(node);
                const extendsToken = sourceCode.getTokenBefore(node.superClass, eslint_utils_1.isNotOpeningParenToken);
                offsets.setDesiredOffsets([extendsToken.range[0], node.body.range[0]], classToken, 1);
            },
            ConditionalExpression(node) {
github sikidamjanovic / cowrite / node_modules / @typescript-eslint / eslint-plugin / dist / rules / indent-new-do-not-use / index.js View on Github external
function addBlocklessNodeIndent(node) {
            if (node.type !== 'BlockStatement') {
                const lastParentToken = sourceCode.getTokenBefore(node, eslint_utils_1.isNotOpeningParenToken);
                let firstBodyToken = sourceCode.getFirstToken(node);
                let lastBodyToken = sourceCode.getLastToken(node);
                while (eslint_utils_1.isOpeningParenToken(sourceCode.getTokenBefore(firstBodyToken)) &&
                    eslint_utils_1.isClosingParenToken(sourceCode.getTokenAfter(lastBodyToken))) {
                    firstBodyToken = sourceCode.getTokenBefore(firstBodyToken);
                    lastBodyToken = sourceCode.getTokenAfter(lastBodyToken);
                }
                offsets.setDesiredOffsets([firstBodyToken.range[0], lastBodyToken.range[1]], lastParentToken, 1);
                /*
                 * For blockless nodes with semicolon-first style, don't indent the semicolon.
                 * e.g.
                 * if (foo) bar()
                 * ; [1, 2, 3].map(foo)
                 */
                const lastToken = sourceCode.getLastToken(node);
                if (lastToken &&