mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Enable max-statements-per-line lint rule (#45475)
* Enable the rule * Fix all the violations
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
@@ -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)];
|
||||
|
||||
Reference in New Issue
Block a user