Skip to content

Commit aa07ffa

Browse files
agg-shambhaviactions-user
authored andcommitted
🔧 general: Fix linting with prettier
1 parent f3de431 commit aa07ffa

File tree

9 files changed

+399
-387
lines changed

9 files changed

+399
-387
lines changed

bin/index.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@ const {
1212
} = require("../lib/inquirer.js");
1313
const simpleGit = require("simple-git");
1414
const git = simpleGit();
15-
const {
16-
jsonReader
17-
} = require("../lib/funcs/jsonReader.js");
15+
const { jsonReader } = require("../lib/funcs/jsonReader.js");
1816
const version = require("../package.json");
1917
const chalk = require("chalk");
20-
const {
21-
exec
22-
} = require("child_process");
18+
const { exec } = require("child_process");
2319
const fs = require("fs");
2420

2521
clear();
@@ -239,9 +235,9 @@ program
239235
);
240236
console.log(
241237
"You just need to know 5 simple commands you and then you're " +
242-
chalk.bold.cyan("gtg") +
243-
": " +
244-
chalk.magenta("Good to Go")
238+
chalk.bold.cyan("gtg") +
239+
": " +
240+
chalk.magenta("Good to Go")
245241
);
246242
console.log(chalk.green("\ngtg config:\n"));
247243
console.log(
@@ -265,4 +261,4 @@ program
265261
);
266262
});
267263

268-
program.parse(process.argv);
264+
program.parse(process.argv);

lib/files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ module.exports = {
1111
// gets the whole directory list
1212
return fs.existsSync(filePath);
1313
},
14-
};
14+
};

lib/funcs/commit-gen.js

Lines changed: 56 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,88 @@
11
const emoji = require("node-emoji");
22
const fs = require("fs");
33
const reader = require("./jsonReader");
4-
const {
5-
Console
6-
} = require("console");
4+
const { Console } = require("console");
75

86
stopwords = ["a", "the"];
97

