chore: update prettier (#5412)

This commit is contained in:
Vladislav Shkodin
2021-05-19 14:39:35 +02:00
committed by GitHub
parent 46738492a0
commit 39f113715a
66 changed files with 1625 additions and 1763 deletions

View File

@ -601,7 +601,7 @@ describe('joi', () => {
} as express.Request;
const json = jest.fn();
const status = jest.fn(() => ({ json }));
const res: express.Response = ({ status } as unknown) as express.Response;
const res: express.Response = { status } as unknown as express.Response;
joi(defaultSchema())(req, res, next);

View File

@ -132,9 +132,7 @@ export function defaultSchema({ path = requiredString } = {}) {
cmsLabelPrefix: Joi.string().optional(),
entry: dataFile, // entry is kept for backwards compatibility
dataFiles: Joi.array().items(dataFile),
assets: Joi.array()
.items(asset)
.required(),
assets: Joi.array().items(asset).required(),
options: Joi.object({
collectionName: Joi.string(),
commitMessage: requiredString,
@ -207,10 +205,7 @@ export function defaultSchema({ path = requiredString } = {}) {
is: 'deleteFiles',
then: defaultParams
.keys({
paths: Joi.array()
.items(path)
.min(1)
.required(),
paths: Joi.array().items(path).min(1).required(),
options: Joi.object({
commitMessage: requiredString,
}).required(),

View File

@ -24,7 +24,7 @@ type FsOptions = {
};
export function localFsMiddleware({ repoPath, logger }: FsOptions) {
return async function(req: express.Request, res: express.Response) {
return async function (req: express.Request, res: express.Response) {
try {
const { body } = req;

View File

@ -123,7 +123,7 @@ describe('localGitMiddleware', () => {
describe('localGitMiddleware', () => {
const json = jest.fn();
const status = jest.fn(() => ({ json }));
const res: express.Response = ({ status } as unknown) as express.Response;
const res: express.Response = { status } as unknown as express.Response;
const repoPath = '.';

View File

@ -173,7 +173,7 @@ export function localGitMiddleware({ repoPath, logger }: GitOptions) {
// we can only perform a single git operation at any given time
const mutex = withTimeout(new Mutex(), 3000, new Error('Request timed out'));
return async function(req: express.Request, res: express.Response) {
return async function (req: express.Request, res: express.Response) {
let release;
try {
release = await mutex.acquire();
@ -345,12 +345,8 @@ export function localGitMiddleware({ repoPath, logger }: GitOptions) {
break;
}
case 'updateUnpublishedEntryStatus': {
const {
collection,
slug,
newStatus,
cmsLabelPrefix,
} = body.params as UpdateUnpublishedEntryStatusParams;
const { collection, slug, newStatus, cmsLabelPrefix } =
body.params as UpdateUnpublishedEntryStatusParams;
const contentKey = generateContentKey(collection, slug);
const cmsBranch = branchFromContentKey(contentKey);
const description = statusToLabel(newStatus, cmsLabelPrefix || '');

View File

@ -3,10 +3,7 @@ import path from 'path';
import { promises as fs } from 'fs';
function sha256(buffer: Buffer) {
return crypto
.createHash('sha256')
.update(buffer)
.digest('hex');
return crypto.createHash('sha256').update(buffer).digest('hex');
}
// normalize windows os path format