Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ExportNamedDeclaration(node) {
if (node.declaration === null) {
const closingCurly = sourceCode.getLastToken(node, eslint_utils_1.isClosingBraceToken);
// Indent the specifiers in `export {foo, bar, baz}`
addElementListIndent(node.specifiers, sourceCode.getFirstToken(node, { skip: 1 }), closingCurly, 1);
if (node.source) {
// Indent everything after and including the `from` token in `export {foo, bar, baz} from 'qux'`
offsets.setDesiredOffsets([closingCurly.range[1], node.range[1]], sourceCode.getFirstToken(node), 1);
}
}
},
ForStatement(node) {
'ObjectExpression, ObjectPattern'(node) {
const openingCurly = sourceCode.getFirstToken(node);
const closingCurly = sourceCode.getTokenAfter(node.properties.length
? node.properties[node.properties.length - 1]
: openingCurly, eslint_utils_1.isClosingBraceToken);
addElementListIndent(node.properties, openingCurly, closingCurly, options.ObjectExpression);
},
Property(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) {