Enable max-statements-per-line lint rule (#45475)

* Enable the rule

* Fix all the violations
This commit is contained in:
Ryan Cavanaugh
2021-08-16 13:53:51 -07:00
committed by GitHub
parent 339ad92b98
commit e00b5ecd40
37 changed files with 215 additions and 109 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ namespace ts.codefix {
getCodeActions(context) {
const { sourceFile } = context;
const info = getInfo(sourceFile, context.span.start, context.errorCode);
if (!info) { return undefined; }
if (!info) return undefined;
const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, info));
+3 -1
View File
@@ -53,7 +53,9 @@ namespace ts.codefix {
const token = getTokenAtPosition(sourceFile, start);
let declaration: Declaration | undefined;
const changes = textChanges.ChangeTracker.with(context, changes => { declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken, /*markSeen*/ returnTrue, host, preferences); });
const changes = textChanges.ChangeTracker.with(context, changes => {
declaration = doChange(changes, sourceFile, token, errorCode, program, cancellationToken, /*markSeen*/ returnTrue, host, preferences);
});
const name = declaration && getNameOfDeclaration(declaration);
return !name || changes.length === 0 ? undefined
: [createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), name.getText(sourceFile)], fixId, Diagnostics.Infer_all_types_from_usage)];