108
const suggestCommitMsgCb = (conf) => {
11-
129
const issue_labels = conf.current_issue.labels;
1310
const issue_title = conf.current_issue.title;
1411
const issue_number = conf.current_issue.number;
1512
const commitGuidelines = conf.commit_guidelines;
1613
const customBoolean = conf.custom_guidelines;
17-
const commitTypeContent = conf.selected_commit_type.match(/([A-Za-z\s\-]+)\w+/g).join().trim();
14+
const commitTypeContent = conf.selected_commit_type
15+
.match(/([A-Za-z\s\-]+)\w+/g)
16+
.join()
17+
.trim();
1818
const emojiBool = conf.use_emojis;
1919
var commitTypeEmoji;
2020
var commitGuideNum;
2121
var commitMsg;
2222
var commitPrefix;
2323

24-
25-
2624
const messageBlock = {
2725
"Initial commit": {
2826
emoji: conf.emojis.initial_commit,
29-
prefix: ''
27+
prefix: "",
3028
},
3129
"Adding a new user-facing feature": {
3230
emoji: conf.emojis.feature,
33-
prefix: 'feat'
31+
prefix: "feat",
3432
},
3533
"Improving UI": {
3634
emoji: conf.emojis.ui,
37-
prefix: 'feat'
35+
prefix: "feat",
3836
},
3937
"Refactoring or improving code": {
4038
emoji: conf.emojis.code_quality,
41-
prefix: 'chore'
39+
prefix: "chore",
4240
},
4341
"Improving performance": {
4442
emoji: conf.emojis.security,
45-
prefix: 'chore'
43+
prefix: "chore",
4644
},
4745
"Updating configs": {
4846
emoji: conf.emojis.config,
49-
prefix: 'chore'
47+
prefix: "chore",
5048
},
5149
"Improving accessibility": {
5250
emoji: conf.emojis.accessibility,
53-
prefix: 'chore'
51+
prefix: "chore",
5452
},
5553
"Improving dev tools": {
5654
emoji: conf.emojis.dev_tools,
57-
prefix: 'feat'
55+
prefix: "feat",
5856
},
5957
"Writing docs": {
6058
emoji: conf.emojis.docs,
61-
prefix: 'chore'
59+
prefix: "chore",
6260
},
6361
"New release": {
6462
emoji: conf.emojis.release,
65-
prefix: 'chore'
63+
prefix: "chore",
6664
},
6765
"Fixing a bug": {
6866
emoji: conf.emojis.bug_fix,
69-
prefix: 'fix'
67+
prefix: "fix",
7068
},
7169
"Fixing a crash": {
7270
emoji: conf.emojis.crash,
73-
prefix: 'fix'
71+
prefix: "fix",
7472
},
7573
"Removing code/files": {
7674
emoji: conf.emojis.cleanup,
77-
prefix: 'chore'
75+
prefix: "chore",
7876
},
79-
"WIP": {
77+
WIP: {
8078
emoji: conf.emojis.wip,
81-
prefix: 'chore'
79+
prefix: "chore",
8280
},
83-
84-
}
81+
};
8582

8683
var details = messageBlock[commitTypeContent];
8784
commitPrefix = details.prefix;
88-
commitTypeEmoji = emoji.get(':' + details.emoji + ':');
85+
commitTypeEmoji = emoji.get(":" + details.emoji + ":");
8986

9087
switch (commitGuidelines[0]) {
9188
case `fix:`:
@@ -103,74 +100,67 @@ const suggestCommitMsgCb = (conf) => {
103100

104101
if (customBoolean == false) {
105102
switch (commitGuideNum) {
106-
case 1: {
103+
case 1:
104+
{
105+
if (emojiBool == true) {
106+
commitMsg = `${commitTypeEmoji} ${commitPrefix}: ${issue_title}`;
107+
conf.current_commit_message = commitMsg;
108+
} else {
109+
commitMsg = `${commitPrefix}: ${issue_title}`;
110+
conf.current_commit_message = commitMsg;
111+
}
112+
}
113+
break;
114+
115+
case 2:
116+
{
117+
if (emojiBool == true) {
118+
commitMsg = `${commitTypeEmoji} fix #${issue_number} ${issue_title}`;
119+
conf.current_commit_message = commitMsg;
120+
} else {
121+
commitMsg = `fix #${issue_number} ${issue_title}`;
122+
conf.current_commit_message = commitMsg;
123+
}
124+
}
125+
break;
126+
case 3: {
107127
if (emojiBool == true) {
108-
commitMsg = `${commitTypeEmoji} ${commitPrefix}: ${issue_title}`;
128+
commitMsg = `${commitTypeEmoji} ${issue_title} fix #${issue_number}`;
109129
conf.current_commit_message = commitMsg;
110-
111130
} else {
112-
commitMsg = `${commitPrefix}: ${issue_title}`;
131+
commitMsg = `${issue_title} fix #${issue_number}`;
113132
conf.current_commit_message = commitMsg;
114-
115133
}
116-
117-
}
118-
break;
119-
120-
case 2: {
121-
if (emojiBool == true) {
122-
commitMsg = `${commitTypeEmoji} fix #${issue_number} ${issue_title}`;
123-
conf.current_commit_message = commitMsg;
124-
125-
} else {
126-
commitMsg = `fix #${issue_number} ${issue_title}`;
127-
conf.current_commit_message = commitMsg;
128-
129134
}
130135
}
131-
break;
132-
case 3: {
133-
if (emojiBool == true) {
134-
commitMsg = `${commitTypeEmoji} ${issue_title} fix #${issue_number}`;
135-
conf.current_commit_message = commitMsg;
136-
137-
} else {
138-
commitMsg = `${issue_title} fix #${issue_number}`;
139-
conf.current_commit_message = commitMsg;
140-
141-
}
142-
}
143-
}
144136
} else {
145-
var customPrefix = issue_labels.length > 0 ? issue_labels[0] + ":" : '';
137+
var customPrefix = issue_labels.length > 0 ? issue_labels[0] + ":" : "";
146138
if (emojiBool == true) {
147139
commitMsg = `${commitTypeEmoji} ${customPrefix} ${issue_title}`;
148140
conf.current_commit_message = commitMsg;
149-
150141
} else {
151142
commitMsg = `${customPrefix} ${issue_title}`;
152143
conf.current_commit_message = commitMsg;
153-
154144
}
155145
}
156146
fs.writeFile("./.gitgo", JSON.stringify(conf, null, 2), (err) => {
157147
if (err) console.log("Error writing file:", err);
158148
});
159149

160150
return commitMsg;
161-
}
151+
};
162152

163153
module.exports = {
164154
suggestCommitMsg: () => {
165155
setTimeout(() => {
166-
reader.jsonReader('./.gitgo', (err, conf) => {
156+
reader.jsonReader("./.gitgo", (err, conf) => {
167157
if (err) {
168-
console.log(err)
169-
return
158+
console.log(err);
159+
return;
170160
}
171161
const retVal = suggestCommitMsgCb(conf);
172-
})
162+
});
173163
}, 4000);
174164
},
175-
suggestCommitMsgCb
176-
}
165+
suggestCommitMsgCb,
166+
};

lib/funcs/generate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ module.exports = {
7070
}
7171
});
7272
},
73-
};
73+
};

lib/funcs/jsonReader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ module.exports = {
1414
}
1515
});
1616
},
17-
};
17+
};

0 commit comments

Comments
 (0)