Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
SwitchStatement(node) {
const openingCurly = sourceCode.getTokenAfter(node.discriminant, eslint_utils_1.isOpeningBraceToken);
const closingCurly = sourceCode.getLastToken(node);
offsets.setDesiredOffsets([openingCurly.range[1], closingCurly.range[0]], openingCurly, options.SwitchCase);
if (node.cases.length) {
sourceCode
.getTokensBetween(node.cases[node.cases.length - 1], closingCurly, {
includeComments: true,
filter: eslint_utils_1.isCommentToken,
})
.forEach(token => offsets.ignoreToken(token));
}
},
SwitchCase(node) {
ImportDeclaration(node) {
if (node.specifiers.some(specifier => specifier.type === 'ImportSpecifier')) {
const openingCurly = sourceCode.getFirstToken(node, eslint_utils_1.isOpeningBraceToken);
const closingCurly = sourceCode.getLastToken(node, eslint_utils_1.isClosingBraceToken);
addElementListIndent(node.specifiers.filter(specifier => specifier.type === 'ImportSpecifier'), openingCurly, closingCurly, options.ImportDeclaration);
}
const fromToken = sourceCode.getLastToken(node, token => token.type === 'Identifier' && token.value === 'from');
const sourceToken = sourceCode.getLastToken(node, token => token.type === 'String');
const semiToken = sourceCode.getLastToken(node, token => token.type === experimental_utils_1.AST_TOKEN_TYPES.Punctuator && token.value === ';');
if (fromToken) {
const end = semiToken && semiToken.range[1] === sourceToken.range[1]
? node.range[1]
: sourceToken.range[1];
offsets.setDesiredOffsets([fromToken.range[0], end], sourceCode.getFirstToken(node), 1);
}
},
'MemberExpression, JSXMemberExpression, MetaProperty'(node) {