Fix lint/style issues

[?]
Dec 23, 2020, 10:23 PM
4PN3R2LY3SJGMP2HFAR7MBSFWOG633FSN2FEIQEZREDZVI4JB76QC

Dependencies

  • [2] TKKT6D4C Add failure loop to installation selection
  • [3] WW67NYZV Configure eslint for JS standard formatting
  • [4] 3N3RS66T Create pijul output channel and configure activation events
  • [5] NCBEWRYE Initialize Repository
  • [6] WHFIIX4Y Improve documentation and add Pijul installation configuration

Change contents

  • replacement in src/extension.ts at line 2
    [3.106975][3.0:37](),[3.37][3.19657:19691](),[3.106975][3.19657:19691]()
    import * as cp from "child_process";
    import * as vscode from "vscode";
    [3.106975]
    [3.38]
    import * as cp from 'child_process';
    import * as vscode from 'vscode';
  • replacement in src/extension.ts at line 6
    [2.26][2.26:61]()
    path: string;
    version: string;
    [2.26]
    [2.61]
    path: string
    version: string
  • edit in src/extension.ts at line 10
    [3.210]
    [2.64]
    // TODO: Add lint rule to require function documentation
  • replacement in src/extension.ts at line 12
    [2.224][3.210:225](),[3.210][3.210:225]()
    if (!path) {
    [2.224]
    [3.225]
    if (path == null) {
  • replacement in src/extension.ts at line 14
    [3.305][3.305:482]()
    if (!config.get<boolean>("ignoreMissingInstallation")) {
    const selectInstallation = "Select a Pijul Executable";
    const ignore = "Don't Show this Warning Again";
    [3.305]
    [3.482]
    if (!(config.get<boolean>('ignoreMissingInstallation') ?? false)) {
    const selectInstallation = 'Select a Pijul Executable';
    const ignore = 'Don\'t Show this Warning Again';
  • replacement in src/extension.ts at line 18
    [3.543][3.543:663]()
    "No Pijul installation has been configured for use with the extension. Select one to enable Pijul integration",
    [3.543]
    [3.663]
    'No Pijul installation has been configured for use with the extension. Select one to enable Pijul integration',
  • replacement in src/extension.ts at line 26
    [3.827][3.827:871]()
    if (process.platform === "win32") {
    [3.827]
    [3.871]
    if (process.platform === 'win32') {
  • replacement in src/extension.ts at line 28
    [3.897][3.897:929]()
    svn: ["exe", "bat"]
    [3.897]
    [3.929]
    svn: ['exe', 'bat']
  • replacement in src/extension.ts at line 40
    [3.1224][3.1224:1281]()
    if (pijulInstallation && pijulInstallation[0]) {
    [3.1224]
    [3.1281]
    if (pijulInstallation?.[0] != null) {
  • replacement in src/extension.ts at line 42
    [3.1336][3.1336:1396]()
    await config.update("installationPath", exePath);
    [3.1336]
    [3.1396]
    await config.update('installationPath', exePath);
  • replacement in src/extension.ts at line 44
    [3.1422][3.1422:1533]()
    outputChannel.appendLine("Updated extension configuration to use Pijul installation at " + exePath);
    [3.1422]
    [3.1533]
    outputChannel.appendLine('Updated extension configuration to use Pijul installation at ' + exePath);
  • replacement in src/extension.ts at line 47
    [3.1622][2.225:312]()
    return Promise.reject(new Error("No executable selected in file dialogue"));
    [3.1622]
    [3.1640]
    return await Promise.reject(new Error('No executable selected in file dialogue'));
  • replacement in src/extension.ts at line 50
    [3.1665][2.313:429]()
    await config.update("ignoreMissingInstallation", true);
    return Promise.reject(new Error("Ignore"));
    [3.1665]
    [3.1739]
    await config.update('ignoreMissingInstallation', true);
    return await Promise.reject(new Error('Ignore'));
  • replacement in src/extension.ts at line 55
    [3.1812][2.430:480]()
    return Promise.reject(new Error("Ignore"));
    [3.1812]
    [3.1826]
    return await Promise.reject(new Error('Ignore'));
  • replacement in src/extension.ts at line 59
    [3.1837][2.481:641]()
    return new Promise<IPijul>((resolve, reject) => {
    const pathDefined = path || "pijul";
    const child = cp.spawn(pathDefined || "pijul", ["--version"]);
    [3.1837]
    [2.641]
    return await new Promise<IPijul>((resolve, reject) => {
    const pathDefined = path ?? 'pijul';
    const child = cp.spawn(pathDefined, ['--version']);
  • replacement in src/extension.ts at line 63
    [2.675][2.675:935]()
    child.stdout.on("data", (b: Buffer) => buffers.push(b));
    child.on("error", () => reject(new Error("Error checking version at " + path)));
    child.on("close", code => {
    if (code) {
    reject(new Error("Error checking version at " + path));
    [2.675]
    [2.935]
    child.stdout.on('data', (b: Buffer) => buffers.push(b));
    child.on('error', () => reject(new Error(`Error checking version at ${pathDefined}`)));
    child.on('close', code => {
    const tokens = Buffer.concat(buffers).toString('utf8').trim().split(' ');
    if (code != null || tokens[0] !== 'pijul') {
    reject(new Error(`Error checking version at ${pathDefined}`));
  • replacement in src/extension.ts at line 73
    [2.950][2.950:1061]()
    resolve({ path: pathDefined, version: Buffer.concat(buffers).toString("utf8").trim().split(" ")[1] });
    [2.950]
    [2.1061]
    resolve({ path: pathDefined, version: tokens[1] });
  • replacement in src/extension.ts at line 86
    [3.19983][3.2150:2286](),[3.2286][3.20079:20248](),[3.20079][3.20079:20248]()
    async function _activate (_context: vscode.ExtensionContext, config: vscode.WorkspaceConfiguration, disposables: vscode.Disposable[]) {
    vscode.window.showInformationMessage("Pijul repository detected in workspace, extension has been activated.");
    console.debug("Pijul VS Code Integration Activated");
    [3.19983]
    [3.260]
    async function _activate (_context: vscode.ExtensionContext, config: vscode.WorkspaceConfiguration, disposables: vscode.Disposable[]): Promise<void> {
    await vscode.window.showInformationMessage('Pijul repository detected in workspace, extension has been activated.');
    console.debug('Pijul VS Code Integration Activated');
  • replacement in src/extension.ts at line 90
    [3.261][3.20249:20317]()
    const outputChannel = vscode.window.createOutputChannel("Pijul");
    [3.261]
    [3.20317]
    const outputChannel = vscode.window.createOutputChannel('Pijul');
  • replacement in src/extension.ts at line 92
    [3.20352][3.20352:20453]()
    disposables.push(vscode.commands.registerCommand("pijul.showOutput", () => outputChannel.show()));
    [3.20352]
    [3.107539]
    disposables.push(vscode.commands.registerCommand('pijul.showOutput', () => outputChannel.show()));
  • replacement in src/extension.ts at line 94
    [3.107540][2.1084:1151]()
    const installationPath = config.get<string>("installationPath");
    [3.107540]
    [2.1151]
    const installationPath = config.get<string>('installationPath');
  • replacement in src/extension.ts at line 98
    [2.1242][2.1242:1255]()
    let pijul;
    [2.1242]
    [2.1255]
    let pijulInfo;
  • replacement in src/extension.ts at line 101
    [2.1301][2.1301:1475]()
    pijul = await checkPijulInstallation(installationPath, config, outputChannel);
    outputChannel.appendLine(`Using Pijul ${pijul.version} located at ${pijul.path}`);
    [2.1301]
    [2.1475]
    pijulInfo = await checkPijulInstallation(installationPath, config, outputChannel);
    outputChannel.appendLine(`Using Pijul ${pijulInfo.version} at ${pijulInfo.path}`);
  • replacement in src/extension.ts at line 105
    [2.1532][2.1532:1879]()
    if (err.message === "Ignore") {
    // Complete activation without finding the installation
    identifiedInstallation = true;
    return;
    } else {
    // Reset the configuration and try again
    vscode.window.showErrorMessage(`Failed to find pijul installation at ${err.message.split(" ").pop()}, resetting...`);
    [2.1532]
    [2.1879]
    if (err instanceof Error) {
    if (err.message === 'Ignore') {
    // Complete activation without finding the installation
    identifiedInstallation = true;
    return;
    } else {
    // Let the user know that the executable didn't work and try again
    await vscode.window.showErrorMessage(`Failed to find pijul installation at ${err.message?.split(' ')?.pop() ?? ''}, resetting...`);
    }
  • edit in src/extension.ts at line 116
    [2.1893]
    [2.1893]
    }
    if (pijulInfo != null) {
    // const pijul = new Pijul(pijulInfo);
  • replacement in src/extension.ts at line 139
    [3.21077][3.21077:21145]()
    export async function activate (context: vscode.ExtensionContext) {
    [3.21077]
    [3.21145]
    export async function activate (context: vscode.ExtensionContext): Promise<void> {
  • replacement in src/extension.ts at line 149
    [3.21484][3.2343:2454]()
    const config = vscode.workspace.getConfiguration("pijul");
    const enabled = config.get<boolean>("enabled");
    [3.21484]
    [3.2454]
    const config = vscode.workspace.getConfiguration('pijul');
    const enabled = config.get<boolean>('enabled');
  • replacement in src/extension.ts at line 152
    [3.2455][3.2455:2472]()
    if (enabled) {
    [3.2455]
    [3.2472]
    if (enabled ?? false) {
  • replacement in src/extension.ts at line 163
    [3.21678][3.21678:21712]()
    export function deactivate () { }
    [3.21678]
    export function deactivate (): void { }
  • replacement in src/test/suite/index.ts at line 1
    [3.105009][3.17829:17921]()
    import * as glob from "glob";
    import * as Mocha from "mocha";
    import * as path from "path";
    [3.105009]
    [3.105102]
    import * as glob from 'glob';
    import * as Mocha from 'mocha';
    import * as path from 'path';
  • replacement in src/test/suite/index.ts at line 5
    [3.105103][3.17922:17962]()
    export function run (): Promise<void> {
    [3.105103]
    [3.17962]
    export async function run (): Promise<void> {
  • replacement in src/test/suite/index.ts at line 8
    [3.18017][3.18017:18032]()
    ui: "tdd",
    [3.18017]
    [3.18032]
    ui: 'tdd',
  • replacement in src/test/suite/index.ts at line 12
    [3.105228][3.18055:18106]()
    const testsRoot = path.resolve(__dirname, "..");
    [3.105228]
    [3.105278]
    const testsRoot = path.resolve(__dirname, '..');
  • replacement in src/test/suite/index.ts at line 14
    [3.105279][3.18107:18232]()
    return new Promise((resolve, reject) => {
    glob("**/**.test.js", { cwd: testsRoot }, (err, files) => {
    if (err) {
    [3.105279]
    [3.18232]
    return await new Promise((resolve, reject) => {
    glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
    if (err != null) {
  • replacement in src/test/suite/extension.test.ts at line 1
    [3.105784][3.18700:18734](),[3.18734][3.105819:105820](),[3.105819][3.105819:105820]()
    import * as assert from "assert";
    [3.105784]
    [3.105820]
    import * as assert from 'assert';
  • replacement in src/test/suite/extension.test.ts at line 4
    [3.105926][3.18735:18769]()
    import * as vscode from "vscode";
    [3.105926]
    [3.105960]
    import * as vscode from 'vscode';
  • replacement in src/test/suite/extension.test.ts at line 8
    [3.106012][3.18770:18868]()
    suite("Extension Test Suite", () => {
    vscode.window.showInformationMessage("Start all tests.");
    [3.106012]
    [3.106109]
    suite('Extension Test Suite', () => {
    // eslint-disable-next-line @typescript-eslint/no-floating-promises
    vscode.window.showInformationMessage('Start all tests.');
  • replacement in src/test/suite/extension.test.ts at line 12
    [3.106110][3.18869:18899]()
    test("Sample test", () => {
    [3.106110]
    [3.18899]
    test('Sample test', () => {
  • replacement in src/test/runTest.ts at line 1
    [3.106258][3.19006:19036]()
    import * as path from "path";
    [3.106258]
    [3.106289]
    import * as path from 'path';
    import { runTests } from 'vscode-test';
  • replacement in src/test/runTest.ts at line 4
    [3.106290][3.19037:19077](),[3.19077][3.106330:106331](),[3.106330][3.106330:106331](),[3.106331][3.19078:19103]()
    import { runTests } from "vscode-test";
    async function main () {
    [3.106290]
    [3.19103]
    async function main (): Promise<void> {
  • replacement in src/test/runTest.ts at line 8
    [3.19222][3.19222:19294]()
    const extensionDevelopmentPath = path.resolve(__dirname, "../../");
    [3.19222]
    [3.106539]
    const extensionDevelopmentPath = path.resolve(__dirname, '../../');
  • replacement in src/test/runTest.ts at line 12
    [3.19364][3.19364:19437]()
    const extensionTestsPath = path.resolve(__dirname, "./suite/index");
    [3.19364]
    [3.106676]
    const extensionTestsPath = path.resolve(__dirname, './suite/index');
  • replacement in src/test/runTest.ts at line 17
    [3.19589][3.19589:19631]()
    console.error("Failed to run tests");
    [3.19589]
    [3.19631]
    console.error('Failed to run tests');
  • edit in src/test/runTest.ts at line 22
    [3.106888]
    [3.106888]
    // eslint-disable-next-line @typescript-eslint/no-floating-promises