Skip to content

Commit e0b100b

Browse files
committed
style: format
1 parent db6f21c commit e0b100b

File tree

5 files changed

+34
-34
lines changed

5 files changed

+34
-34
lines changed

src/autofill.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export async function makeAndFillCommitMsg(repository: Repository) {
4040
const newMsg = generateMsg(fileChanges, oldMsg);
4141
console.debug("New message: ", newMsg);
4242

43-
const commitMessageValue = await getCommitTemplateValue()
44-
console.debug({ commitMessageValue })
43+
const commitMessageValue = await getCommitTemplateValue();
44+
console.debug({ commitMessageValue });
4545

4646
setCommitMsg(repository, newMsg);
4747
}

src/extension.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ export function activate(context: vscode.ExtensionContext) {
7171
}
7272

7373
// eslint-disable-next-line @typescript-eslint/no-empty-function
74-
export function deactivate() { }
74+
export function deactivate() {}

src/git/cli.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ const exec = util.promisify(childProcess.exec);
1313
/**
1414
* Run a `git` subcommand with options and return output.
1515
*/
16-
export function execute(cwd: string, subcommand: string, options: string[] = []) {
16+
export function execute(
17+
cwd: string,
18+
subcommand: string,
19+
options: string[] = []
20+
) {
1721
const command = `git ${subcommand} ${options.join(" ")}`;
1822

1923
const result = exec(command, { cwd });
@@ -45,12 +49,8 @@ async function _diffIndex(options: string[] = []): Promise<Array<string>> {
4549
"HEAD",
4650
];
4751

48-
const workspace = getWorkspaceFolder()
49-
const { stdout, stderr } = await execute(
50-
workspace,
51-
cmd,
52-
fullOptions
53-
);
52+
const workspace = getWorkspaceFolder();
53+
const { stdout, stderr } = await execute(workspace, cmd, fullOptions);
5454

5555
if (stderr) {
5656
console.debug(`stderr for 'git ${cmd}' command:`, stderr);

src/git/commitTemplate.ts

+22-22
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@
1111
*
1212
* To avoid making an extra config value for the extension that one has to manage say in a Settings file or internal data, the approach is rather to use the existing commit template pattern in Git.
1313
*/
14-
import * as fs from 'fs';
15-
import * as path from 'path';
14+
import * as fs from "fs";
15+
import * as path from "path";
1616
import { getWorkspaceFolder } from "../workspace";
1717
import { execute } from "./cli";
1818

19-
const CONFIG_SUBCOMMAND = "config"
20-
const COMMIT_TEMPLATE_IDENTIFIER = 'commit.template'
19+
const CONFIG_SUBCOMMAND = "config";
20+
const COMMIT_TEMPLATE_IDENTIFIER = "commit.template";
2121

2222
/**
2323
* Get a value from the Git config.
2424
*
2525
* The CLI will assume local (project) project by default.
2626
*/
2727
export async function _getConfigValue(options: string[]) {
28-
const workspace = getWorkspaceFolder()
28+
const workspace = getWorkspaceFolder();
2929
const { stdout, stderr } = await execute(
3030
workspace,
3131
CONFIG_SUBCOMMAND,
@@ -36,7 +36,7 @@ export async function _getConfigValue(options: string[]) {
3636
console.debug(`stderr for 'git ${CONFIG_SUBCOMMAND}' command:`, stderr);
3737
}
3838

39-
return stdout
39+
return stdout;
4040
}
4141

4242
/**
@@ -46,10 +46,10 @@ export async function _getConfigValue(options: string[]) {
4646
*/
4747
async function _getCommitTemplatePath() {
4848
try {
49-
const options = [COMMIT_TEMPLATE_IDENTIFIER]
50-
return await _getConfigValue(options)
49+
const options = [COMMIT_TEMPLATE_IDENTIFIER];
50+
return await _getConfigValue(options);
5151
} catch (_e) {
52-
return null
52+
return null;
5353
}
5454
}
5555

@@ -59,26 +59,26 @@ async function _getCommitTemplatePath() {
5959
* NB. Use current workspace as the base path.
6060
*/
6161
function _readFile(filePath: string) {
62-
const workspace = getWorkspaceFolder()
63-
const p = path.join(workspace, filePath)
62+
const workspace = getWorkspaceFolder();
63+
const p = path.join(workspace, filePath);
6464

65-
let value
65+
let value;
6666

6767
try {
68-
value = fs.readFileSync(p, "utf-8")
68+
value = fs.readFileSync(p, "utf-8");
6969
} catch (err) {
70-
console.error(`Could not find template file: ${p}. ${err.toString()}`)
70+
console.error(`Could not find template file: ${p}. ${err.toString()}`);
7171

72-
return null
72+
return null;
7373
}
7474

7575
if (!value) {
76-
return null
76+
return null;
7777
}
7878

79-
console.debug(`Read ${p} and found: ${value}`)
79+
console.debug(`Read ${p} and found: ${value}`);
8080

81-
return value
81+
return value;
8282
}
8383

8484
/**
@@ -87,12 +87,12 @@ function _readFile(filePath: string) {
8787
* Return null if file is not configured or file is missing, without aborting.
8888
*/
8989
export async function getCommitTemplateValue() {
90-
const filePath = await _getCommitTemplatePath()
90+
const filePath = await _getCommitTemplatePath();
9191

9292
if (!filePath) {
93-
console.error(`Could not read missing file: ${filePath}`)
94-
return null
93+
console.error(`Could not read missing file: ${filePath}`);
94+
return null;
9595
}
9696

97-
return _readFile(filePath)
97+
return _readFile(filePath);
9898
}

src/workspace.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { workspace } from "vscode";
22

33
export function getWorkspaceFolder(): string {
44
const { workspaceFolders } = workspace;
5-
console.log({ workspaceFolders })
5+
console.log({ workspaceFolders });
66

77
return workspaceFolders ? workspaceFolders[0].uri.fsPath : "";
8-
};
8+
}

0 commit comments

Comments
 (0)