Skip to content

Commit

Permalink
code quality improved
Browse files Browse the repository at this point in the history
  • Loading branch information
darsan-in committed Nov 21, 2024
1 parent a8f3c17 commit 591d9d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/iconAssociator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function writeSettings(): Promise<void> {
});
}

function copyRichieJSIcon() {
function copyRichieJSIcon(): void {
const userHome: string = (
process.platform === "win32" ?
join(process.env.HOMEDRIVE ?? "", process.env.HOMEPATH ?? "")
Expand Down
2 changes: 1 addition & 1 deletion bin/rjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function main(): Promise<void> {
const givenCommand: availableCommandsOP = process
.argv[2] as availableCommandsOP;

const unsupportedAlert = () => {
const unsupportedAlert = (): void => {
console.log(
`Unsupported command\nAvailable commands are\n${availableCommands}`,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/browser/branding.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default function branding() {
export default function branding(): void {
const asciiArt = `
_______ _____ ______
| \\ | \\ / \\
Expand Down
12 changes: 6 additions & 6 deletions lib/browser/pathlib.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export function dirname(filePath: string) {
export function dirname(filePath: string): string {
return filePath.substring(0, filePath.lastIndexOf("/"));
}

export function basename(path: string, ext: string = "") {
export function basename(path: string, ext: string = ""): string {
// Extract the base name of the path
const base: string = path.split("/").pop() ?? "";

Expand All @@ -14,7 +14,7 @@ export function basename(path: string, ext: string = "") {
return base;
}

export function join(...args: string[]) {
export function join(...args: string[]): string {
// Normalize paths and remove leading/trailing slashes, if any
return args
.map((segment) =>
Expand All @@ -24,7 +24,7 @@ export function join(...args: string[]) {
.join("/");
}

export function relative(from: string, to: string) {
export function relative(from: string, to: string): string {
// Normalize paths by splitting into segments
const fromParts = from.replace(/[/\\]+$/, "").split("/");
const toParts = to.replace(/[/\\]+$/, "").split("/");
Expand All @@ -48,7 +48,7 @@ export function relative(from: string, to: string) {
return relativePath || ".";
}

export function resolve(...paths: string[]) {
export function resolve(...paths: string[]): string {
// Initialize an array to hold the resolved path segments
let resolvedPath: string[] = [];

Expand All @@ -67,6 +67,6 @@ export function resolve(...paths: string[]) {
return resolvedPath.join("/").replace(/\/+/g, "/");
}

export function cwd() {
export function cwd(): string {
return document.baseURI;
}

0 comments on commit 591d9d3

Please sign in to comment.