Skip to content

Commit

Permalink
Run prettier on everything
Browse files Browse the repository at this point in the history
  • Loading branch information
tgolen committed May 4, 2023
1 parent 6aafa15 commit 2a786a7
Show file tree
Hide file tree
Showing 760 changed files with 260,447 additions and 260,220 deletions.
10 changes: 1 addition & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@ module.exports = {
settings: {
'import/resolver': {
node: {
extensions: [
'.js',
'.website.js',
'.desktop.js',
'.native.js',
'.ios.js',
'.android.js',
'.config.js',
],
extensions: ['.js', '.website.js', '.desktop.js', '.native.js', '.ios.js', '.android.js', '.config.js'],
},
},
},
Expand Down
62 changes: 30 additions & 32 deletions .github/actions/javascript/authorChecklist/authorChecklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,22 @@ const issue = github.context.payload.issue ? github.context.payload.issue.number
*/
function getNumberOfItemsFromAuthorChecklist() {
return new Promise((resolve, reject) => {
https.get(pathToAuthorChecklist, (res) => {
let fileContents = '';
res.on('data', (chunk) => {
fileContents += chunk;
});
res.on('end', () => {
// Currently, both the author and reviewer checklists are in the PR template file, so we need to do a little bit of parsing the PR description to get just the author
// checklist.
const contentAfterStartOfAuthorChecklist = fileContents.split(authorChecklistStartsWith).pop();
const contentBeforeStartOfReviewerChecklist = contentAfterStartOfAuthorChecklist.split(reviewerChecklistStartsWith).shift();
https
.get(pathToAuthorChecklist, (res) => {
let fileContents = '';
res.on('data', (chunk) => {
fileContents += chunk;
});
res.on('end', () => {
// Currently, both the author and reviewer checklists are in the PR template file, so we need to do a little bit of parsing the PR description to get just the author
// checklist.
const contentAfterStartOfAuthorChecklist = fileContents.split(authorChecklistStartsWith).pop();
const contentBeforeStartOfReviewerChecklist = contentAfterStartOfAuthorChecklist.split(reviewerChecklistStartsWith).shift();

const numberOfChecklistItems = (contentBeforeStartOfReviewerChecklist.match(/\[ \]/g) || []).length;
resolve(numberOfChecklistItems);
});
})
const numberOfChecklistItems = (contentBeforeStartOfReviewerChecklist.match(/\[ \]/g) || []).length;
resolve(numberOfChecklistItems);
});
})
.on('error', reject);
});
}
Expand All @@ -36,29 +37,26 @@ function getNumberOfItemsFromAuthorChecklist() {
* @param {Number} numberOfChecklistItems
*/
function checkIssueForCompletedChecklist(numberOfChecklistItems) {
GitHubUtils.getPullRequestBody(issue)
.then((pullRequestBody) => {
const contentAfterStartOfAuthorChecklist = pullRequestBody.split(authorChecklistStartsWith).pop();
const contentOfAuthorChecklist = contentAfterStartOfAuthorChecklist.split(reviewerChecklistStartsWith).shift();
GitHubUtils.getPullRequestBody(issue).then((pullRequestBody) => {
const contentAfterStartOfAuthorChecklist = pullRequestBody.split(authorChecklistStartsWith).pop();
const contentOfAuthorChecklist = contentAfterStartOfAuthorChecklist.split(reviewerChecklistStartsWith).shift();

const numberOfFinishedChecklistItems = (contentOfAuthorChecklist.match(/- \[x\]/gi) || []).length;
const numberOfUnfinishedChecklistItems = (contentOfAuthorChecklist.match(/- \[ \]/g) || []).length;
const numberOfFinishedChecklistItems = (contentOfAuthorChecklist.match(/- \[x\]/gi) || []).length;
const numberOfUnfinishedChecklistItems = (contentOfAuthorChecklist.match(/- \[ \]/g) || []).length;

const maxCompletedItems = numberOfChecklistItems + 2;
const minCompletedItems = numberOfChecklistItems - 2;
const maxCompletedItems = numberOfChecklistItems + 2;
const minCompletedItems = numberOfChecklistItems - 2;

console.log(`You completed ${numberOfFinishedChecklistItems} out of ${numberOfChecklistItems} checklist items with ${numberOfUnfinishedChecklistItems} unfinished items`);
console.log(`You completed ${numberOfFinishedChecklistItems} out of ${numberOfChecklistItems} checklist items with ${numberOfUnfinishedChecklistItems} unfinished items`);

if (numberOfFinishedChecklistItems >= minCompletedItems
&& numberOfFinishedChecklistItems <= maxCompletedItems
&& numberOfUnfinishedChecklistItems === 0) {
console.log('PR Author checklist is complete 🎉');
return;
}
if (numberOfFinishedChecklistItems >= minCompletedItems && numberOfFinishedChecklistItems <= maxCompletedItems && numberOfUnfinishedChecklistItems === 0) {
console.log('PR Author checklist is complete 🎉');
return;
}

console.log(`Make sure you are using the most up to date checklist found here: ${pathToAuthorChecklist}`);
core.setFailed('PR Author Checklist is not completely filled out. Please check every box to verify you\'ve thought about the item.');
});
console.log(`Make sure you are using the most up to date checklist found here: ${pathToAuthorChecklist}`);
core.setFailed("PR Author Checklist is not completely filled out. Please check every box to verify you've thought about the item.");
});
}

getNumberOfItemsFromAuthorChecklist()
Expand Down
Loading

0 comments on commit 2a786a7

Please sign in to comment.