-
-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: format build scripts using eslint #3401
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const { resolve } = require('path'); | ||
const writeJSON = require('../utils/readAndWriteJson.js') | ||
const writeJSON = require('../utils/readAndWriteJson.js'); | ||
|
||
module.exports = async function buildAdoptersList() { | ||
writeJSON('config/adopters.yml',resolve(__dirname, '../../config', 'adopters.json')); | ||
writeJSON('config/adopters.yml', resolve(__dirname, '../../config', 'adopters.json')); | ||
}; |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,31 +9,26 @@ async function buildMeetings(writePath) { | |||||||||
try { | ||||||||||
auth = new google.auth.GoogleAuth({ | ||||||||||
scopes: ['https://www.googleapis.com/auth/calendar'], | ||||||||||
credentials: process.env.CALENDAR_SERVICE_ACCOUNT ? JSON.parse(process.env.CALENDAR_SERVICE_ACCOUNT) : undefined, | ||||||||||
credentials: process.env.CALENDAR_SERVICE_ACCOUNT ? JSON.parse(process.env.CALENDAR_SERVICE_ACCOUNT) : undefined | ||||||||||
}); | ||||||||||
|
||||||||||
calendar = google.calendar({ version: 'v3', auth }); | ||||||||||
|
||||||||||
} catch (err) { | ||||||||||
throw new Error(`Authentication failed: ${err.message}`); | ||||||||||
} | ||||||||||
|
||||||||||
let eventsItems; | ||||||||||
|
||||||||||
try { | ||||||||||
//cron job runs this always on midnight | ||||||||||
// cron job runs this always on midnight | ||||||||||
const currentTime = new Date(Date.now()).toISOString(); | ||||||||||
const timeMin = new Date( | ||||||||||
Date.parse(currentTime) - 100 * 24 * 60 * 60 * 1000 | ||||||||||
).toISOString(); | ||||||||||
const timeMax = new Date( | ||||||||||
Date.parse(currentTime) + 30 * 24 * 60 * 60 * 1000 | ||||||||||
).toISOString(); | ||||||||||
const timeMin = new Date(Date.parse(currentTime) - 100 * 24 * 60 * 60 * 1000).toISOString(); | ||||||||||
const timeMax = new Date(Date.parse(currentTime) + 30 * 24 * 60 * 60 * 1000).toISOString(); | ||||||||||
|
||||||||||
const eventsList = await calendar.events.list({ | ||||||||||
calendarId: process.env.CALENDAR_ID, | ||||||||||
timeMax: timeMax, | ||||||||||
timeMin: timeMin, | ||||||||||
timeMax, | ||||||||||
timeMin | ||||||||||
}); | ||||||||||
|
||||||||||
eventsItems = eventsList.data.items.map((e) => { | ||||||||||
|
@@ -43,17 +38,15 @@ async function buildMeetings(writePath) { | |||||||||
url: | ||||||||||
e.extendedProperties?.private && | ||||||||||
`https://github.com/asyncapi/community/issues/${e.extendedProperties.private.ISSUE_ID}`, | ||||||||||
banner: | ||||||||||
e.extendedProperties?.private && e.extendedProperties.private.BANNER, | ||||||||||
date: new Date(e.start.dateTime), | ||||||||||
banner: e.extendedProperties?.private && e.extendedProperties.private.BANNER, | ||||||||||
date: new Date(e.start.dateTime) | ||||||||||
Comment on lines
+41
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add consistent optional chaining to prevent potential runtime errors. The optional chaining is used inconsistently. While - banner: e.extendedProperties?.private && e.extendedProperties.private.BANNER,
+ banner: e.extendedProperties?.private?.BANNER, 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome[error] 41-41: Change to an optional chain. Unsafe fix: Change to an optional chain. (lint/complexity/useOptionalChain) |
||||||||||
}; | ||||||||||
}); | ||||||||||
|
||||||||||
const eventsForHuman = JSON.stringify(eventsItems, null, ' '); | ||||||||||
console.log('The following events got fetched', eventsForHuman); | ||||||||||
|
||||||||||
writeFileSync(writePath, eventsForHuman); | ||||||||||
|
||||||||||
} catch (err) { | ||||||||||
throw new Error(`Failed to fetch or process events: ${err.message}`); | ||||||||||
} | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use strict equality comparison
Replace loose equality (==) with strict equality (===) for more reliable comparisons.
📝 Committable suggestion
🧰 Tools
🪛 eslint
[error] 134-134: Expected '===' and instead saw '=='.
(eqeqeq)
[error] 135-135: Expected '===' and instead saw '=='.
(eqeqeq)