diff --git a/server/__mocks__/events.js b/server/__mocks__/events.js index 5879cb896d..e54b5ff073 100644 --- a/server/__mocks__/events.js +++ b/server/__mocks__/events.js @@ -1,4 +1,3 @@ -// @flow export default { - add: () => {}, + add: () => { }, }; diff --git a/server/api/apiKeys.js b/server/api/apiKeys.ts similarity index 99% rename from server/api/apiKeys.js rename to server/api/apiKeys.ts index a138f236f6..65935d496b 100644 --- a/server/api/apiKeys.js +++ b/server/api/apiKeys.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import auth from "../middlewares/authentication"; diff --git a/server/api/attachments.test.js b/server/api/attachments.test.ts similarity index 100% rename from server/api/attachments.test.js rename to server/api/attachments.test.ts diff --git a/server/api/attachments.js b/server/api/attachments.ts similarity index 99% rename from server/api/attachments.js rename to server/api/attachments.ts index a2d34d5471..297b8d7efe 100644 --- a/server/api/attachments.js +++ b/server/api/attachments.ts @@ -1,4 +1,3 @@ -// @flow import format from "date-fns/format"; import Router from "koa-router"; import uuid from "uuid"; diff --git a/server/api/auth.js b/server/api/auth.ts similarity index 99% rename from server/api/auth.js rename to server/api/auth.ts index 53a61e57c2..ebc40b4a47 100644 --- a/server/api/auth.js +++ b/server/api/auth.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import { reject } from "lodash"; import { parseDomain, isCustomSubdomain } from "../../shared/utils/domains"; diff --git a/server/api/collections.test.js b/server/api/collections.test.ts similarity index 100% rename from server/api/collections.test.js rename to server/api/collections.test.ts diff --git a/server/api/collections.js b/server/api/collections.ts similarity index 99% rename from server/api/collections.js rename to server/api/collections.ts index 740d234901..b7d6363a45 100644 --- a/server/api/collections.js +++ b/server/api/collections.ts @@ -1,4 +1,3 @@ -// @flow import fs from "fs"; import Router from "koa-router"; import { ValidationError } from "../errors"; diff --git a/server/api/documents.test.js b/server/api/documents.test.ts similarity index 100% rename from server/api/documents.test.js rename to server/api/documents.test.ts diff --git a/server/api/documents.js b/server/api/documents.ts similarity index 99% rename from server/api/documents.js rename to server/api/documents.ts index cc771f210b..059221244e 100644 --- a/server/api/documents.js +++ b/server/api/documents.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import Sequelize from "sequelize"; import { subtractDate } from "../../shared/utils/date"; diff --git a/server/api/events.test.js b/server/api/events.test.ts similarity index 100% rename from server/api/events.test.js rename to server/api/events.test.ts diff --git a/server/api/events.js b/server/api/events.ts similarity index 99% rename from server/api/events.js rename to server/api/events.ts index ce39db5644..a2a46b4262 100644 --- a/server/api/events.js +++ b/server/api/events.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import Sequelize from "sequelize"; import auth from "../middlewares/authentication"; diff --git a/server/api/groups.test.js b/server/api/groups.test.ts similarity index 100% rename from server/api/groups.test.js rename to server/api/groups.test.ts diff --git a/server/api/groups.js b/server/api/groups.ts similarity index 99% rename from server/api/groups.js rename to server/api/groups.ts index f7d6c721b7..067c9fe71a 100644 --- a/server/api/groups.js +++ b/server/api/groups.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import { MAX_AVATAR_DISPLAY } from "../../shared/constants"; import auth from "../middlewares/authentication"; diff --git a/server/api/hooks.test.js b/server/api/hooks.test.ts similarity index 100% rename from server/api/hooks.test.js rename to server/api/hooks.test.ts diff --git a/server/api/hooks.js b/server/api/hooks.ts similarity index 99% rename from server/api/hooks.js rename to server/api/hooks.ts index 6fd1e2f64f..8bee947da5 100644 --- a/server/api/hooks.js +++ b/server/api/hooks.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import { escapeRegExp } from "lodash"; import { AuthenticationError, InvalidRequestError } from "../errors"; diff --git a/server/api/index.test.js b/server/api/index.test.ts similarity index 100% rename from server/api/index.test.js rename to server/api/index.test.ts diff --git a/server/api/index.js b/server/api/index.ts similarity index 99% rename from server/api/index.js rename to server/api/index.ts index 1b273afaf2..62ff68914c 100644 --- a/server/api/index.js +++ b/server/api/index.ts @@ -1,4 +1,3 @@ -// @flow import Koa from "koa"; import bodyParser from "koa-body"; import Router from "koa-router"; diff --git a/server/api/integrations.js b/server/api/integrations.ts similarity index 99% rename from server/api/integrations.js rename to server/api/integrations.ts index 5814cc1526..725721304e 100644 --- a/server/api/integrations.js +++ b/server/api/integrations.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import auth from "../middlewares/authentication"; import { Event } from "../models"; diff --git a/server/api/middlewares/apiWrapper.js b/server/api/middlewares/apiWrapper.ts similarity index 85% rename from server/api/middlewares/apiWrapper.js rename to server/api/middlewares/apiWrapper.ts index 1403edd31b..7640a264e9 100644 --- a/server/api/middlewares/apiWrapper.js +++ b/server/api/middlewares/apiWrapper.ts @@ -1,11 +1,10 @@ -// @flow import stream from "stream"; -import { type Context } from "koa"; +import { Context } from "koa"; export default function apiWrapper() { return async function apiWrapperMiddleware( ctx: Context, - next: () => Promise<*> + next: (() => Promise) ) { await next(); diff --git a/server/api/middlewares/editor.js b/server/api/middlewares/editor.ts similarity index 86% rename from server/api/middlewares/editor.js rename to server/api/middlewares/editor.ts index 9b757d5539..44c6127cff 100644 --- a/server/api/middlewares/editor.js +++ b/server/api/middlewares/editor.ts @@ -1,11 +1,10 @@ -// @flow -import { type Context } from "koa"; +import { Context } from "koa"; import pkg from "rich-markdown-editor/package.json"; import semver from "semver"; import { EditorUpdateError } from "../../errors"; export default function editor() { - return async function editorMiddleware(ctx: Context, next: () => Promise<*>) { + return async function editorMiddleware(ctx: Context, next: (() => Promise)) { const clientVersion = ctx.headers["x-editor-version"]; // If the editor version on the client is behind the current version being diff --git a/server/api/middlewares/pagination.test.js b/server/api/middlewares/pagination.test.ts similarity index 100% rename from server/api/middlewares/pagination.test.js rename to server/api/middlewares/pagination.test.ts diff --git a/server/api/middlewares/pagination.js b/server/api/middlewares/pagination.ts similarity index 96% rename from server/api/middlewares/pagination.js rename to server/api/middlewares/pagination.ts index d44748e55e..c26dadbeeb 100644 --- a/server/api/middlewares/pagination.js +++ b/server/api/middlewares/pagination.ts @@ -1,12 +1,11 @@ -// @flow import querystring from "querystring"; -import { type Context } from "koa"; +import { Context } from "koa"; import { InvalidRequestError } from "../../errors"; export default function pagination(options?: Object) { return async function paginationMiddleware( ctx: Context, - next: () => Promise<*> + next: (() => Promise) ) { const opts = { defaultLimit: 15, diff --git a/server/api/notificationSettings.js b/server/api/notificationSettings.ts similarity index 99% rename from server/api/notificationSettings.js rename to server/api/notificationSettings.ts index bbcd64c6e8..e536289656 100644 --- a/server/api/notificationSettings.js +++ b/server/api/notificationSettings.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import auth from "../middlewares/authentication"; diff --git a/server/api/revisions.test.js b/server/api/revisions.test.ts similarity index 100% rename from server/api/revisions.test.js rename to server/api/revisions.test.ts diff --git a/server/api/revisions.js b/server/api/revisions.ts similarity index 99% rename from server/api/revisions.js rename to server/api/revisions.ts index 4ec83708b2..50148a9957 100644 --- a/server/api/revisions.js +++ b/server/api/revisions.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import { NotFoundError } from "../errors"; import auth from "../middlewares/authentication"; diff --git a/server/api/shares.test.js b/server/api/shares.test.ts similarity index 100% rename from server/api/shares.test.js rename to server/api/shares.test.ts diff --git a/server/api/shares.js b/server/api/shares.ts similarity index 99% rename from server/api/shares.js rename to server/api/shares.ts index 5a6bcf188d..ebf988bff0 100644 --- a/server/api/shares.js +++ b/server/api/shares.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import Sequelize from "sequelize"; import { NotFoundError } from "../errors"; diff --git a/server/api/team.test.js b/server/api/team.test.ts similarity index 100% rename from server/api/team.test.js rename to server/api/team.test.ts diff --git a/server/api/team.js b/server/api/team.ts similarity index 99% rename from server/api/team.js rename to server/api/team.ts index c71f8d829c..a8d8b35781 100644 --- a/server/api/team.js +++ b/server/api/team.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import auth from "../middlewares/authentication"; import { Event, Team } from "../models"; diff --git a/server/api/users.test.js b/server/api/users.test.ts similarity index 100% rename from server/api/users.test.js rename to server/api/users.test.ts diff --git a/server/api/users.js b/server/api/users.ts similarity index 99% rename from server/api/users.js rename to server/api/users.ts index 7f5e22e3c7..eefe9a29bc 100644 --- a/server/api/users.js +++ b/server/api/users.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import userInviter from "../commands/userInviter"; import userSuspender from "../commands/userSuspender"; diff --git a/server/api/utils.test.js b/server/api/utils.test.ts similarity index 100% rename from server/api/utils.test.js rename to server/api/utils.test.ts diff --git a/server/api/utils.js b/server/api/utils.ts similarity index 99% rename from server/api/utils.js rename to server/api/utils.ts index 3bd36029ea..a6ac8f91b7 100644 --- a/server/api/utils.js +++ b/server/api/utils.ts @@ -1,4 +1,3 @@ -// @flow import subDays from "date-fns/sub_days"; import debug from "debug"; import Router from "koa-router"; diff --git a/server/api/views.test.js b/server/api/views.test.ts similarity index 100% rename from server/api/views.test.js rename to server/api/views.test.ts diff --git a/server/api/views.js b/server/api/views.ts similarity index 99% rename from server/api/views.js rename to server/api/views.ts index e71a1e0df9..3269536d47 100644 --- a/server/api/views.js +++ b/server/api/views.ts @@ -1,4 +1,3 @@ -// @flow import Router from "koa-router"; import auth from "../middlewares/authentication"; import { View, Document, Event } from "../models"; diff --git a/server/auth/email.js b/server/auth/email.ts similarity index 99% rename from server/auth/email.js rename to server/auth/email.ts index defa94594b..d4abc0652c 100644 --- a/server/auth/email.js +++ b/server/auth/email.ts @@ -1,4 +1,3 @@ -// @flow import subMinutes from "date-fns/sub_minutes"; import Router from "koa-router"; import { AuthorizationError } from "../errors"; diff --git a/server/auth/google.js b/server/auth/google.ts similarity index 99% rename from server/auth/google.js rename to server/auth/google.ts index d52a963949..cbae0f2e51 100644 --- a/server/auth/google.js +++ b/server/auth/google.ts @@ -1,4 +1,3 @@ -// @flow import crypto from "crypto"; import { OAuth2Client } from "google-auth-library"; import Router from "koa-router"; diff --git a/server/auth/index.js b/server/auth/index.ts similarity index 99% rename from server/auth/index.js rename to server/auth/index.ts index deb716a3f3..c6f2ae96c3 100644 --- a/server/auth/index.js +++ b/server/auth/index.ts @@ -1,4 +1,3 @@ -// @flow import addMonths from "date-fns/add_months"; import Koa from "koa"; import bodyParser from "koa-body"; diff --git a/server/auth/slack.js b/server/auth/slack.ts similarity index 99% rename from server/auth/slack.js rename to server/auth/slack.ts index c1915e1ad6..82c8b85122 100644 --- a/server/auth/slack.js +++ b/server/auth/slack.ts @@ -1,4 +1,3 @@ -// @flow import addHours from "date-fns/add_hours"; import Router from "koa-router"; import Sequelize from "sequelize"; diff --git a/server/utils/__mocks__/s3.js b/server/utils/__mocks__/s3.ts similarity index 100% rename from server/utils/__mocks__/s3.js rename to server/utils/__mocks__/s3.ts diff --git a/server/utils/dataURItoBuffer.test.js b/server/utils/dataURItoBuffer.test.ts similarity index 99% rename from server/utils/dataURItoBuffer.test.js rename to server/utils/dataURItoBuffer.test.ts index eb23704df6..c929c6d653 100644 --- a/server/utils/dataURItoBuffer.test.js +++ b/server/utils/dataURItoBuffer.test.ts @@ -1,4 +1,3 @@ -// @flow import dataURItoBuffer from "./dataURItoBuffer"; it("should parse value data URI", () => { diff --git a/server/utils/dataURItoBuffer.js b/server/utils/dataURItoBuffer.ts similarity index 97% rename from server/utils/dataURItoBuffer.js rename to server/utils/dataURItoBuffer.ts index 098506efa8..e8cf931aaf 100644 --- a/server/utils/dataURItoBuffer.js +++ b/server/utils/dataURItoBuffer.ts @@ -1,4 +1,3 @@ -// @flow export default function dataURItoBuffer(dataURI: string) { const split = dataURI.split(","); diff --git a/server/utils/domains.js b/server/utils/domains.ts similarity index 98% rename from server/utils/domains.js rename to server/utils/domains.ts index aed2f12b5a..b173fd2df0 100644 --- a/server/utils/domains.js +++ b/server/utils/domains.ts @@ -1,4 +1,3 @@ -// @flow import { parseDomain, stripSubdomain } from "../../shared/utils/domains"; export function getCookieDomain(domain: string) { diff --git a/server/utils/jwt.js b/server/utils/jwt.ts similarity index 99% rename from server/utils/jwt.js rename to server/utils/jwt.ts index c412183243..b489baaf2d 100644 --- a/server/utils/jwt.js +++ b/server/utils/jwt.ts @@ -1,4 +1,3 @@ -// @flow import subMinutes from "date-fns/sub_minutes"; import JWT from "jsonwebtoken"; import { AuthenticationError } from "../errors"; diff --git a/server/utils/opensearch.js b/server/utils/opensearch.ts similarity index 98% rename from server/utils/opensearch.js rename to server/utils/opensearch.ts index 25a2889024..8fc3e511f4 100644 --- a/server/utils/opensearch.js +++ b/server/utils/opensearch.ts @@ -1,4 +1,3 @@ -// @flow export const opensearchResponse = (): string => { return ` diff --git a/server/utils/parseAttachmentIds.js b/server/utils/parseAttachmentIds.ts similarity index 97% rename from server/utils/parseAttachmentIds.js rename to server/utils/parseAttachmentIds.ts index 1b937723b6..0d9473e8f0 100644 --- a/server/utils/parseAttachmentIds.js +++ b/server/utils/parseAttachmentIds.ts @@ -1,4 +1,3 @@ -// @flow const attachmentRegex = /!\[.*?\]\(\/api\/attachments\.redirect\?id=(?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\)/gi; export default function parseAttachmentIds(text: any): string[] { diff --git a/server/utils/parseDocumentIds.test.js b/server/utils/parseDocumentIds.test.ts similarity index 99% rename from server/utils/parseDocumentIds.test.js rename to server/utils/parseDocumentIds.test.ts index 75c210e99c..65d4f96328 100644 --- a/server/utils/parseDocumentIds.test.js +++ b/server/utils/parseDocumentIds.test.ts @@ -1,4 +1,3 @@ -// @flow import parseDocumentIds from "./parseDocumentIds"; it("should not return non links", () => { diff --git a/server/utils/parseDocumentIds.js b/server/utils/parseDocumentIds.ts similarity index 99% rename from server/utils/parseDocumentIds.js rename to server/utils/parseDocumentIds.ts index 6a4f557f99..ef02547c3e 100644 --- a/server/utils/parseDocumentIds.js +++ b/server/utils/parseDocumentIds.ts @@ -1,4 +1,3 @@ -// @flow import { parser } from "rich-markdown-editor"; export default function parseDocumentIds(text: string): string[] { diff --git a/server/utils/parseImages.test.js b/server/utils/parseImages.test.ts similarity index 98% rename from server/utils/parseImages.test.js rename to server/utils/parseImages.test.ts index 24cd1a3aa6..62a40f64ef 100644 --- a/server/utils/parseImages.test.js +++ b/server/utils/parseImages.test.ts @@ -1,4 +1,3 @@ -// @flow import parseImages from "./parseImages"; it("should not return non images", () => { diff --git a/server/utils/parseImages.js b/server/utils/parseImages.ts similarity index 98% rename from server/utils/parseImages.js rename to server/utils/parseImages.ts index d62188d837..038c109b81 100644 --- a/server/utils/parseImages.js +++ b/server/utils/parseImages.ts @@ -1,4 +1,3 @@ -// @flow import { parser } from "rich-markdown-editor"; export default function parseImages(text: string): string[] { diff --git a/server/utils/prefetchTags.js b/server/utils/prefetchTags.ts similarity index 99% rename from server/utils/prefetchTags.js rename to server/utils/prefetchTags.ts index 36fa0ddf19..4a53b94777 100644 --- a/server/utils/prefetchTags.js +++ b/server/utils/prefetchTags.ts @@ -1,4 +1,3 @@ -// @flow import fs from "fs"; import path from "path"; import * as React from "react"; diff --git a/server/utils/queue.js b/server/utils/queue.ts similarity index 97% rename from server/utils/queue.js rename to server/utils/queue.ts index ffc4a74145..a92538633a 100644 --- a/server/utils/queue.js +++ b/server/utils/queue.ts @@ -1,4 +1,3 @@ -// @flow import Queue from "bull"; import Redis from "ioredis"; import { client, subscriber } from "../redis"; diff --git a/server/utils/robots.js b/server/utils/robots.ts similarity index 56% rename from server/utils/robots.js rename to server/utils/robots.ts index 9905335cd0..ecb4c9797f 100644 --- a/server/utils/robots.js +++ b/server/utils/robots.ts @@ -1,9 +1,8 @@ -// @flow -import { type Context } from "koa"; +import { Context } from "koa"; const DISALLOW_ROBOTS = `User-agent: * Disallow: /`; -export const robotsResponse = (ctx: Context): ?string => { +export const robotsResponse = (ctx: Context): string | null => { if (ctx.headers.host.indexOf("getoutline.com") < 0) return DISALLOW_ROBOTS; }; diff --git a/server/utils/s3.js b/server/utils/s3.ts similarity index 99% rename from server/utils/s3.js rename to server/utils/s3.ts index d50f10860b..c77acc75e7 100644 --- a/server/utils/s3.js +++ b/server/utils/s3.ts @@ -1,4 +1,3 @@ -// @flow import crypto from "crypto"; import * as Sentry from "@sentry/node"; import AWS from "aws-sdk"; diff --git a/server/utils/slugify.js b/server/utils/slugify.ts similarity index 94% rename from server/utils/slugify.js rename to server/utils/slugify.ts index a3cfb40446..c4c087fe8c 100644 --- a/server/utils/slugify.js +++ b/server/utils/slugify.ts @@ -1,4 +1,3 @@ -// @flow import slug from "slug"; slug.defaults.mode = "rfc3986"; diff --git a/server/utils/updates.js b/server/utils/updates.ts similarity index 99% rename from server/utils/updates.js rename to server/utils/updates.ts index 1d52e9c16c..f5f1230915 100644 --- a/server/utils/updates.js +++ b/server/utils/updates.ts @@ -1,4 +1,3 @@ -// @flow import crypto from "crypto"; import invariant from "invariant"; import fetch from "isomorphic-fetch"; diff --git a/server/utils/zip.js b/server/utils/zip.ts similarity index 99% rename from server/utils/zip.js rename to server/utils/zip.ts index 0c66509597..e7f909b32d 100644 --- a/server/utils/zip.js +++ b/server/utils/zip.ts @@ -1,4 +1,3 @@ -// @flow import fs from "fs"; import * as Sentry from "@sentry/node"; import JSZip from "jszip";