Migrate to eslint

This commit is contained in:
Aleksey Kladov
2020-02-17 23:42:25 +01:00
parent 326556b090
commit 07a77ffb35
6 changed files with 902 additions and 81 deletions

View File

@@ -22,7 +22,7 @@ export class Config {
"cargoFeatures",
"cargo-watch",
]
.map(opt => `${Config.rootSection}.${opt}`);
.map(opt => `${Config.rootSection}.${opt}`);
private static readonly extensionVersion: string = (() => {
const packageJsonVersion = vscode
@@ -96,7 +96,7 @@ export class Config {
}
case "darwin": return "ra_lsp_server-mac";
case "win32": return "ra_lsp_server-windows.exe";
case "win32": return "ra_lsp_server-windows.exe";
// Users on these platforms yet need to manually build from sources
case "aix":
@@ -126,7 +126,7 @@ export class Config {
return {
type: BinarySource.Type.GithubRelease,
dir: this.ctx.globalStoragePath,
dir: this.ctx.globalStoragePath,
file: prebuiltBinaryName,
storage: this.ctx.globalState,
version: Config.extensionVersion,
@@ -140,30 +140,30 @@ export class Config {
// We don't do runtime config validation here for simplicity. More on stackoverflow:
// https://stackoverflow.com/questions/60135780/what-is-the-best-way-to-type-check-the-configuration-for-vscode-extension
get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
get highlightingOn() { return this.cfg.get("highlightingOn") as boolean; }
get rainbowHighlightingOn() { return this.cfg.get("rainbowHighlightingOn") as boolean; }
get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; }
get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; }
get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; }
get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; }
get lruCapacity() { return this.cfg.get("lruCapacity") as null | number; }
get displayInlayHints() { return this.cfg.get("displayInlayHints") as boolean; }
get maxInlayHintLength() { return this.cfg.get("maxInlayHintLength") as number; }
get excludeGlobs() { return this.cfg.get("excludeGlobs") as string[]; }
get useClientWatching() { return this.cfg.get("useClientWatching") as boolean; }
get featureFlags() { return this.cfg.get("featureFlags") as Record<string, boolean>; }
get rustfmtArgs() { return this.cfg.get("rustfmtArgs") as string[]; }
get cargoWatchOptions(): CargoWatchOptions {
return {
enable: this.cfg.get("cargo-watch.enable") as boolean,
arguments: this.cfg.get("cargo-watch.arguments") as string[],
enable: this.cfg.get("cargo-watch.enable") as boolean,
arguments: this.cfg.get("cargo-watch.arguments") as string[],
allTargets: this.cfg.get("cargo-watch.allTargets") as boolean,
command: this.cfg.get("cargo-watch.command") as string,
command: this.cfg.get("cargo-watch.command") as string,
};
}
get cargoFeatures(): CargoFeatures {
return {
noDefaultFeatures: this.cfg.get("cargoFeatures.noDefaultFeatures") as boolean,
allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean,
features: this.cfg.get("cargoFeatures.features") as string[],
allFeatures: this.cfg.get("cargoFeatures.allFeatures") as boolean,
features: this.cfg.get("cargoFeatures.features") as string[],
};
}

View File

@@ -14,7 +14,7 @@ export async function fetchArtifactReleaseInfo(
): Promise<null | ArtifactReleaseInfo> {
const repoOwner = encodeURIComponent(repo.owner);
const repoName = encodeURIComponent(repo.name);
const repoName = encodeURIComponent(repo.name);
const apiEndpointPath = releaseTag
? `/repos/${repoOwner}/${repoName}/releases/tags/${releaseTag}`
@@ -28,8 +28,8 @@ export async function fetchArtifactReleaseInfo(
// FIXME: handle non-ok response
const response: GithubRelease = await fetch(requestUrl, {
headers: { Accept: "application/vnd.github.v3+json" }
})
headers: { Accept: "application/vnd.github.v3+json" }
})
.then(res => res.json());
const artifact = response.assets.find(artifact => artifact.name === artifactFileName);