Skip to content

Commit

Permalink
style: format code with dotnet-format, Prettier and StandardJS
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in c9d9a01 according to the output
from dotnet-format, Prettier and StandardJS.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Oct 20, 2023
1 parent c9d9a01 commit 8cd91ce
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 46 deletions.
23 changes: 15 additions & 8 deletions Scripts/ts/delete-github-package-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
* License: MIT (https://opensource.org/licenses/MIT)
*/

import process from 'process';
import process from "process";
import { deletePackageVersionAsync } from "./github-cli.js";
import { PackageType, toPackageType, toSemVer } from './github-cli-types.js';
import yargs from 'yargs/yargs';
import { hideBin } from 'yargs/helpers';
import { PackageType, toPackageType, toSemVer } from "./github-cli-types.js";
import yargs from "yargs/yargs";
import { hideBin } from "yargs/helpers";
import { SemVer } from "semver";
// const argv = yargs(hideBin(process.argv));

const getArg = function (...marker: string[]): string | undefined {
for (let i = 0; i < marker.length; i++) {
var pos = process.argv.findIndex(arg => arg.endsWith(marker[i]));
var pos = process.argv.findIndex((arg) => arg.endsWith(marker[i]));

Check warning on line 23 in Scripts/ts/delete-github-package-version.ts

View check run for this annotation

codefactor.io / CodeFactor

Scripts/ts/delete-github-package-version.ts#L23

Unexpected var, use let or const instead. (no-var)
if (pos > -1 && pos < process.argv.length - 1) {
return process.argv[pos + 1];
}
Expand All @@ -29,7 +29,6 @@ const getArg = function (...marker: string[]): string | undefined {
};

const main = async () => {

// console.log(`yargs: ${JSON.stringify(yargs)}`);

// console.log(`argv: ${JSON.stringify(argv)}`);
Expand Down Expand Up @@ -62,7 +61,9 @@ const main = async () => {
const packageType = toPackageType(getArg("t", "type", "package-type"));
const token = getArg("token", "k");

console.log(`Args: org: ${orgId}, packageId: ${packageId}, version: ${version}, packageType: ${packageType}, token: ${token}`);
console.log(
`Args: org: ${orgId}, packageId: ${packageId}, version: ${version}, packageType: ${packageType}, token: ${token}`,
);

if (orgId === undefined) {
throw new Error("Organization is required");
Expand All @@ -84,7 +85,13 @@ const main = async () => {
throw new Error("GitHub API token is required");
}

await deletePackageVersionAsync(orgId, packageId, version, packageType, token);
await deletePackageVersionAsync(
orgId,
packageId,
version,
packageType,
token,
);
};

console.log(`main: ${main}`);
Expand Down
83 changes: 45 additions & 38 deletions Scripts/ts/github-cli-types.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
/*
* github-cli-types.ts
*
* Created: 2022-11-27-05:39:27
* Modified: 2022-12-05-04:14:47
*
* Author: David G. Moore, Jr. <[email protected]>
*
* Copyright © 2022-2023 David G. Moore, Jr., All Rights Reserved
* License: MIT (https://opensource.org/licenses/MIT)
*/
import { SemVer } from "semver";

export interface PackageVersion {
id: number;
name: string;
package_html_url: string;
url: string;
created_at: string;
updated_at: string;
visibility: string;
package_type: PackageType;
downloads_count: number;
description: string;
html_url: string;
license: string;
}

export interface ApiMessage {
message: string;
documentation_url: string;
}

export type PackageType = "nuget" | "npm" | "docker" | "maven" | "rubygems" | "container";


export const toSemVer = (stringVer: string | undefined) => new SemVer(stringVer ?? "0.0.0");
export const toPackageType = (stringType: string | undefined) => stringType as PackageType;
/*
* github-cli-types.ts
*
* Created: 2022-11-27-05:39:27
* Modified: 2022-12-05-04:14:47
*
* Author: David G. Moore, Jr. <[email protected]>
*
* Copyright © 2022-2023 David G. Moore, Jr., All Rights Reserved
* License: MIT (https://opensource.org/licenses/MIT)
*/
import { SemVer } from "semver";

export interface PackageVersion {
id: number;
name: string;
package_html_url: string;
url: string;
created_at: string;
updated_at: string;
visibility: string;
package_type: PackageType;
downloads_count: number;
description: string;
html_url: string;
license: string;
}

export interface ApiMessage {
message: string;
documentation_url: string;
}

export type PackageType =
| "nuget"
| "npm"
| "docker"
| "maven"
| "rubygems"
| "container";

export const toSemVer = (stringVer: string | undefined) =>
new SemVer(stringVer ?? "0.0.0");
export const toPackageType = (stringType: string | undefined) =>
stringType as PackageType;

0 comments on commit 8cd91ce

Please sign in to comment.