Skip to content

Commit

Permalink
chore: clean up lint issues due to rule changes
Browse files Browse the repository at this point in the history
  • Loading branch information
peternhale committed Nov 10, 2023
1 parent a3dd534 commit 13c2745
Show file tree
Hide file tree
Showing 5 changed files with 382 additions and 221 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"dependencies": {
"@salesforce/core": "^5.3.19",
"@salesforce/kit": "^3.0.15",
"@types/proxy-from-env": "^1.0.4",
"got": "^11.8.2",
"hpagent": "^1.2.0",
"mime-types": "^2.1.35",
Expand All @@ -33,29 +32,30 @@
"@types/fs-extra": "^11.0.4",
"@types/got": "^9.6.12",
"@types/mime-types": "^2.1.4",
"@types/proxy-from-env": "^1.0.4",
"@types/tar": "^6.1.8",
"@types/yeoman-assert": "^3.1.4",
"@types/yeoman-environment": "^2.10.11",
"@types/yeoman-generator": "^5.2.14",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.53.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-salesforce": "^2.0.2",
"eslint-config-salesforce-license": "^0.2.0",
"eslint-config-salesforce-typescript": "^3.0.2",
"eslint": "^7.27.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-salesforce": "^0.1.6",
"eslint-config-salesforce-license": "^0.1.6",
"eslint-config-salesforce-typescript": "^0.2.7",
"eslint-plugin-header": "^3.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^8.0.3",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"prettier": "^3.0.3",
"prettier": "^2.0.5",
"pretty-quick": "^3.1.0",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
Expand Down
45 changes: 24 additions & 21 deletions src/service/gitRepoUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
* See https://github.com/vercel/next.js for more information
*/

import {Global} from '@salesforce/core';
import { Global } from '@salesforce/core';
import * as crypto from 'crypto';
import * as fs from 'fs';
import got from 'got';
import * as path from 'path';
import {Stream} from 'stream';
import { Stream } from 'stream';
import * as tar from 'tar';
import {promisify} from 'util';
import {nls} from '../i18n';
import {HttpsProxyAgent} from 'hpagent';
import {getProxyForUrl} from 'proxy-from-env';
import { promisify } from 'util';
import { nls } from '../i18n';
import { HttpsProxyAgent } from 'hpagent';
import { getProxyForUrl } from 'proxy-from-env';

interface RepoInfo {
username: string;
Expand All @@ -42,29 +42,32 @@ export async function getRepoInfo(repoUri: URL): Promise<RepoInfo> {
const proxy = getProxyForUrl(url);

// proxy will be empty string if no proxy is set
const infoResponse = await (proxy !== '' ? got(url, {
agent: {
https: new HttpsProxyAgent({
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 256,
maxFreeSockets: 256,
scheduling: 'lifo',
proxy
const infoResponse = await (proxy !== ''
? got(url, {
agent: {
https: new HttpsProxyAgent({
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 256,
maxFreeSockets: 256,
scheduling: 'lifo',
proxy,
}),
},
})
}
}) : got(url)).catch((e) => e);
: got(url)
).catch((e) => e);
if (infoResponse.statusCode !== 200) {
throw new Error(
nls.localize('customTemplatesCannotRetrieveDefaultBranch', repoUri.href)
);
}
const info = JSON.parse(infoResponse.body);
return {username, name, branch: info['default_branch'], filePath};
return { username, name, branch: info['default_branch'], filePath };
}

if (username && name && branch && t === 'tree') {
return {username, name, branch, filePath};
return { username, name, branch, filePath };
} else {
throw new Error(
nls.localize('customTemplatesInvalidRepoUrl', repoUri.href)
Expand Down Expand Up @@ -121,10 +124,10 @@ export async function loadCustomTemplatesGitRepo(
);
}

const {username, name, branch, filePath} = await getRepoInfo(repoUri);
const { username, name, branch, filePath } = await getRepoInfo(repoUri);

if (!fs.existsSync(customTemplatesPath)) {
fs.mkdirSync(customTemplatesPath, {recursive: true});
fs.mkdirSync(customTemplatesPath, { recursive: true });
}

// Download the repo and extract to the SFDX global state folder
Expand Down
3 changes: 0 additions & 3 deletions src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
'use strict';

import * as util from 'util';

Expand All @@ -22,8 +21,6 @@ const statuses = [
export class Log {
private output = '';
private cleanOutput: string[] = [];

// tslint:disable-next-line: no-any
[index: string]: any;

constructor() {
Expand Down
4 changes: 2 additions & 2 deletions test/service/templateService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import * as yeoman from 'yeoman-environment';
import { TemplateService, TemplateType } from '../../src';
import { nls } from '../../src/i18n';
import { getStoragePathForCustomTemplates } from '../../src/service/gitRepoUtils';
import {getProxyForUrl} from 'proxy-from-env';
import { getProxyForUrl } from 'proxy-from-env';

chai.use(chaiAsPromised);
chai.should();
Expand Down Expand Up @@ -213,7 +213,7 @@ describe('TemplateService', () => {

it('should throw error if cannot retrieve default branch', async () => {
const mockIt = {
getProxyForUrl
getProxyForUrl,
};
// @ts-ignore - function signature is not compatible with sinon stub
sandbox.stub(mockIt, 'getProxyForUrl').returns(undefined);
Expand Down
Loading

0 comments on commit 13c2745

Please sign in to comment.