Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case ts.SyntaxKind.VariableStatement:
case ts.SyntaxKind.TypeAliasDeclaration:
case ts.SyntaxKind.FunctionDeclaration:
case ts.SyntaxKind.ModuleDeclaration:
stop = visitor(node);
}
// if (node.kind !== ts.SyntaxKind.SourceFile) {
// if (getNodeText(sourceFile, node).indexOf('SymbolKind') >= 0) {
// console.log('FOUND TEXT IN NODE: ' + ts.SyntaxKind[node.kind]);
// console.log(getNodeText(sourceFile, node));
// }
// }
if (stop) {
return;
}
ts.forEachChild(node, visit);
};
visit(sourceFile);
if (isFunctionScopeBoundary(node)) {
// tslint:enable:deprecation
const old = complexity;
complexity = 1;
ts.forEachChild(node, cb);
if (complexity > threshold) {
const { name } = node as ts.FunctionLikeDeclaration;
const nameStr = name !== undefined && isIdentifier(name) ? name.text : undefined;
ctx.addFailureAtNode(node, Rule.FAILURE_STRING(threshold, complexity, nameStr));
}
complexity = old;
} else {
if (increasesComplexity(node)) {
complexity++;
}
return ts.forEachChild(node, cb);
}
});
}
const literalString = getNumericLiteral(node) || getStringLiteral(node);
// In case the attribute has no value of empty value.
if (literalString === '') {
ctx.addFailureAt(node.getStart(), node.getWidth(), getFailureString());
} else if (literalString && literalString !== '-1' && literalString !== '0') {
ctx.addFailureAt(node.getStart(), node.getWidth(), getFailureString());
} else if (isEmpty(node)) {
ctx.addFailureAt(node.getStart(), node.getWidth(), getFailureString());
}
}
return ts.forEachChild(node, cb);
}
return ts.forEachChild(ctx.sourceFile, cb);
}
function walk(context) {
return ts.forEachChild(context.sourceFile, cb);
function cb(node) {
switch (node.kind) {
case ts.SyntaxKind.ClassDeclaration:
checkNode(node, exports.ARGUMENT_CLASSES);
break;
case ts.SyntaxKind.EnumDeclaration:
checkNode(node, exports.ARGUMENT_ENUMS);
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
// Enum members don't have modifiers, so use the parent
// enum declaration when checking the requirements.
checkNode(member, exports.ARGUMENT_ENUM_MEMBERS, node);
}
break;
case ts.SyntaxKind.FunctionDeclaration:
checkNode(node, exports.ARGUMENT_FUNCTIONS);
function visit(node) {
switch (node.kind) {
case ts.SyntaxKind.FunctionDeclaration:
me.addDocCommentFromNode(node);
break;
}
ts.forEachChild(node, visit);
}
};
function walk(ctx) {
function cb(node) {
if (tsutils.isInterfaceDeclaration(node) && isInterfaceEmpty(node) && !hasMultipleParents(node)) {
ctx.addFailureAt(node.getStart(), node.getWidth(), Rule.FAILURE_STRING + "'" + node.name.getText() + "'");
}
return ts.forEachChild(node, cb);
}
return ts.forEachChild(ctx.sourceFile, cb);
function isInterfaceEmpty(node) {
return node.members === undefined || node.members.length === 0;
}
function hasMultipleParents(node) {
if (node.heritageClauses === undefined || node.heritageClauses.length === 0) {
return false;
}
return node.heritageClauses[0].types.length >= 2;
}
}
//# sourceMappingURL=noEmptyInterfacesRule.js.map
function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (node.kind === ts.SyntaxKind.BinaryExpression) {
switch (node.operatorToken.kind) {
case ts.SyntaxKind.AmpersandToken:
case ts.SyntaxKind.AmpersandEqualsToken:
case ts.SyntaxKind.BarToken:
case ts.SyntaxKind.BarEqualsToken:
case ts.SyntaxKind.CaretToken:
case ts.SyntaxKind.CaretEqualsToken:
case ts.SyntaxKind.LessThanLessThanToken:
case ts.SyntaxKind.LessThanLessThanEqualsToken:
case ts.SyntaxKind.GreaterThanGreaterThanToken:
case ts.SyntaxKind.GreaterThanGreaterThanEqualsToken:
case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken:
case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken:
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
function walk(ctx) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (node.kind === ts.SyntaxKind.NonNullExpression) {
ctx.addFailureAtNode(node, Rule.FAILURE_STRING);
}
return ts.forEachChild(node, cb);
});
}
var templateObject_1;
for (const declaration of vd.declarations) {
if (!declaration.initializer) {
changes.push({ text: '(', start: declaration.pos, end: declaration.pos });
changes.push({ text: '=undefined)', start: declaration.end, end: declaration.end });
continue;
}
changes.push({ text: '(', start: declaration.pos, end: declaration.pos });
changes.push({ text: ')', start: declaration.end, end: declaration.end });
}
if (!onlyOneDeclaration) {
const last = vd.declarations[vd.declarations.length - 1];
changes.push({ text: ')', start: last.end, end: last.end });
}
break;
}
ts.forEachChild(node, traverse);
}
traverse(body);
function cb(node) {
if (tsutils.isJsxElement(node)) {
checkJsxElement(node.openingElement);
}
else if (tsutils.isJsxSelfClosingElement(node)) {
checkJsxElement(node);
}
return ts.forEachChild(node, cb);
}
return ts.forEachChild(ctx.sourceFile, cb);