Apply 'variable-name' tslint rule (#19743)

This commit is contained in:
Andy
2017-11-06 09:23:47 -08:00
committed by GitHub
parent 8d5b0529b2
commit 0a7b7e07ee
36 changed files with 349 additions and 331 deletions

View File

@@ -9,10 +9,12 @@
namespace ts.server {
export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
// tslint:disable variable-name
export const ProjectsUpdatedInBackgroundEvent = "projectsUpdatedInBackground";
export const ConfigFileDiagEvent = "configFileDiag";
export const ProjectLanguageServiceStateEvent = "projectLanguageServiceState";
export const ProjectInfoTelemetryEvent = "projectInfo";
// tslint:enable variable-name
export interface ProjectsUpdatedInBackgroundEvent {
eventName: typeof ProjectsUpdatedInBackgroundEvent;
@@ -1061,7 +1063,7 @@ namespace ts.server {
* Returns true if the configFileExistenceInfo is needed/impacted by open files that are root of inferred project
*/
private configFileExistenceImpactsRootOfInferredProject(configFileExistenceInfo: ConfigFileExistenceInfo) {
return forEachEntry(configFileExistenceInfo.openFilesImpactedByConfigFile, (isRootOfInferredProject, __key) => isRootOfInferredProject);
return forEachEntry(configFileExistenceInfo.openFilesImpactedByConfigFile, (isRootOfInferredProject) => isRootOfInferredProject);
}
private setConfigFileExistenceInfoByClosedConfiguredProject(closedProject: ConfiguredProject) {

View File

@@ -124,7 +124,7 @@ namespace ts.server {
// we want to ensure the value is maintained in the out since the file is
// built using --preseveConstEnum.
export type CommandNames = protocol.CommandTypes;
export const CommandNames = (<any>protocol).CommandTypes;
export const CommandNames = (<any>protocol).CommandTypes; // tslint:disable-line variable-name
export function formatMessage<T extends protocol.Message>(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string {
const verboseLogging = logger.hasLevel(LogLevel.verbose);

View File

@@ -1,6 +1,7 @@
/// <reference path="types.ts" />
namespace ts.server {
// tslint:disable variable-name
export const ActionSet: ActionSet = "action::set";
export const ActionInvalidate: ActionInvalidate = "action::invalidate";
export const EventTypesRegistry: EventTypesRegistry = "event::typesRegistry";

View File

@@ -63,9 +63,9 @@ namespace ts.server.typingsInstaller {
}
}
const TypesRegistryPackageName = "types-registry";
const typesRegistryPackageName = "types-registry";
function getTypesRegistryFileLocation(globalTypingsCacheLocation: string): string {
return combinePaths(normalizeSlashes(globalTypingsCacheLocation), `node_modules/${TypesRegistryPackageName}/index.json`);
return combinePaths(normalizeSlashes(globalTypingsCacheLocation), `node_modules/${typesRegistryPackageName}/index.json`);
}
interface ExecSyncOptions {
@@ -105,16 +105,16 @@ namespace ts.server.typingsInstaller {
try {
if (this.log.isEnabled()) {
this.log.writeLine(`Updating ${TypesRegistryPackageName} npm package...`);
this.log.writeLine(`Updating ${typesRegistryPackageName} npm package...`);
}
this.execSyncAndLog(`${this.npmPath} install --ignore-scripts ${TypesRegistryPackageName}`, { cwd: globalTypingsCacheLocation });
this.execSyncAndLog(`${this.npmPath} install --ignore-scripts ${typesRegistryPackageName}`, { cwd: globalTypingsCacheLocation });
if (this.log.isEnabled()) {
this.log.writeLine(`Updated ${TypesRegistryPackageName} npm package`);
this.log.writeLine(`Updated ${typesRegistryPackageName} npm package`);
}
}
catch (e) {
if (this.log.isEnabled()) {
this.log.writeLine(`Error updating ${TypesRegistryPackageName} package: ${(<Error>e).message}`);
this.log.writeLine(`Error updating ${typesRegistryPackageName} package: ${(<Error>e).message}`);
}
// store error info to report it later when it is known that server is already listening to events from typings installer
this.delayedInitializationError = {
@@ -243,7 +243,7 @@ namespace ts.server.typingsInstaller {
const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, typesMapLocation, npmLocation, /*throttleLimit*/5, log);
installer.listen();
function indent(newline: string, string: string): string {
return `${newline} ` + string.replace(/\r?\n/, `${newline} `);
function indent(newline: string, str: string): string {
return `${newline} ` + str.replace(/\r?\n/, `${newline} `);
}
}

View File

@@ -24,6 +24,7 @@ namespace ts.server {
}
export namespace Msg {
// tslint:disable variable-name
export type Err = "Err";
export const Err: Err = "Err";
export type Info = "Info";
@@ -31,6 +32,7 @@ namespace ts.server {
export type Perf = "Perf";
export const Perf: Perf = "Perf";
export type Types = Err | Info | Perf;
// tslint:enable variable-name
}
function getProjectRootPath(project: Project): Path {
@@ -320,8 +322,8 @@ namespace ts.server {
}
/* @internal */
export function indent(string: string): string {
return "\n " + string;
export function indent(str: string): string {
return "\n " + str;
}
/** Put stringified JSON on the next line, indented. */