Skip to content

Commit

Permalink
Fix all lints
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Feb 27, 2023
1 parent 1df2cea commit 981991e
Show file tree
Hide file tree
Showing 66 changed files with 237 additions and 246 deletions.
4 changes: 2 additions & 2 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3306,7 +3306,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
}
else if (hasDynamicName(node)) {
bindAnonymousDeclaration(node, SymbolFlags.Property | SymbolFlags.Assignment, InternalSymbolName.Computed);
const sym = bindPotentiallyMissingNamespaces(parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), /*isPrototype*/ false, /*containerIsClass*/ false);
const sym = bindPotentiallyMissingNamespaces(parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), /*isPrototypeProperty*/ false, /*containerIsClass*/ false);
addLateBoundAssignmentDeclarationToSymbol(node, sym);
}
else {
Expand Down Expand Up @@ -3477,7 +3477,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
function bindCallExpression(node: CallExpression) {
// We're only inspecting call expressions to detect CommonJS modules, so we can skip
// this check if we've already seen the module indicator
if (!file.commonJsModuleIndicator && isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ false)) {
if (!file.commonJsModuleIndicator && isRequireCall(node, /*requireStringLiteralLikeArgument*/ false)) {
setCommonJsModuleIndicator(node);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ export function createBuilderProgram(kind: BuilderProgramKind, { newProgram, hos
}
else {
// When whole program is affected, get all semantic diagnostics (eg when --out or --outFile is specified)
result = state.program.getSemanticDiagnostics(/*targetSourceFile*/ undefined, cancellationToken);
result = state.program.getSemanticDiagnostics(/*sourceFile*/ undefined, cancellationToken);
state.changedFilesSet.clear();
state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/builderState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ export namespace BuilderState {
), sourceFiles!);
},
cancellationToken,
/*emitOnlyDtsFiles*/ true,
/*emitOnly*/ true,
/*customTransformers*/ undefined,
/*forceDtsEmit*/ true
);
Expand Down
128 changes: 64 additions & 64 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,7 @@ export function convertToObjectWorker(
else {
return validateValue(convertObjectLiteralExpressionToJson(
objectLiteralExpression, /* knownOptions*/ undefined,
/*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined));
/*extraKeyDiagnostics*/ undefined, /*parentOption*/ undefined));
}

case SyntaxKind.ArrayLiteralExpression:
Expand Down
16 changes: 8 additions & 8 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ function emitUsingBuildInfoWorker(
declarationMapText,
buildInfoPath,
buildInfo,
/*onlyOwnText*/ true
/*oldFileOfCurrentEmit*/ true
);
const outputFiles: OutputFile[] = [];
const prependNodes = createPrependNodes(config.projectReferences, getCommandLine, f => host.readFile(f), host);
Expand Down Expand Up @@ -1478,12 +1478,12 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
}

function printBundle(bundle: Bundle): string {
writeBundle(bundle, beginPrint(), /*sourceMapEmitter*/ undefined);
writeBundle(bundle, beginPrint(), /*sourceMapGenerator*/ undefined);
return endPrint();
}

function printFile(sourceFile: SourceFile): string {
writeFile(sourceFile, beginPrint(), /*sourceMapEmitter*/ undefined);
writeFile(sourceFile, beginPrint(), /*sourceMapGenerator*/ undefined);
return endPrint();
}

Expand Down Expand Up @@ -3121,7 +3121,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
function emitParenthesizedExpression(node: ParenthesizedExpression) {
const openParenPos = emitTokenWithComment(SyntaxKind.OpenParenToken, node.pos, writePunctuation, node);
const indented = writeLineSeparatorsAndIndentBefore(node.expression, node);
emitExpression(node.expression, /*parenthesizerRules*/ undefined);
emitExpression(node.expression, /*parenthesizerRule*/ undefined);
writeLineSeparatorsAfter(node.expression, node);
decreaseIndentIf(indented);
emitTokenWithComment(SyntaxKind.CloseParenToken, node.expression ? node.expression.end : openParenPos, writePunctuation, node);
Expand Down Expand Up @@ -3353,7 +3353,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
}

function emitAsExpression(node: AsExpression) {
emitExpression(node.expression, /*parenthesizerRules*/ undefined);
emitExpression(node.expression, /*parenthesizerRule*/ undefined);
if (node.type) {
writeSpace();
writeKeyword("as");
Expand All @@ -3368,7 +3368,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
}

function emitSatisfiesExpression(node: SatisfiesExpression) {
emitExpression(node.expression, /*parenthesizerRules*/ undefined);
emitExpression(node.expression, /*parenthesizerRule*/ undefined);
if (node.type) {
writeSpace();
writeKeyword("satisfies");
Expand Down Expand Up @@ -6012,9 +6012,9 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
case SyntaxKind.SetAccessor:
return generateNameForMethodOrAccessor(node as MethodDeclaration | AccessorDeclaration, privateName, prefix, suffix);
case SyntaxKind.ComputedPropertyName:
return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ true, privateName, prefix, suffix);
return makeTempVariableName(TempFlags.Auto, /*reservedInNestedScopes*/ true, privateName, prefix, suffix);
default:
return makeTempVariableName(TempFlags.Auto, /*reserveInNestedScopes*/ false, privateName, prefix, suffix);
return makeTempVariableName(TempFlags.Auto, /*reservedInNestedScopes*/ false, privateName, prefix, suffix);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/factory/parenthesizerRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRul
const check = skipPartiallyEmittedExpressions(expression);
let needsParens = isCommaSequence(check);
if (!needsParens) {
switch (getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) {
switch (getLeftmostExpression(check, /*stopAtCallExpressions*/ false).kind) {
case SyntaxKind.ClassExpression:
case SyntaxKind.FunctionExpression:
needsParens = true;
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/factory/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1670,7 +1670,7 @@ export function createAccessorPropertySetRedirector(factory: NodeFactory, node:
name,
[factory.createParameterDeclaration(
/*modifiers*/ undefined,
/*dotdotDotToken*/ undefined,
/*dotDotDotToken*/ undefined,
"value"
)],
factory.createBlock([
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/moduleNameResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ function tryResolveJSModuleWorker(moduleName: string, initialDir: string, host:
/*cache*/ undefined,
Extensions.JavaScript,
/*isConfigLookup*/ false,
/*redirectedReferences*/ undefined);
/*redirectedReference*/ undefined);
}

export function bundlerModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations {
Expand Down Expand Up @@ -2139,7 +2139,7 @@ function loadEntrypointsFromExportMap(
}
const resolvedTarget = combinePaths(scope.packageDirectory, target);
const finalPath = getNormalizedAbsolutePath(resolvedTarget, state.host.getCurrentDirectory?.());
const result = loadFileNameFromPackageJsonField(extensions, finalPath, /*recordOnlyFailures*/ false, state);
const result = loadFileNameFromPackageJsonField(extensions, finalPath, /*onlyRecordFailures*/ false, state);
if (result) {
entrypoints = appendIfUnique(entrypoints, result, (a, b) => a.path === b.path);
return true;
Expand Down
14 changes: 7 additions & 7 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ namespace Parser {

export function parseIsolatedEntityName(content: string, languageVersion: ScriptTarget): EntityName | undefined {
// Choice of `isDeclarationFile` should be arbitrary
initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, ScriptKind.JS);
initializeState("", content, languageVersion, /*_syntaxCursor*/ undefined, ScriptKind.JS);
// Prime the scanner.
nextToken();
const entityName = parseEntityName(/*allowReservedWords*/ true);
Expand Down Expand Up @@ -1668,7 +1668,7 @@ namespace Parser {
}

// Set source file so that errors will be reported with this file name
const sourceFile = createSourceFile(fileName, ScriptTarget.ES2015, ScriptKind.JSON, /*isDeclaration*/ false, statements, endOfFileToken, sourceFlags, noop);
const sourceFile = createSourceFile(fileName, ScriptTarget.ES2015, ScriptKind.JSON, /*isDeclarationFile*/ false, statements, endOfFileToken, sourceFlags, noop);

if (setParentNodes) {
fixupParentReferences(sourceFile);
Expand Down Expand Up @@ -6073,7 +6073,7 @@ namespace Parser {
}
else {
parseExpected(SyntaxKind.SlashToken);
if (parseExpected(SyntaxKind.GreaterThanToken, /*diagnostic*/ undefined, /*shouldAdvance*/ false)) {
if (parseExpected(SyntaxKind.GreaterThanToken, /*diagnosticMessage*/ undefined, /*shouldAdvance*/ false)) {
// manually advance the scanner in order to look for jsx text inside jsx
if (inExpressionContext) {
nextToken();
Expand Down Expand Up @@ -6123,7 +6123,7 @@ namespace Parser {
parseExpected(SyntaxKind.CloseBraceToken);
}
else {
if (parseExpected(SyntaxKind.CloseBraceToken, /*message*/ undefined, /*shouldAdvance*/ false)) {
if (parseExpected(SyntaxKind.CloseBraceToken, /*diagnosticMessage*/ undefined, /*shouldAdvance*/ false)) {
scanJsxText();
}
}
Expand Down Expand Up @@ -6170,7 +6170,7 @@ namespace Parser {
const pos = getNodePos();
parseExpected(SyntaxKind.LessThanSlashToken);
const tagName = parseJsxElementName();
if (parseExpected(SyntaxKind.GreaterThanToken, /*diagnostic*/ undefined, /*shouldAdvance*/ false)) {
if (parseExpected(SyntaxKind.GreaterThanToken, /*diagnosticMessage*/ undefined, /*shouldAdvance*/ false)) {
// manually advance the scanner in order to look for jsx text inside jsx
if (inExpressionContext || !tagNamesAreEquivalent(open.tagName, tagName)) {
nextToken();
Expand Down Expand Up @@ -8461,7 +8461,7 @@ namespace Parser {

export namespace JSDocParser {
export function parseJSDocTypeExpressionForTests(content: string, start: number | undefined, length: number | undefined): { jsDocTypeExpression: JSDocTypeExpression, diagnostics: Diagnostic[] } | undefined {
initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS);
initializeState("file.js", content, ScriptTarget.Latest, /*_syntaxCursor*/ undefined, ScriptKind.JS);
scanner.setText(content, start, length);
currentToken = scanner.scan();
const jsDocTypeExpression = parseJSDocTypeExpression();
Expand Down Expand Up @@ -8511,7 +8511,7 @@ namespace Parser {
}

export function parseIsolatedJSDocComment(content: string, start: number | undefined, length: number | undefined): { jsDoc: JSDoc, diagnostics: Diagnostic[] } | undefined {
initializeState("", content, ScriptTarget.Latest, /*_syntaxCursor:*/ undefined, ScriptKind.JS);
initializeState("", content, ScriptTarget.Latest, /*_syntaxCursor*/ undefined, ScriptKind.JS);
const jsDoc = doInsideOfContext(NodeFlags.JSDoc, () => parseJSDocCommentWorker(start, length));

const sourceFile = { languageVariant: LanguageVariant.Standard, text: content } as SourceFile;
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
if (structureIsReused === StructureIsReused.Not) {
// If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules,
// the best we can do is fallback to the default logic.
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, /*resuedNames*/ undefined);
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, /*reusedNames*/ undefined);
}

const oldSourceFile = !isString(containingFile) ? oldProgram && oldProgram.getSourceFile(containingFile.fileName) : undefined;
Expand Down Expand Up @@ -2534,7 +2534,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
getEmitHost(writeFileCallback),
/*targetSourceFile*/ undefined,
/*transformers*/ noTransformers,
/*emitOnlyDtsFiles*/ false,
/*emitOnly*/ false,
/*onlyBuildInfo*/ true
);

Expand Down Expand Up @@ -3269,7 +3269,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
const r = /import|require/g;
while (r.exec(file.text) !== null) { // eslint-disable-line no-null/no-null
const node = getNodeAtPosition(file, r.lastIndex);
if (shouldProcessRequires && isRequireCall(node, /*checkArgumentIsStringLiteralLike*/ true)) {
if (shouldProcessRequires && isRequireCall(node, /*requireStringLiteralLikeArgument*/ true)) {
setParentRecursive(node, /*incremental*/ false); // we need parent data on imports before the program is fully bound, so we ensure it's set here
imports = append(imports, node.arguments[0]);
}
Expand Down Expand Up @@ -3954,7 +3954,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
if (host.getParsedCommandLine) {
commandLine = host.getParsedCommandLine(refPath);
if (!commandLine) {
addFileToFilesByName(/*sourceFile*/ undefined, sourceFilePath, /*redirectedPath*/ undefined);
addFileToFilesByName(/*file*/ undefined, sourceFilePath, /*redirectedPath*/ undefined);
projectReferenceRedirects.set(sourceFilePath, false);
return undefined;
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/resolutionCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ export function createResolutionCache(resolutionHost: ResolutionCacheHost, rootD
resolutions.forEach(watchFailedLookupLocationOfResolution);
}
else {
resolutions.forEach(resolution => watchAffectingLocationsOfResolution(resolution, /*addToResolutionWithOnlyAffectingLocations*/ true));
resolutions.forEach(resolution => watchAffectingLocationsOfResolution(resolution, /*addToResolutionsWithOnlyAffectingLocations*/ true));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/compiler/transformers/classFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ export function transformClassFields(context: TransformationContext): (x: Source
function visitExpressionWithTypeArgumentsInHeritageClause(node: ExpressionWithTypeArguments) {
const facts = lexicalEnvironment?.data?.facts || ClassFacts.None;
if (facts & ClassFacts.NeedsClassSuperReference) {
const temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true);
const temp = factory.createTempVariable(hoistVariableDeclaration, /*reservedInNestedScopes*/ true);
getClassLexicalEnvironment().superClassReference = temp;
return factory.updateExpressionWithTypeArguments(
node,
Expand Down Expand Up @@ -2857,7 +2857,7 @@ export function transformClassFields(context: TransformationContext): (x: Source
const identifier =
typeof name === "object" ? factory.getGeneratedNameForNode(name, GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.ReservedInNestedScopes, prefix, suffix) :
typeof name === "string" ? factory.createUniqueName(name, GeneratedIdentifierFlags.Optimistic, prefix, suffix) :
factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix);
factory.createTempVariable(/*recordTempVariable*/ undefined, /*reservedInNestedScopes*/ true, prefix, suffix);

if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.BlockScopedBindingInLoop) {
addBlockScopedVariable(identifier);
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/transformers/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ export function transformDeclarations(context: TransformationContext) {

function trackSymbol(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags) {
if (symbol.flags & SymbolFlags.TypeParameter) return false;
const issuedDiagnostic = handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasesToMakeVisible*/ true));
const issuedDiagnostic = handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning, /*shouldComputeAliasToMarkVisible*/ true));
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
return issuedDiagnostic;
}
Expand Down Expand Up @@ -1126,7 +1126,7 @@ export function transformDeclarations(context: TransformationContext) {
if (isMethodDeclaration(input) || isMethodSignature(input)) {
if (hasEffectiveModifier(input, ModifierFlags.Private)) {
if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) return; // Elide all but the first overload
return cleanup(factory.createPropertyDeclaration(ensureModifiers(input), input.name, /*questionToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined));
return cleanup(factory.createPropertyDeclaration(ensureModifiers(input), input.name, /*questionOrExclamationToken*/ undefined, /*type*/ undefined, /*initializer*/ undefined));
}
}

Expand Down Expand Up @@ -1648,7 +1648,7 @@ export function transformDeclarations(context: TransformationContext) {
elems.push(factory.createPropertyDeclaration(
ensureModifiers(param),
elem.name as Identifier,
/*questionToken*/ undefined,
/*questionOrExclamationToken*/ undefined,
ensureType(elem, /*type*/ undefined),
/*initializer*/ undefined
));
Expand All @@ -1666,7 +1666,7 @@ export function transformDeclarations(context: TransformationContext) {
factory.createPropertyDeclaration(
/*modifiers*/ undefined,
factory.createPrivateIdentifier("#private"),
/*questionToken*/ undefined,
/*questionOrExclamationToken*/ undefined,
/*type*/ undefined,
/*initializer*/ undefined
)
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/transformers/es2015.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@ export function transformES2015(context: TransformationContext): (x: SourceFile
visitor,
context,
FlattenLevel.All,
/*value*/ undefined,
/*rval*/ undefined,
(ancestorFacts & HierarchyFacts.ExportedVariableStatement) !== 0
);
}
Expand Down
Loading

0 comments on commit 981991e

Please sign in to comment.