From 611fad275fb7f3c2ec018b5539444b6649285228 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 2 Jul 2020 22:08:33 +0300 Subject: [PATCH] code linting --- editors/code/src/config.ts | 2 +- editors/code/src/run.ts | 2 +- editors/code/tests/unit/runnable_env.test.ts | 60 ++++++++++---------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 3257275c56f..23975c72616 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -5,7 +5,7 @@ export type UpdatesChannel = "stable" | "nightly"; export const NIGHTLY_TAG = "nightly"; -export type RunnableEnvCfg = undefined | Record | { mask?: string, env: Record; }[]; +export type RunnableEnvCfg = undefined | Record | { mask?: string; env: Record }[]; export class Config { readonly extensionId = "matklad.rust-analyzer"; diff --git a/editors/code/src/run.ts b/editors/code/src/run.ts index 4a5c6ad4125..c0995461417 100644 --- a/editors/code/src/run.ts +++ b/editors/code/src/run.ts @@ -111,7 +111,7 @@ export function prepareEnv(runnable: ra.Runnable, runnableEnvCfg: RunnableEnvCfg } } } else { - Object.assign(env, runnableEnvCfg as Record); + Object.assign(env, runnableEnvCfg); } } diff --git a/editors/code/tests/unit/runnable_env.test.ts b/editors/code/tests/unit/runnable_env.test.ts index 979d497dd9b..f2f53e91ad9 100644 --- a/editors/code/tests/unit/runnable_env.test.ts +++ b/editors/code/tests/unit/runnable_env.test.ts @@ -3,7 +3,7 @@ import { prepareEnv } from '../../src/run'; import { RunnableEnvCfg } from '../../src/config'; import * as ra from '../../src/lsp_ext'; -function make_runnable(label: string): ra.Runnable { +function makeRunnable(label: string): ra.Runnable { return { label, kind: "cargo", @@ -11,21 +11,21 @@ function make_runnable(label: string): ra.Runnable { cargoArgs: [], executableArgs: [] } - } + }; } -function fakePrepareEnv(runnable_name: string, config: RunnableEnvCfg) : Record { - const runnable = make_runnable(runnable_name); +function fakePrepareEnv(runnableName: string, config: RunnableEnvCfg): Record { + const runnable = makeRunnable(runnableName); return prepareEnv(runnable, config); } suite('Runnable env', () => { test('Global config works', () => { - const bin_env = fakePrepareEnv("run project_name", {"GLOBAL": "g"}); - assert.equal(bin_env["GLOBAL"], "g"); + const binEnv = fakePrepareEnv("run project_name", { "GLOBAL": "g" }); + assert.equal(binEnv["GLOBAL"], "g"); - const test_env = fakePrepareEnv("test some::mod::test_name", {"GLOBAL": "g"}); - assert.equal(test_env["GLOBAL"], "g"); + const testEnv = fakePrepareEnv("test some::mod::test_name", { "GLOBAL": "g" }); + assert.equal(testEnv["GLOBAL"], "g"); }); test('null mask works', () => { @@ -34,11 +34,11 @@ suite('Runnable env', () => { env: { DATA: "data" } } ]; - const bin_env = fakePrepareEnv("run project_name", config); - assert.equal(bin_env["DATA"], "data"); + const binEnv = fakePrepareEnv("run project_name", config); + assert.equal(binEnv["DATA"], "data"); - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "data"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "data"); }); test('order works', () => { @@ -50,11 +50,11 @@ suite('Runnable env', () => { env: { DATA: "newdata" } } ]; - const bin_env = fakePrepareEnv("run project_name", config); - assert.equal(bin_env["DATA"], "newdata"); + const binEnv = fakePrepareEnv("run project_name", config); + assert.equal(binEnv["DATA"], "newdata"); - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "newdata"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "newdata"); }); test('mask works', () => { @@ -71,14 +71,14 @@ suite('Runnable env', () => { env: { DATA: "special_test" } } ]; - const bin_env = fakePrepareEnv("run project_name", config); - assert.equal(bin_env["DATA"], "rundata"); + const binEnv = fakePrepareEnv("run project_name", config); + assert.equal(binEnv["DATA"], "rundata"); - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "data"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "data"); - const special_test_env = fakePrepareEnv("test some::mod::special_test", config); - assert.equal(special_test_env["DATA"], "special_test"); + const specialTestEnv = fakePrepareEnv("test some::mod::special_test", config); + assert.equal(specialTestEnv["DATA"], "special_test"); }); test('exact test name works', () => { @@ -91,11 +91,11 @@ suite('Runnable env', () => { env: { DATA: "test special" } } ]; - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "test special"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "test special"); - const special_test_env = fakePrepareEnv("test some::mod::another_test", config); - assert.equal(special_test_env["DATA"], "data"); + const specialTestEnv = fakePrepareEnv("test some::mod::another_test", config); + assert.equal(specialTestEnv["DATA"], "data"); }); test('test mod name works', () => { @@ -108,11 +108,11 @@ suite('Runnable env', () => { env: { DATA: "mod special" } } ]; - const test_env = fakePrepareEnv("test some::mod::test_name", config); - assert.equal(test_env["DATA"], "mod special"); + const testEnv = fakePrepareEnv("test some::mod::test_name", config); + assert.equal(testEnv["DATA"], "mod special"); - const special_test_env = fakePrepareEnv("test some::mod::another_test", config); - assert.equal(special_test_env["DATA"], "mod special"); + const specialTestEnv = fakePrepareEnv("test some::mod::another_test", config); + assert.equal(specialTestEnv["DATA"], "mod special"); }); });