Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ module.exports = {
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/no-object-literal-type-assertion": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/ban-ts-ignore": 1,
},
};
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12.13.1
11 changes: 6 additions & 5 deletions lib/features/pr-onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const createLabelChecklists = async (context: PRContext, config: Config, useLabe
prLabels = getLabelsOnPR(context).map(label => labelToString(label));
}

let checklists = parseAutoChecklists(context.payload.pull_request.body) || {};
const checklists = parseAutoChecklists(context.payload.pull_request.body) || {};

const semverChecklistItems = await Promise.all(
["major", "minor", "patch"].map(async labelType => {
Expand Down Expand Up @@ -199,9 +199,8 @@ export const isOnboarding = (context: PRContext) => {
* `true` if there was a change to the body of the PR, `false` otherwise
*/
const didBodyChange = (context: PRContext) =>
(context.payload.changes &&
context.payload.changes.body &&
isString(context.payload.changes.body!.from) &&
(context.payload.changes?.body &&
isString(context.payload.changes.body.from) &&
!!context.payload.pull_request.body) ||
false;

Expand All @@ -224,7 +223,9 @@ const getRequiredLabelChanges = (body: string, config: Config) => {
const checklists = parseAutoChecklists(parseMessage(body));
const checklistKeys = Object.values(ChecklistKey);

const validChecklists = Object.values(checklists).filter(checklist => checklistKeys.includes(checklist.id));
const validChecklists = Object.values(checklists).filter(checklist =>
checklistKeys.includes(checklist.id as ChecklistKey),
);

// Don't add labels if there are too many items checked for any given checklist
const labelsToAdd = flattenChecklists(validChecklists.filter(checklist => !moreThanOneItemChecked(checklist.items)))
Expand Down
2 changes: 1 addition & 1 deletion lib/models/checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function parseChecklists(text: string, namespace?: string) {
.map(check => check.match(CHECK_DETAILS))
.filter(check => check !== null)
.forEach(check => {
let checked = !!check![1].trim();
const checked = !!check![1].trim();
const [namespace, checklistID, checkID] = check![2].split(":");
const body = check![3];

Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@
"wcag-contrast": "^2.1.1"
},
"devDependencies": {
"@now/node": "^0.10.1",
"@now/node": "^1.2.0",
"@types/dedent": "^0.7.0",
"@types/jest": "^24.0.16",
"@types/lodash": "^4.14.129",
"@types/micro": "^7.3.3",
"@types/nock": "^9.3.0",
"@types/node": "^11.9.0",
"@types/node": "^12.12.14",
"@types/node-fetch": "^2.3.7",
"@types/opentype.js": "^0.7.2",
"@types/pino": "^5.8.7",
"@types/wcag-contrast": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"@typescript-eslint/eslint-plugin": "^2.9.0",
"@typescript-eslint/parser": "^2.9.0",
"deepmerge": "^4.0.0",
"eslint": "^6.1.0",
"eslint-config-prettier": "^6.0.0",
Expand All @@ -64,18 +64,17 @@
"lint-staged": "^9.2.1",
"nock": "^10.0.6",
"node-fetch": "^2.6.0",
"nodemon": "^1.17.2",
"npm-run-all": "^4.1.5",
"patch-package": "^6.1.2",
"pino-pretty": "^3.1.0",
"prettier": "^1.16.4",
"prettier": "^1.19.1",
"smee-client": "^1.0.2",
"ts-jest": "^24.0.0",
"typescript": "^3.5.1",
"ts-jest": "^24.2.0",
"typescript": "^3.7.2",
"typescript-eslint-parser": "^22.0.0"
},
"engines": {
"node": ">= 8.3.0"
"node": "12.x"
},
"husky": {
"hooks": {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"allowJs": false,
"lib": ["es2017"],
"lib": ["es2019"],
"jsx": "react",
"module": "commonjs",
"moduleResolution": "node",
Expand Down
Loading