Skip to content

Commit 12be429

Browse files
committed
linted
1 parent 1dd513f commit 12be429

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getGithubUsersFromGoogle } from './src/google'
22
import { getGithubUsersFromGithub, addUsersToGitHubOrg, removeUsersToGitHubOrg } from './src/github'
33

4-
export async function run() {
4+
export async function run(): Promise<void> {
55
const googleUsers = await getGithubUsersFromGoogle()
66
console.log(`Users from google: ${Array.from(googleUsers).join(', ')}`)
77

src/github.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const ignoredUsers = process.env.IGNORED_USERS.toLowerCase().split(',')
44

55
const octokit = getAuthenticatedOctokit()
66

7+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
78
export function getAuthenticatedOctokit() {
89
return new Octokit({
910
authStrategy: createAppAuth,
@@ -15,7 +16,7 @@ export function getAuthenticatedOctokit() {
1516
})
1617
}
1718

18-
export async function getGithubUsersFromGithub() {
19+
export async function getGithubUsersFromGithub(): Set<string> {
1920
const members = await octokit.paginate(octokit.orgs.listMembers, {
2021
org: process.env.GITHUB_ORG,
2122
})
@@ -33,11 +34,12 @@ export async function getGithubUsersFromGithub() {
3334
return new Set([...githubAccounts, ...pendingGithubAccounts])
3435
}
3536

37+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
3638
export function formatUserList(users): Set<string> {
3739
return new Set(users.map((user) => user.login.toLowerCase()))
3840
}
3941

40-
export async function getUserIdFromUsername(username: string) {
42+
export async function getUserIdFromUsername(username: string): Promise<number> {
4143
console.log(`Looking up user ${username}`)
4244
let user
4345
try {
@@ -49,13 +51,13 @@ export async function getUserIdFromUsername(username: string) {
4951
return user.data.id
5052
}
5153

52-
export async function addUsersToGitHubOrg(users: Set<string>) {
54+
export async function addUsersToGitHubOrg(users: Set<string>): Promise<void> {
5355
for (const user of users) {
5456
await addUserToGitHubOrg(user)
5557
}
5658
}
5759

58-
export async function addUserToGitHubOrg(user: string) {
60+
export async function addUserToGitHubOrg(user: string): Promise<void> {
5961
if (ignoredUsers.includes(user.toLowerCase())) {
6062
console.log(`Ignoring add for ${user}`)
6163
return false
@@ -69,12 +71,13 @@ export async function addUserToGitHubOrg(user: string) {
6971
console.log(`Invitation sent to ${user} (${userId} to ${process.env.GITHUB_ORG})`)
7072
}
7173

72-
export async function removeUsersToGitHubOrg(users: Set<string>) {
74+
export async function removeUsersToGitHubOrg(users: Set<string>): Promise<void> {
7375
for (const user of users) {
7476
await removeUserToGitHubOrg(user)
7577
}
7678
}
7779

80+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
7881
export async function removeUserToGitHubOrg(user: string) {
7982
if (ignoredUsers.includes(user.toLowerCase())) {
8083
console.log(`Ignoring remove for ${user}`)

src/google.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
const { google } = require('googleapis')
1+
import { google } from 'googleapis'
22

33
const privatekey = JSON.parse(Buffer.from(process.env.GOOGLE_CREDENTIALS, 'base64').toString('utf-8'))
44

5-
export const googleAuth = async () => {
5+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
6+
export async function googleAuth() {
67
const jwtClient = new google.auth.JWT(
78
privatekey.client_email,
89
null,
@@ -14,14 +15,15 @@ export const googleAuth = async () => {
1415
return jwtClient
1516
}
1617

18+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1719
export async function getAdminService() {
1820
return google.admin({
1921
version: 'directory_v1',
2022
auth: await googleAuth(),
2123
})
2224
}
2325

24-
export async function getGithubUsersFromGoogle() {
26+
export async function getGithubUsersFromGoogle(): Set<string> {
2527
const service = await getAdminService()
2628

2729
const userList: {

0 commit comments

Comments
 (0)