style: tslint enforces no debugger statements left behind (#25532)

PR Close #25532
This commit is contained in:
Miško Hevery 2018-08-16 15:55:45 -07:00 committed by Jason Aden
parent 503905c807
commit 116946fb11
8 changed files with 44 additions and 22 deletions

View File

@ -530,7 +530,6 @@ describe('Esm2015ReflectionHost', () => {
const host = new Esm2015ReflectionHost(program.getTypeChecker()); const host = new Esm2015ReflectionHost(program.getTypeChecker());
const classNode = const classNode =
getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration); getDeclaration(program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isClassDeclaration);
debugger;
const members = host.getMembersOfClass(classNode); const members = host.getMembersOfClass(classNode);
const staticMethod = members.find(member => member.name === 'staticMethod') !; const staticMethod = members.find(member => member.name === 'staticMethod') !;

View File

@ -414,7 +414,6 @@ describe('Esm5ReflectionHost', () => {
const host = new Esm5ReflectionHost(program.getTypeChecker()); const host = new Esm5ReflectionHost(program.getTypeChecker());
const classNode = getDeclaration( const classNode = getDeclaration(
program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isVariableDeclaration); program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isVariableDeclaration);
debugger;
const decorators = host.getDecoratorsOfDeclaration(classNode) !; const decorators = host.getDecoratorsOfDeclaration(classNode) !;
expect(decorators).toBeDefined(); expect(decorators).toBeDefined();
@ -584,7 +583,6 @@ describe('Esm5ReflectionHost', () => {
const host = new Esm5ReflectionHost(program.getTypeChecker()); const host = new Esm5ReflectionHost(program.getTypeChecker());
const classNode = getDeclaration( const classNode = getDeclaration(
program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isVariableDeclaration); program, SOME_DIRECTIVE_FILE.name, 'SomeDirective', ts.isVariableDeclaration);
debugger;
const members = host.getMembersOfClass(classNode); const members = host.getMembersOfClass(classNode);
const staticMethod = members.find(member => member.name === 'staticMethod') !; const staticMethod = members.find(member => member.name === 'staticMethod') !;

View File

@ -130,7 +130,6 @@ describe('SelectorScopeRegistry', () => {
registry.registerSelector(ProgramCmp, 'program-cmp'); registry.registerSelector(ProgramCmp, 'program-cmp');
debugger;
const scope = registry.lookupCompilationScope(ProgramCmp) !; const scope = registry.lookupCompilationScope(ProgramCmp) !;
expect(scope).toBeDefined(); expect(scope).toBeDefined();
expect(scope.directives).toBeDefined(); expect(scope.directives).toBeDefined();

View File

@ -60,10 +60,8 @@ export interface Injectable { providedIn?: Type<any>|'root'|null; }
* @Annotation * @Annotation
*/ */
export const Injectable: InjectableDecorator = makeDecorator( export const Injectable: InjectableDecorator = makeDecorator(
'Injectable', undefined, undefined, undefined, (type: Type<any>, meta: Injectable) => { 'Injectable', undefined, undefined, undefined,
debugger; (type: Type<any>, meta: Injectable) => R3_COMPILE_INJECTABLE(type, meta));
return R3_COMPILE_INJECTABLE(type, meta);
});
/** /**
* Type representing injectable service. * Type representing injectable service.

View File

@ -77,6 +77,7 @@ export function assertNgModuleType(
} }
function throwError(msg: string): never { function throwError(msg: string): never {
// tslint:disable-next-line
debugger; // Left intentionally for better debugger experience. debugger; // Left intentionally for better debugger experience.
throw new Error(`ASSERTION ERROR: ${msg}`); throw new Error(`ASSERTION ERROR: ${msg}`);
} }

View File

@ -116,6 +116,7 @@ function _it(
jsmFn: Function, testName: string, testFn: (done?: DoneFn) => any, testTimeout = 0): void { jsmFn: Function, testName: string, testFn: (done?: DoneFn) => any, testTimeout = 0): void {
if (runnerStack.length == 0) { if (runnerStack.length == 0) {
// This left here intentionally, as we should never get here, and it aids debugging. // This left here intentionally, as we should never get here, and it aids debugging.
// tslint:disable-next-line
debugger; debugger;
throw new Error('Empty Stack!'); throw new Error('Empty Stack!');
} }

View File

@ -61,9 +61,6 @@ export class SymbolExtractor {
// Left for easier debugging. // Left for easier debugging.
// console.log('###', ts.SyntaxKind[child.kind], child.getText()); // console.log('###', ts.SyntaxKind[child.kind], child.getText());
} }
if (symbols.length && symbols[symbols.length - 1].name == 'type') {
debugger;
}
} }
visitor(source); visitor(source);
symbols.sort(SymbolExtractor.symbolSort); symbols.sort(SymbolExtractor.symbolSort);

View File

@ -5,27 +5,56 @@
"node_modules/tslint-eslint-rules/dist/rules" "node_modules/tslint-eslint-rules/dist/rules"
], ],
"rules": { "rules": {
"file-header": [true, "Copyright Google Inc\\."], "file-header": [
"no-console": [true, "log"], true,
"Copyright Google Inc\\."
],
"no-console": [
true,
"log"
],
"no-duplicate-imports": true, "no-duplicate-imports": true,
"no-duplicate-variable": true, "no-duplicate-variable": true,
"no-jasmine-focus": true, "no-jasmine-focus": true,
"no-var-keyword": true, "no-var-keyword": true,
"require-internal-with-underscore": true, "require-internal-with-underscore": true,
"rollup-config": true, "rollup-config": true,
"semicolon": [true], "semicolon": [
"variable-name": [true, "ban-keywords"], true
"no-inner-declarations": [true, "function"] ],
"variable-name": [
true,
"ban-keywords"
],
"no-inner-declarations": [
true,
"function"
],
"no-debugger": true
}, },
"jsRules": { "jsRules": {
"file-header": [true, "Copyright Google Inc\\."], "file-header": [
"no-console": [true, "log"], true,
"Copyright Google Inc\\."
],
"no-console": [
true,
"log"
],
"no-duplicate-imports": true, "no-duplicate-imports": true,
"no-duplicate-variable": true, "no-duplicate-variable": true,
"no-jasmine-focus": true, "no-jasmine-focus": true,
"require-internal-with-underscore": true, "require-internal-with-underscore": true,
"semicolon": [true], "semicolon": [
"variable-name": [true, "ban-keywords"], true
"no-inner-declarations": [true, "function"] ],
"variable-name": [
true,
"ban-keywords"
],
"no-inner-declarations": [
true,
"function"
]
} }
} }