Skip to content

Commit eb038a3

Browse files
committed
🐛 fix: github action - lint
1 parent 931f6fb commit eb038a3

5 files changed

Lines changed: 22 additions & 22 deletions

File tree

.github/lint.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
name: linter
12
on:
2-
push:
3-
branches:
4-
- master
5-
- main
63
pull_request:
74
branches:
8-
- "*"
5+
- main
6+
- master
7+
98
jobs:
109
build:
1110
runs-on: ubuntu-latest

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "A minimalist approach toward git commits to keep things simple.",
55
"main": "./bin/index.js",
66
"scripts": {
7-
"lint": "eslint ."
7+
"lint": "eslint .",
8+
"fix": "eslint . --fix"
89
},
910
"bin": {
1011
"mct": "bin/index.js"

src/cli.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ import {
66
getStagedFiles,
77
checkIfRepoisGit,
88
getUnstagedFiles,
9-
stageFiles,
9+
stageFiles
1010
} from "./commands.js";
1111

12-
function logOption(title, description) {
12+
function logOption (title, description) {
1313
return chalk.bgWhite(title) + " - " + description;
1414
}
1515

16-
async function cli() {
16+
async function cli () {
1717
const [isGit, stagedFiles] = await Promise.all([
1818
checkIfRepoisGit(),
19-
getStagedFiles(),
19+
getStagedFiles()
2020
]);
2121
if (isGit && !stagedFiles) {
2222
await promptToCommit();
@@ -68,8 +68,8 @@ const promptToCommit = async () => {
6868
message:
6969
"Select the files you want to add with, and use (CTRL + D to exit)",
7070
type: "checkbox",
71-
choices: styledList,
72-
},
71+
choices: styledList
72+
}
7373
])
7474
.then((answer) => {
7575
if (answer.list.length < 1) {
@@ -118,14 +118,14 @@ const addCommit = async () => {
118118
"📝 docs",
119119
"🎨 style",
120120
"🛠 config",
121-
"📦 misc",
122-
],
121+
"📦 misc"
122+
]
123123
},
124124
{
125125
name: "message",
126126
message: "Write a commit message ✍️ : ",
127-
type: "input",
128-
},
127+
type: "input"
128+
}
129129
])
130130
.then((answer) => {
131131
const message = `${answer.type}: ${answer.message}`;

src/commands.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { exec } from "child_process";
22
import chalk from "chalk";
33
import { logExec } from "./helper.js";
44

5-
export function checkIfRepoisGit() {
5+
export function checkIfRepoisGit () {
66
return new Promise((resolve, reject) => {
77
exec("git rev-parse --is-inside-work-tree", (err, stdout, stderr) => {
88
if (stdout == "true\n") resolve(stdout);
@@ -31,7 +31,7 @@ export function checkIfRepoisGit() {
3131
});
3232
}
3333

34-
export async function getStagedFiles() {
34+
export async function getStagedFiles () {
3535
return new Promise((resolve, reject) => {
3636
exec("git diff --cached --name-only", (err, stdout, stderr) => {
3737
if (err) {
@@ -53,7 +53,7 @@ export async function getStagedFiles() {
5353
});
5454
}
5555

56-
export function commitFiles(message) {
56+
export function commitFiles (message) {
5757
exec(`git commit -m "${message}"`, (err, stdout, stderr) => {
5858
if (err) {
5959
logExec(err);
@@ -67,7 +67,7 @@ export function commitFiles(message) {
6767
});
6868
}
6969

70-
export async function getUnstagedFiles() {
70+
export async function getUnstagedFiles () {
7171
return new Promise((resolve, reject) => {
7272
exec("git status --porcelain", (err, stdout, stderr) => {
7373
if (err) {
@@ -84,7 +84,7 @@ export async function getUnstagedFiles() {
8484
});
8585
}
8686

87-
export async function stageFiles(files) {
87+
export async function stageFiles (files) {
8888
return new Promise((resolve, reject) => {
8989
exec(`git add ${files}`, (err, stdout, stderr) => {
9090
if (err) {

src/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import chalk from "chalk";
22

3-
export function logExec(message) {
3+
export function logExec (message) {
44
console.log("\n\n");
55
console.log(chalk.bgRed("⛔️ Whops! Something went wrong. Try again!"));
66
console.log(message);

0 commit comments

Comments
 (0)