refactor: introduce type-only imports (#5462)

This commit is contained in:
Vladislav Shkodin
2021-05-31 14:23:16 +02:00
committed by GitHub
parent e4a29d5991
commit fc07ce6854
81 changed files with 398 additions and 362 deletions

View File

@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config();
import express from 'express';
import { registerCommonMiddlewares } from './middlewares/common';

View File

@ -1,4 +1,4 @@
import express from 'express';
import type express from 'express';
import { registerCommonMiddlewares } from './middlewares/common';
import { registerMiddleware as localGit } from './middlewares/localGit';
import { registerMiddleware as localFs } from './middlewares/localFs';

View File

@ -1,4 +1,4 @@
import winston from 'winston';
import type winston from 'winston';
import express from 'express';
import morgan from 'morgan';
import cors from 'cors';

View File

@ -1,6 +1,6 @@
import { defaultSchema, joi } from '.';
import express from 'express';
import Joi from '@hapi/joi';
import type express from 'express';
import type Joi from '@hapi/joi';
function assetFailure(result: Joi.ValidationResult, expectedMessage: string) {
const { error } = result;

View File

@ -1,4 +1,4 @@
import express from 'express';
import type express from 'express';
import Joi from '@hapi/joi';
const allowedActions = [

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import Joi from '@hapi/joi';
import type Joi from '@hapi/joi';
import { getSchema } from '.';
function assetFailure(result: Joi.ValidationResult, expectedMessage: string) {

View File

@ -1,9 +1,9 @@
import winston from 'winston';
import express from 'express';
import type winston from 'winston';
import type express from 'express';
import path from 'path';
import { defaultSchema, joi } from '../joi';
import { pathTraversal } from '../joi/customValidators';
import {
import type {
EntriesByFolderParams,
EntriesByFilesParams,
GetEntryParams,
@ -32,7 +32,6 @@ export function localFsMiddleware({ repoPath, logger }: FsOptions) {
case 'info': {
res.json({
repo: path.basename(repoPath),
// eslint-disable-next-line @typescript-eslint/camelcase
publish_modes: ['simple'],
type: 'local_fs',
});

View File

@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import Joi from '@hapi/joi';
import express from 'express';
import type Joi from '@hapi/joi';
import type express from 'express';
import winston from 'winston';
import { validateRepo, getSchema, localGitMiddleware } from '.';

View File

@ -1,5 +1,5 @@
import winston from 'winston';
import express from 'express';
import type winston from 'winston';
import type express from 'express';
import path from 'path';
import { promises as fs } from 'fs';
import {
@ -13,7 +13,7 @@ import {
} from 'netlify-cms-lib-util/src/APIUtils';
import { parse } from 'what-the-diff';
import { defaultSchema, joi } from '../joi';
import {
import type {
EntriesByFolderParams,
EntriesByFilesParams,
GetEntryParams,
@ -181,7 +181,6 @@ export function localGitMiddleware({ repoPath, logger }: GitOptions) {
if (body.action === 'info') {
res.json({
repo: path.basename(repoPath),
// eslint-disable-next-line @typescript-eslint/camelcase
publish_modes: ['simple', 'editorial_workflow'],
type: 'local_git',
});