Skip to content

Commit

Permalink
feat: @krauters/eslint-config
Browse files Browse the repository at this point in the history
  • Loading branch information
coltenkrauter committed Sep 6, 2024
1 parent d9f1b92 commit 898697b
Show file tree
Hide file tree
Showing 14 changed files with 3,374 additions and 99 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Dependencies
run: npm ci
- name: Run tests
run: npm run test
test-action:
runs-on: ubuntu-latest
steps:
Expand Down
19 changes: 13 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37661,7 +37661,7 @@ var core = __nccwpck_require__(2186);
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
var github = __nccwpck_require__(5438);
;// CONCATENATED MODULE: ./package.json
const package_namespaceObject = JSON.parse('{"u2":"@krauters/github-notifier","i8":"0.10.0","Xh":"https://github.com/krauters/github-notifier"}');
const package_namespaceObject = JSON.parse('{"u2":"@krauters/github-notifier","i8":"0.11.0","Xh":"https://github.com/krauters/github-notifier"}');
;// CONCATENATED MODULE: ./src/defaults.ts
const scmUrl = 'https://github.com';
const prBaseUrl = `${scmUrl}/pulls?q=is%3Aopen+is%3Apr+archived%3Afalse+draft%3Afalse+user%3A`;
Expand Down Expand Up @@ -37744,6 +37744,7 @@ function* generateBatches(items, size = 50) {
yield items.slice(i, i + size);
}
}
// Todo - Move this to shared utils.
const snapActions = {
[SnapType.Day]: (date) => {
date.setHours(0, 0, 0, 0);
Expand Down Expand Up @@ -41463,6 +41464,7 @@ var PullState;
})(PullState || (PullState = {}));

;// CONCATENATED MODULE: ./src/utils/github/github-client.ts
/* eslint-disable @typescript-eslint/naming-convention */



Expand Down Expand Up @@ -41574,10 +41576,12 @@ class GitHubClient {
};
}
const minutesUntilMerged = minutesBetweenDates(pull.createdAt, pull.mergedAt);
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
minutesUntilMerged && report[key].minutesUntilMerged.push(minutesUntilMerged / 60);
const minutesUntilFirstReview = firstReview
? minutesBetweenDates(pull.createdAt, new Date(String(firstReview.submitted_at)))
: undefined;
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
minutesUntilFirstReview && report[key].minutesUntilFirstReview.push(minutesUntilFirstReview / 60);
}
let reportString = 'GitHub Notifier Pull Report (Averages)\n';
Expand Down Expand Up @@ -41921,6 +41925,7 @@ function getContextMarkdownBlock(text, withIndentation = false) {
* @param {boolean} withUserMentions - Whether or not to mention Slack users.
* @returns {Promise<KnownBlock[]>}
*/
// eslint-disable-next-line max-lines-per-function
async function getPullBlocks(pull, slack, withUserMentions) {
const { age, ageInHours, commits, draft, filesAndChanges, number, repo, repoUrl, requestedReviewers, reviewReport, title, url, } = pull;
let ageBasedEmoji = getAgeBasedEmoji(ageInHours);
Expand Down Expand Up @@ -41975,6 +41980,7 @@ async function getPullBlocks(pull, slack, withUserMentions) {
const slackUserIdsOrLogins = [];
for (const username of requestedReviewers) {
const slackUser = await slack.getSlackUser({ username });
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
slackUserIdsOrLogins.push((withUserMentions && slackUser?.id && `<@${slackUser.id}>`) || username);
}
contextBlocks.unshift(...getContextMarkdownBlock(formatStringList(slackUserIdsOrLogins) +
Expand Down Expand Up @@ -42147,7 +42153,10 @@ class SlackClient {
return user?.id === userId;
}
const profile = user.profile;
return ((email && profile?.email === email) ||
return (
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
(email && profile?.email === email) ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
String(profile?.email).includes(username) ||
profile?.display_name === username ||
profile?.real_name === username);
Expand Down Expand Up @@ -42189,9 +42198,7 @@ class SlackClient {
;// CONCATENATED MODULE: ./src/utils/test-data.ts


/**
* Get approved pull request as test data.
*/
// eslint-disable-next-line jsdoc/require-jsdoc
function getApprovedPullRequest() {
console.log(`Getting test data for user [${github.context.actor}]`);
return {
Expand Down Expand Up @@ -42317,7 +42324,7 @@ async function main() {
const withArchived = (0,core.getBooleanInput)('with-archived');
const withPublic = (0,core.getBooleanInput)('with-public');
const withDrafts = (0,core.getBooleanInput)('with-drafts');
const withPullReport = false; // Not an active feature yet
const withPullReport = false;
const withUserMentions = (0,core.getBooleanInput)('with-user-mentions');
const repositoryFilter = stringToArray((0,core.getInput)('repository-filter'));
// https://github.com/actions/github-script/issues/436
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import eslintConfig from '@krauters/eslint-config'

export default eslintConfig
Loading

0 comments on commit 898697b

Please sign in to comment.