Skip to content

Commit

Permalink
chore: eslint --fix (#1627)
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel authored Feb 7, 2024
1 parent 0c25c25 commit 87af2e9
Show file tree
Hide file tree
Showing 26 changed files with 132 additions and 124 deletions.
6 changes: 4 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
],
"rules": {
"no-console": 1, // Means warning
"prettier/prettier": 2 // Means error
"prettier/prettier": 2,

"@typescript-eslint/no-inferrable-types": "off"
}
}
}
8 changes: 7 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
"semi": true,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 160
"printWidth": 160,
"arrowParens": "always",
"bracketSpacing": true,
"bracketSameLine": false,
"useTabs": false,
"quoteProps": "as-needed",
"tabWidth": 4
}
4 changes: 2 additions & 2 deletions integration-templates/asana/asana-tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function fetchData(nango: NangoSync) {
};
const tasks = await paginate(nango, '/api/1.0/tasks', filters);
let mappedTasks: AsanaTask[] = [];
for (let task of tasks) {
for (const task of tasks) {
mappedTasks.push({
id: task.gid,
project_id: project.gid,
Expand All @@ -38,7 +38,7 @@ async function paginate(nango: NangoSync, endpoint: string, queryParams?: Record
const MAX_PAGE = 100;
let results: any[] = [];
let page = null;
let callParams = queryParams || {};
const callParams = queryParams || {};
while (true) {
if (page) {
callParams['offset'] = `${page}`;
Expand Down
4 changes: 2 additions & 2 deletions integration-templates/evaluagent/evaluagent-users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ interface EvaluAgentUserResponse {
}

export default async function fetchData(nango: NangoSync) {
let payload = {
const payload = {
endpoint: '/v1/org/users'
};

const response = await nango.get(payload);

let returnedData = response.data.data;
const returnedData = response.data.data;

const mappedUsers: EvaluAgentUser[] = returnedData.map((user: EvaluAgentUserResponse) => ({
id: user.id,
Expand Down
2 changes: 1 addition & 1 deletion integration-templates/github/github-write-file-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async function runAction(nango: NangoSync, input: FileActionInput

await nango.log(fileSha ? 'File exists, updating.' : 'File does not exist, creating new file.');

let resp = await nango.proxy({
const resp = await nango.proxy({
method: 'PUT',
endpoint: endpoint,
data: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default async function fetchData(nango: NangoSync) {
};
const users = await paginate(nango, '/admin/directory/v1/users', 'users', params);

for (let user of users) {
for (const user of users) {
// Get the access tokens
const tokens = await paginate(nango, `/admin/directory/v1/users/${user.id}/tokens`, 'items');
const mappedTokens: GoogleWorkspaceUserToken[] = tokens.map((token) => ({
Expand All @@ -26,7 +26,7 @@ async function paginate(nango: NangoSync, endpoint: string, resultsKey: string,
const MAX_PAGE = 100;
let results: any[] = [];
let page = null;
let callParams = queryParams || {};
const callParams = queryParams || {};
while (true) {
if (page) {
callParams['pageToken'] = `${page}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import type { NangoAction, HackerRankWorkInterview } from './models';

interface CandidateInformation {
name: String;
email: String;
name: string;
email: string;
}
interface HackerRankWorkCreateInterviewInput {
from: Date;
to: Date;
title: String;
notes: String;
resume_url: String;
interviewers: String[];
result_url: String;
title: string;
notes: string;
resume_url: string;
interviewers: string[];
result_url: string;
candidate: CandidateInformation;
send_email: Boolean;
interview_metadata: Object;
send_email: boolean;
interview_metadata: Record<string, any>;
}

const mapInputToPostData = (input: HackerRankWorkCreateInterviewInput): Record<string, any> => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import type { NangoAction, HackerRankWorkTest } from './models';

interface HackerRankWorkCreateTestInput {
name: String;
name: string;
starttime: Date;
endtime: Date;
duration: Number;
instructions: String;
locked: Boolean;
draft: String;
languages: String[];
candidate_details: String[];
custom_acknowledge_text: String;
cutoff_score: Number;
master_password: String;
hide_compile_test: Boolean;
tags: String[];
role_ids: String[];
experience: String[];
questions: String[];
mcq_incorrect_score: Number;
mcq_correct_score: Number;
secure: Boolean;
shuffle_questions: Boolean;
test_admins: String[];
hide_template: Boolean;
enable_acknowledgement: Boolean;
enable_proctoring: Boolean;
candidate_tab_switch: Boolean;
track_editor_paste: Boolean;
show_copy_paste_prompt: Boolean;
ide_config: String;
duration: number;
instructions: string;
locked: boolean;
draft: string;
languages: string[];
candidate_details: string[];
custom_acknowledge_text: string;
cutoff_score: number;
master_password: string;
hide_compile_test: boolean;
tags: string[];
role_ids: string[];
experience: string[];
questions: string[];
mcq_incorrect_score: number;
mcq_correct_score: number;
secure: boolean;
shuffle_questions: boolean;
test_admins: string[];
hide_template: boolean;
enable_acknowledgement: boolean;
enable_proctoring: boolean;
candidate_tab_switch: boolean;
track_editor_paste: boolean;
show_copy_paste_prompt: boolean;
ide_config: string;
}

const mapInputToPostData = (input: HackerRankWorkCreateTestInput): Record<string, any> => {
Expand Down
6 changes: 3 additions & 3 deletions integration-templates/intercom/intercom-contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async function fetchData(nango: NangoSync) {
while (!finished) {
// This API endpoint has an annoying bug: If you pass "starting_after" with no value you get a 500 server error
// Because of this we only set it here when we are fetching page >= 2, otherwise we don't pass it.
let queryParams: Record<string, string> = {
const queryParams: Record<string, string> = {
per_page: '150'
};

Expand All @@ -28,8 +28,8 @@ export default async function fetchData(nango: NangoSync) {
params: queryParams
});

let contacts: any[] = resp.data.data;
let mappedContacts: IntercomContact[] = contacts.map((contact) => ({
const contacts: any[] = resp.data.data;
const mappedContacts: IntercomContact[] = contacts.map((contact) => ({
id: contact.id,
workspace_id: contact.workspace_id,
external_id: contact.external_id,
Expand Down
10 changes: 5 additions & 5 deletions integration-templates/intercom/intercom-conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default async function fetchData(nango: NangoSync) {
while (!finished) {
// This API endpoint has an annoying bug: If you pass "starting_after" with no value you get a 500 server error
// Because of this we only set it here when we are fetching page >= 2, otherwise we don't pass it.
let queryParams: Record<string, string> = {
const queryParams: Record<string, string> = {
per_page: '150'
};

Expand All @@ -53,9 +53,9 @@ export default async function fetchData(nango: NangoSync) {

// Let's iterate over the received conversations
// Then get the details for each.
let intercomConversationsPage: IntercomConversation[] = [];
let intercomMessagesPage: IntercomConversationMessage[] = [];
for (let conversation of resp.data.conversations) {
const intercomConversationsPage: IntercomConversation[] = [];
const intercomMessagesPage: IntercomConversationMessage[] = [];
for (const conversation of resp.data.conversations) {
// For incremential syncs: Skip conversations that have not been updated since we last synced
// updated_at is a unix timestamp of the last change to the conversation (e.g. new message from customer, attribute changed)
if (conversation.updated_at < lastSyncDateTimestamp) {
Expand Down Expand Up @@ -109,7 +109,7 @@ export default async function fetchData(nango: NangoSync) {
}
});

for (let conversationPart of conversationResp.data.conversation_parts.conversation_parts) {
for (const conversationPart of conversationResp.data.conversation_parts.conversation_parts) {
// Conversation parts can be messages, notes etc. but also actions, such as "closed conversation", "assigned conversation" etc.
// We only care about the conversation parts where admins and users send a message.
// For a full list of possible part types see here: https://developers.intercom.com/intercom-api-reference/reference/the-conversation-model#conversation-part-types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default async function fetchData(nango: NangoSync) {
const baseEndpoint = '/v1.0/groups';

for (const orgId of orgsToSync) {
let endpoint = `${baseEndpoint}/${orgId}/transitiveMembers?$top=500`;
const endpoint = `${baseEndpoint}/${orgId}/transitiveMembers?$top=500`;

await nango.log(`Fetching users for org ID: ${orgId}`);
await fetchAndUpdateUsers(nango, endpoint);
Expand Down
4 changes: 2 additions & 2 deletions integration-templates/notion/notion-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default async function fetchData(nango: NangoSync) {

for (let i = 0; i < pages.length; i += batchSize) {
await nango.log(`Fetching plain text, in batch of ${batchSize} Notion pages, from page ${i + 1} (total pages: ${pages.length})`);
let batchOfPages = pages.slice(i, Math.min(pages.length, i + batchSize));
let pagesWithPlainText = await Promise.all(batchOfPages.map(async (page: any) => mapPage(page, await fetchPlainText(page, nango))));
const batchOfPages = pages.slice(i, Math.min(pages.length, i + batchSize));
const pagesWithPlainText = await Promise.all(batchOfPages.map(async (page: any) => mapPage(page, await fetchPlainText(page, nango))));
await nango.batchSave(pagesWithPlainText, 'NotionPage');
}
}
Expand Down
6 changes: 3 additions & 3 deletions integration-templates/slack/slack-channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { SlackChannel, NangoSync } from './models';
export default async function fetchData(nango: NangoSync) {
const responses = await getAllPages(nango, 'conversations.list');

let metadata = (await nango.getMetadata()) || {};
const metadata = (await nango.getMetadata()) || {};

const mappedChannels: SlackChannel[] = responses.map((record: any) => {
return {
Expand Down Expand Up @@ -57,8 +57,8 @@ async function joinPublicChannels(nango: NangoSync, channels: SlackChannel[]) {
}

async function getAllPages(nango: NangoSync, endpoint: string) {
var nextCursor = 'x';
var responses: any[] = [];
let nextCursor = 'x';
let responses: any[] = [];

while (nextCursor !== '') {
const response = await nango.get({
Expand Down
10 changes: 5 additions & 5 deletions integration-templates/slack/slack-messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default async function fetchData(nango: NangoSync) {
let batchMessageReply: SlackMessageReply[] = [];

let metadata = (await nango.getMetadata()) || {};
let channelsLastSyncDate = (metadata['channelsLastSyncDate'] as Record<string, string>) || {};
let unseenChannels = Object.keys(channelsLastSyncDate);
const channelsLastSyncDate = (metadata['channelsLastSyncDate'] as Record<string, string>) || {};
const unseenChannels = Object.keys(channelsLastSyncDate);

const channelsRequestConfig = {
endpoint: 'users.conversations',
Expand Down Expand Up @@ -156,10 +156,10 @@ export default async function fetchData(nango: NangoSync) {
}

async function saveReactions(nango: NangoSync, currentChannelId: string, message: any) {
let batchReactions: SlackMessageReaction[] = [];
const batchReactions: SlackMessageReaction[] = [];

for (let reaction of message.reactions) {
for (let user of reaction.users) {
for (const reaction of message.reactions) {
for (const user of reaction.users) {
const mappedReaction: SlackMessageReaction = {
id: createHash('sha256').update(`${message.ts}${reaction.name}${currentChannelId}${user}`).digest('hex'),
message_ts: message.ts,
Expand Down
2 changes: 1 addition & 1 deletion integration-templates/wildix-pbx/wildix-pbx-colleagues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default async function fetchData(nango: NangoSync) {

// https://docs.wildix.com/wms/index.html#tag/Colleagues
while (true) {
let payload = {
const payload = {
baseUrlOverride: `https://${connection.connection_config['subdomain']}.wildixin.com`,
endpoint: '/api/v1/Colleagues/',
params: <Params>{
Expand Down
Loading

0 comments on commit 87af2e9

Please sign in to comment.