chore: Upgrade Babel, Jest, Eslint (#1437)

* chore: Upgrade Prettier 1.8 -> 2.0

* chore: Upgrade Babel 6 -> 7

* chore: Upgrade eslint plugins

* chore: Add eslint import/order rules

* chore: Update flow-typed deps
This commit is contained in:
Tom Moor
2020-08-08 22:53:59 -07:00
committed by GitHub
parent e312b264a6
commit 449dc55aaa
317 changed files with 16474 additions and 12183 deletions

View File

@@ -1,6 +1,6 @@
// @flow
import { DataTypes, sequelize } from "../sequelize";
import randomstring from "randomstring";
import { DataTypes, sequelize } from "../sequelize";
const ApiKey = sequelize.define(
"apiKeys",

View File

@@ -1,10 +1,10 @@
// @flow
import { find, concat, remove, uniq } from "lodash";
import slug from "slug";
import randomstring from "randomstring";
import slug from "slug";
import { DataTypes, sequelize } from "../sequelize";
import Document from "./Document";
import CollectionUser from "./CollectionUser";
import Document from "./Document";
slug.defaults.mode = "rfc3986";

View File

@@ -1,5 +1,5 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import { flushdb, seed } from "../test/support";
import uuid from "uuid";
import { Collection, Document } from "../models";
import {
buildUser,
@@ -7,9 +7,9 @@ import {
buildCollection,
buildTeam,
} from "../test/factories";
import uuid from "uuid";
import { flushdb, seed } from "../test/support";
beforeEach(flushdb);
beforeEach(() => flushdb());
beforeEach(jest.resetAllMocks);
describe("#url", () => {
@@ -19,7 +19,7 @@ describe("#url", () => {
});
});
describe("#addDocumentToStructure", async () => {
describe("#addDocumentToStructure", () => {
test("should add as last element without index", async () => {
const { collection } = await seed();
const id = uuid.v4();
@@ -86,7 +86,7 @@ describe("#addDocumentToStructure", async () => {
expect(collection.documentStructure[0].children[0].id).toBe(id);
});
describe("options: documentJson", async () => {
describe("options: documentJson", () => {
test("should append supplied json over document's own", async () => {
const { collection } = await seed();
const id = uuid.v4();

View File

@@ -1,15 +1,15 @@
// @flow
import removeMarkdown from "@tommoor/remove-markdown";
import { map, find, compact, uniq } from "lodash";
import MarkdownSerializer from "slate-md-serializer";
import randomstring from "randomstring";
import Sequelize, { type Transaction } from "sequelize";
import removeMarkdown from "@tommoor/remove-markdown";
import MarkdownSerializer from "slate-md-serializer";
import isUUID from "validator/lib/isUUID";
import { Collection, User } from "../models";
import { DataTypes, sequelize } from "../sequelize";
import parseTitle from "../../shared/utils/parseTitle";
import unescape from "../../shared/utils/unescape";
import { Collection, User } from "../models";
import { DataTypes, sequelize } from "../sequelize";
import slugify from "../utils/slugify";
import Revision from "./Revision";

View File

@@ -1,9 +1,9 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import { flushdb } from "../test/support";
import { Document } from "../models";
import { buildDocument, buildCollection, buildTeam } from "../test/factories";
import { flushdb } from "../test/support";
beforeEach(flushdb);
beforeEach(() => flushdb());
beforeEach(jest.resetAllMocks);
describe("#getSummary", () => {

View File

@@ -1,6 +1,6 @@
// @flow
import { DataTypes, sequelize } from "../sequelize";
import events from "../events";
import { DataTypes, sequelize } from "../sequelize";
const Event = sequelize.define("event", {
id: {

View File

@@ -1,6 +1,6 @@
// @flow
import { Op, DataTypes, sequelize } from "../sequelize";
import { CollectionGroup, GroupUser } from "../models";
import { Op, DataTypes, sequelize } from "../sequelize";
const Group = sequelize.define(
"group",

View File

@@ -1,9 +1,9 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import { flushdb } from "../test/support";
import { CollectionGroup, GroupUser } from "../models";
import { buildUser, buildGroup, buildCollection } from "../test/factories";
import { flushdb } from "../test/support";
beforeEach(flushdb);
beforeEach(() => flushdb());
beforeEach(jest.resetAllMocks);
describe("afterDestroy hook", () => {

View File

@@ -1,6 +1,6 @@
// @flow
import { DataTypes, sequelize } from "../sequelize";
import MarkdownSerializer from "slate-md-serializer";
import { DataTypes, sequelize } from "../sequelize";
const serializer = new MarkdownSerializer();

View File

@@ -1,16 +1,16 @@
// @flow
import uuid from "uuid";
import { URL } from "url";
import fs from "fs";
import util from "util";
import path from "path";
import { DataTypes, sequelize, Op } from "../sequelize";
import { publicS3Endpoint, uploadToS3FromUrl } from "../utils/s3";
import { URL } from "url";
import util from "util";
import uuid from "uuid";
import {
stripSubdomain,
RESERVED_SUBDOMAINS,
} from "../../shared/utils/domains";
import { ValidationError } from "../errors";
import { DataTypes, sequelize, Op } from "../sequelize";
import { publicS3Endpoint, uploadToS3FromUrl } from "../utils/s3";
import Collection from "./Collection";
import Document from "./Document";

View File

@@ -1,8 +1,8 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import { flushdb } from "../test/support";
import { buildTeam } from "../test/factories";
import { flushdb } from "../test/support";
beforeEach(flushdb);
beforeEach(() => flushdb());
it("should set subdomain if available", async () => {
const team = await buildTeam();

View File

@@ -1,12 +1,12 @@
// @flow
import crypto from "crypto";
import uuid from "uuid";
import JWT from "jsonwebtoken";
import subMinutes from "date-fns/sub_minutes";
import JWT from "jsonwebtoken";
import uuid from "uuid";
import { ValidationError } from "../errors";
import { sendEmail } from "../mailer";
import { DataTypes, sequelize, encryptedFields } from "../sequelize";
import { publicS3Endpoint, uploadToS3FromUrl } from "../utils/s3";
import { sendEmail } from "../mailer";
import { Star, Team, Collection, NotificationSetting, ApiKey } from ".";
const DEFAULT_AVATAR_HOST = "https://tiley.herokuapp.com";

View File

@@ -1,8 +1,8 @@
/* eslint-disable flowtype/require-valid-file-annotation */
import { flushdb } from "../test/support";
import { buildUser } from "../test/factories";
import { flushdb } from "../test/support";
beforeEach(flushdb);
beforeEach(() => flushdb());
it("should set JWT secret", async () => {
const user = await buildUser();

View File

@@ -1,8 +1,8 @@
// @flow
import subMilliseconds from "date-fns/sub_milliseconds";
import { Op, DataTypes, sequelize } from "../sequelize";
import { User } from "../models";
import { USER_PRESENCE_INTERVAL } from "../../shared/constants";
import { User } from "../models";
import { Op, DataTypes, sequelize } from "../sequelize";
const View = sequelize.define(
"view",

View File

@@ -4,13 +4,13 @@ import Attachment from "./Attachment";
import Authentication from "./Authentication";
import Backlink from "./Backlink";
import Collection from "./Collection";
import CollectionUser from "./CollectionUser";
import CollectionGroup from "./CollectionGroup";
import CollectionUser from "./CollectionUser";
import Document from "./Document";
import Event from "./Event";
import Integration from "./Integration";
import Group from "./Group";
import GroupUser from "./GroupUser";
import Integration from "./Integration";
import Notification from "./Notification";
import NotificationSetting from "./NotificationSetting";
import Revision from "./Revision";