Skip to content

Commit ba4b0b9

Browse files
committed
Run Prettier
1 parent e106b35 commit ba4b0b9

File tree

1 file changed

+38
-28
lines changed

1 file changed

+38
-28
lines changed

bin/markdown-to-jira

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,24 @@ let jira;
6363
username: credentials.username,
6464
password: credentials.token,
6565
apiVersion: "2",
66-
strictSSL: true
66+
strictSSL: true,
6767
});
6868

6969
// A bit of a hack, but the endpoint isn't available in the SDK
7070
jira.fetchUsers = function(list) {
71-
const names = Array.from(list).join(',')
72-
return this.doRequest(this.makeRequestHeader(this.makeUri({
73-
pathname: '/user/bulk/migration?username=' + names,
74-
}), {
75-
method: 'GET',
76-
followAllRedirects: true,
77-
}));
78-
}
71+
const names = Array.from(list).join(",");
72+
return this.doRequest(
73+
this.makeRequestHeader(
74+
this.makeUri({
75+
pathname: "/user/bulk/migration?username=" + names,
76+
}),
77+
{
78+
method: "GET",
79+
followAllRedirects: true,
80+
}
81+
)
82+
);
83+
};
7984

8085
let content = "";
8186

@@ -101,7 +106,7 @@ let jira;
101106
let tickets = InputParser(content.toString());
102107

103108
// Build a list of usernames encountered
104-
const userNames = new Set;
109+
const userNames = new Set();
105110
for (t of tickets) {
106111
userNames.add(t.assignee);
107112
for (c of t.children) {
@@ -118,36 +123,35 @@ let jira;
118123

119124
// Validate that all usernames provided were valid
120125
// Parent tickets
121-
tickets = tickets.map(t => {
126+
tickets = tickets.map((t) => {
122127
if (!userIds[t.assignee]) {
123128
throw new Error(`Invalid assignee: ${t.assignee}`);
124129
}
125130
t.assignee = {
126131
name: t.assignee,
127-
id: userIds[t.assignee]
128-
}
132+
id: userIds[t.assignee],
133+
};
129134

130135
// Child tickets
131-
t.children = t.children.map(c => {
136+
t.children = t.children.map((c) => {
132137
if (!userIds[c.assignee]) {
133138
throw new Error(`Invalid assignee: ${c.assignee}`);
134139
}
135140
c.assignee = {
136141
name: c.assignee,
137-
id: userIds[c.assignee]
138-
}
142+
id: userIds[c.assignee],
143+
};
139144
return c;
140-
})
145+
});
141146

142147
return t;
143148
});
144149

145150
const table = new Table({
146151
head: ["Key", "Title", "Assignee", "Components", "Parent"],
147-
colWidths: [15, 30, 20, 15, 15]
152+
colWidths: [15, 30, 20, 15, 15],
148153
});
149154

150-
151155
for (t of tickets) {
152156
let parent = await createIssue(
153157
program.dry,
@@ -157,7 +161,13 @@ let jira;
157161
t.assignee.id,
158162
t.components
159163
);
160-
table.push([parent.key, t.title, t.assignee.name, t.components.join("\n"), ""]);
164+
table.push([
165+
parent.key,
166+
t.title,
167+
t.assignee.name,
168+
t.components.join("\n"),
169+
"",
170+
]);
161171

162172
// If there are any children, create tickets using the parent key generated above
163173
for (c of t.children) {
@@ -175,7 +185,7 @@ let jira;
175185
c.title,
176186
c.assignee.name,
177187
c.components.join("\n"),
178-
parent.key
188+
parent.key,
179189
]);
180190
}
181191
}
@@ -195,21 +205,21 @@ function createIssue(
195205
let issueType = !parentIssue ? "Task" : "Sub-task";
196206
let request = {
197207
fields: {
198-
components: components.map(v => {
208+
components: components.map((v) => {
199209
return { name: v };
200210
}),
201211
assignee: {
202-
id: assignee
212+
id: assignee,
203213
},
204214
project: {
205-
key: project
215+
key: project,
206216
},
207217
summary: title,
208218
description: description,
209219
issuetype: {
210-
name: issueType
211-
}
212-
}
220+
name: issueType,
221+
},
222+
},
213223
};
214224

215225
if (parentIssue) {
@@ -228,4 +238,4 @@ function createIssue(
228238
return Promise.resolve({ key: generatedKey });
229239
}
230240
return jira.addNewIssue(request);
231-
}
241+
}

0 commit comments

Comments
 (0)