Skip to content

Commit 2c6e55a

Browse files
authored
Upgrade prettier (#23)
1 parent bf7df41 commit 2c6e55a

15 files changed

+100
-84
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[{package.json,package-lock.json,.*rc,*.yml,*.yaml}]
11+
indent_style = space
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

index.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ const airtableBase = Airtable.base(airtableMetadata.baseId);
6060
// load the airtable data we'll need
6161
const airtableEvents = await getAirtableEvents(
6262
airtableBase,
63-
airtableMetadata.eventsId
63+
airtableMetadata.eventsId,
6464
);
6565
const airtableSpeakers = await getAirtableSpeakers(
6666
airtableBase,
67-
airtableMetadata.speakersId
67+
airtableMetadata.speakersId,
6868
);
6969
const airtableSponsors = await getAirtableSponsors(
7070
airtableBase,
71-
airtableMetadata.sponsorsId
71+
airtableMetadata.sponsorsId,
7272
);
7373

7474
console.log("gathering existing website data...");
@@ -84,7 +84,7 @@ const websiteSponsors = await getWebsiteSponsors(config.seattlejsProjectPath);
8484
// only used to prompt the user for which event they want to modify
8585
const eventMap = mapAirtableEventsToWebsiteEvents(
8686
airtableEvents,
87-
websiteEvents
87+
websiteEvents,
8888
);
8989

9090
const targetEvent = await getTargetEvent(eventMap);
@@ -95,19 +95,19 @@ if (!targetEvent.website) {
9595
const { newPhotos, updatedSpeakers } = reconcileSpeakers(
9696
targetEvent,
9797
airtableSpeakers,
98-
websiteSpeakers
98+
websiteSpeakers,
9999
);
100100

101101
const { updatedTalks, removedTalks } = reconcileTalks(
102102
targetEvent,
103103
airtableSpeakers,
104-
websiteTalks
104+
websiteTalks,
105105
);
106106

107107
const { newLogos, updatedSponsors } = reconcileSponsors(
108108
targetEvent,
109109
airtableSponsors,
110-
websiteSponsors
110+
websiteSponsors,
111111
);
112112

113113
reconcileEvents(targetEvent, websiteEvents);
@@ -116,14 +116,14 @@ const confirmation = await confirmUpdate(
116116
updatedSpeakers,
117117
updatedTalks,
118118
removedTalks,
119-
updatedSponsors
119+
updatedSponsors,
120120
);
121121
if (confirmation) {
122122
await exportData(websiteSpeakers, "speakers", config.seattlejsProjectPath);
123123
const existingPhotos = await exportImages(
124124
newPhotos,
125125
"speakers",
126-
config.seattlejsProjectPath
126+
config.seattlejsProjectPath,
127127
);
128128
await exportData(websiteTalks, "talks", config.seattlejsProjectPath);
129129

package-lock.json

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"eslint-plugin-promise": "^6.1.1",
4040
"lodash": "^4.17.21",
4141
"mocha": "^10.2.0",
42-
"prettier": "2.8.3",
42+
"prettier": "^3.0.0",
4343
"ts-node": "^10.9.1",
4444
"typescript": "^5.1.3"
4545
},

src/events.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import {
99
/** mutates the events json data to include any event updates */
1010
export const reconcileEvents = (
1111
event: WebsiteAirtablePair,
12-
websiteEvents: WebsiteEvent[]
12+
websiteEvents: WebsiteEvent[],
1313
): void => {
1414
const existingEventIndex = websiteEvents.findIndex(
15-
(webEvent) => webEvent.id == event.website.id
15+
(webEvent) => webEvent.id == event.website.id,
1616
);
1717
if (existingEventIndex > 0) {
1818
// the event exists, need to replace it with the updated one,
@@ -24,14 +24,14 @@ export const reconcileEvents = (
2424
};
2525

2626
export const makeWebsiteEvent = (
27-
airtableEvent: Record<FieldSet>
27+
airtableEvent: Record<FieldSet>,
2828
): WebsiteEvent => {
2929
const name = (airtableEvent.get("Name") as string) || "";
3030
const date = (airtableEvent.get("Date") as string) || "";
3131
const description = (airtableEvent.get("Description") as string) || "";
3232
const id = makeEventId(name);
3333
const link = (airtableEvent.get("Link") as string) || "";
34-
console.log("makeWebsiteEvent", {id, link});
34+
console.log("makeWebsiteEvent", { id, link });
3535
const event: WebsiteEvent = {
3636
id: id,
3737
link,
@@ -48,7 +48,7 @@ export const makeWebsiteEvent = (
4848
* and the value is an object with the corresponding airtable and website events */
4949
export const mapAirtableEventsToWebsiteEvents = (
5050
airtableEvents: Record<FieldSet>[],
51-
websiteEvents: WebsiteEvent[]
51+
websiteEvents: WebsiteEvent[],
5252
): WebsiteAirtableMap => {
5353
const result: WebsiteAirtableMap = {};
5454
for (const event of airtableEvents) {

src/normalizers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const getFileExtension = (fileName) => {
6262
};
6363

6464
export const normalizeTalkType = (
65-
talkType: string
65+
talkType: string,
6666
): "regular" | "lightning" => {
6767
if (talkType.toLowerCase().includes("regular")) {
6868
return "regular";
@@ -71,7 +71,7 @@ export const normalizeTalkType = (
7171
};
7272

7373
export const handleTalkTopics = (
74-
talkTopics: string | undefined | ""
74+
talkTopics: string | undefined | "",
7575
): string[] => {
7676
if (talkTopics === "") {
7777
return [];

src/repos/airtable-metadata.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ const getSeattleJsBaseId = async (token: string): Promise<string> => {
5454
};
5555

5656
export const getAirtableMetadata = async (
57-
token: string
57+
token: string,
5858
): Promise<AirtableMetadata> => {
5959
const baseId = await getSeattleJsBaseId(token);
6060
const tables = await getAirtableTables(baseId, token);
6161
const eventsTable = tables.find((table) => table.name === EVENTS_TABLE_NAME);
6262
const speakersTable = tables.find(
63-
(table) => table.name === SPEAKERS_TABLE_NAME
63+
(table) => table.name === SPEAKERS_TABLE_NAME,
6464
);
6565
const sponsorsTable = tables.find(
66-
(table) => table.name === SPONSORS_TABLE_NAME
66+
(table) => table.name === SPONSORS_TABLE_NAME,
6767
);
6868
const ids: AirtableMetadata = {
6969
baseId: baseId,

src/repos/user-input.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const getDateMonthsInFuture = (monthsInFuture: number): Date => {
2727
};
2828

2929
export const getTargetEvent = async (
30-
events: WebsiteAirtableMap
30+
events: WebsiteAirtableMap,
3131
): Promise<WebsiteAirtablePair> => {
3232
// reduce number of events to limit, taking most recent
3333
const someMonthsAgo = getDateMonthsAgo(MONTHS_PRIOR_LIMIT);
@@ -57,14 +57,14 @@ export const confirmUpdate = async (
5757
updatedSpeakers: WebsiteSpeaker[],
5858
updatedTalks: WebsiteTalk[],
5959
removedTalks: string[],
60-
updatedSponsors: WebsiteSponsor[]
60+
updatedSponsors: WebsiteSponsor[],
6161
): Promise<boolean> => {
6262
const confirmMessage = [
6363
"Confirm update:\n",
6464
`${updatedTalks.length} new talks\n`,
65-
`${removedTalks.length} removed talks ${ removedTalks.length ? `(${removedTalks})` : ''}\n`,
65+
`${removedTalks.length} removed talks ${removedTalks.length ? `(${removedTalks})` : ""}\n`,
6666
`${updatedSponsors.length} new sponsors\n`,
67-
`${updatedSpeakers.length} new speakers\n`
67+
`${updatedSpeakers.length} new speakers\n`,
6868
];
6969
const res = await prompts({
7070
type: "confirm",
@@ -109,7 +109,7 @@ export const promptForApiToken = async (retries = 1): Promise<string> => {
109109
};
110110

111111
export const promptForSeattlejsProjectPath = async (
112-
retries = 1
112+
retries = 1,
113113
): Promise<string> => {
114114
while (retries >= 0) {
115115
retries--;
@@ -124,6 +124,6 @@ export const promptForSeattlejsProjectPath = async (
124124
}
125125
}
126126
throw new Error(
127-
"please provide a path to a valid seattlejs.com repo or fork"
127+
"please provide a path to a valid seattlejs.com repo or fork",
128128
);
129129
};

src/repos/website.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const JSON_FILES = {
2323
};
2424

2525
export const validateSeattleJsProjectPath = async (
26-
projectPath: string
26+
projectPath: string,
2727
): Promise<boolean> => {
2828
for (const [type, file] of Object.entries(JSON_FILES)) {
2929
const fullPath = path.join(projectPath, file);
@@ -40,23 +40,23 @@ const parseJSONFile = async (filePath: string): Promise<any> => {
4040
};
4141

4242
export const getWebsiteEvents = async (
43-
projectPath: string
43+
projectPath: string,
4444
): Promise<WebsiteEvent[]> => {
4545
return parseJSONFile(path.join(projectPath, JSON_FILES["events"]));
4646
};
4747

4848
export const getWebsiteSpeakers = async (
49-
projectPath: string
49+
projectPath: string,
5050
): Promise<WebsiteSpeaker[]> => {
5151
return parseJSONFile(path.join(projectPath, JSON_FILES["speakers"]));
5252
};
5353
export const getWebsiteTalks = async (
54-
projectPath: string
54+
projectPath: string,
5555
): Promise<WebsiteTalk[]> => {
5656
return parseJSONFile(path.join(projectPath, JSON_FILES["talks"]));
5757
};
5858
export const getWebsiteSponsors = async (
59-
projectPath: string
59+
projectPath: string,
6060
): Promise<WebsiteSponsor[]> => {
6161
return parseJSONFile(path.join(projectPath, JSON_FILES["sponsors"]));
6262
};
@@ -84,7 +84,7 @@ export const exportImages = async (imageObjects, type, projectPath) => {
8484
const filePath = path.join(
8585
projectPath,
8686
IMAGE_DIRS[type],
87-
imageObj.filename
87+
imageObj.filename,
8888
);
8989
const imageExists = await exists(filePath);
9090
if (!imageExists) {

src/speakers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
export const reconcileSpeakers = (
1717
event: WebsiteAirtablePair,
1818
airtableSpeakers: Record<FieldSet>[],
19-
websiteSpeakers: WebsiteSpeaker[]
19+
websiteSpeakers: WebsiteSpeaker[],
2020
): {
2121
updatedSpeakers: WebsiteSpeaker[];
2222
newPhotos: AirtablePhoto[];
@@ -26,7 +26,7 @@ export const reconcileSpeakers = (
2626
// get the speakers for the passed event
2727
const airtableEventSpeakers = getEventSpeakers(
2828
event.airtable,
29-
airtableSpeakers
29+
airtableSpeakers,
3030
);
3131
for (const speaker of airtableEventSpeakers) {
3232
// make speaker object and get photo uri
@@ -49,7 +49,7 @@ export const reconcileSpeakers = (
4949

5050
/** make a website speaker from an airtable speaker */
5151
const makeWebsiteSpeaker = (
52-
airtableSpeaker: Record<FieldSet>
52+
airtableSpeaker: Record<FieldSet>,
5353
): { speaker: WebsiteSpeaker; speakerPhoto: AirtablePhoto } => {
5454
const speaker = {} as WebsiteSpeaker;
5555
const name = airtableSpeaker.get("Full Name");
@@ -79,7 +79,7 @@ const makeWebsiteSpeaker = (
7979
*/
8080
export const getEventSpeakers = (
8181
airtableEvent,
82-
airtableSpeakers
82+
airtableSpeakers,
8383
): Record<FieldSet>[] => {
8484
const speakerRecords = [];
8585
const speakerIds = (airtableEvent.get("Speakers") as string[]) || [];

0 commit comments

Comments
 (0)