From 28eea3edabe9c7e7c98d8d27583d80b8607466b6 Mon Sep 17 00:00:00 2001 From: Sakumatti Luukkonen Date: Mon, 27 Jul 2020 13:33:57 +0300 Subject: [PATCH] Add names for default exported functions This should work around the issue in eslint-plugin-react 7.20.4 [1], and is good practice in any case. [1] https://github.com/yannickcr/eslint-plugin-react/issues/2728 --- packages/cli/src/commands/create-mex.ts | 2 +- packages/cli/src/commands/create-offline.ts | 2 +- packages/cli/src/commands/create-transfer-zip.ts | 2 +- packages/cli/src/commands/new.ts | 2 +- packages/cli/src/commands/preview.ts | 2 +- packages/rendering/src/exam-loader.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/commands/create-mex.ts b/packages/cli/src/commands/create-mex.ts index fd29798745..24d0fbdebf 100755 --- a/packages/cli/src/commands/create-mex.ts +++ b/packages/cli/src/commands/create-mex.ts @@ -4,7 +4,7 @@ import path from 'path' import * as uuid from 'uuid' import { examName } from '../utils' -export default async function ({ +export default async function createMexExam({ exam, outdir = path.dirname(exam), nsaScripts, diff --git a/packages/cli/src/commands/create-offline.ts b/packages/cli/src/commands/create-offline.ts index 318696824e..cbedb0c4fa 100644 --- a/packages/cli/src/commands/create-offline.ts +++ b/packages/cli/src/commands/create-offline.ts @@ -2,7 +2,7 @@ import { createOfflineExam } from '@digabi/exam-engine-rendering' import { Ora } from 'ora' import path from 'path' -export default async function ({ +export default async function createOffline({ exam, outdir = path.dirname(exam), media, diff --git a/packages/cli/src/commands/create-transfer-zip.ts b/packages/cli/src/commands/create-transfer-zip.ts index c36379ef53..c749e7f0d9 100644 --- a/packages/cli/src/commands/create-transfer-zip.ts +++ b/packages/cli/src/commands/create-transfer-zip.ts @@ -8,7 +8,7 @@ import * as uuid from 'uuid' import yazl from 'yazl' import { examName } from '../utils' -export default async function ({ +export default async function createTransferZip({ exam, outdir = path.dirname(exam), spinner, diff --git a/packages/cli/src/commands/new.ts b/packages/cli/src/commands/new.ts index 6d491156d3..d42d446a8e 100644 --- a/packages/cli/src/commands/new.ts +++ b/packages/cli/src/commands/new.ts @@ -2,7 +2,7 @@ import { promises as fs } from 'fs' import { Ora } from 'ora' import path from 'path' -export default async function ({ directory }: { directory: string; spinner: Ora }): Promise { +export default async function newExam({ directory }: { directory: string; spinner: Ora }): Promise { const resolveExamFile = (...file: string[]) => path.resolve(directory, ...file) await assertDirectoryDoesNotExist(directory) diff --git a/packages/cli/src/commands/preview.ts b/packages/cli/src/commands/preview.ts index 674fd4c201..6fddfceb35 100644 --- a/packages/cli/src/commands/preview.ts +++ b/packages/cli/src/commands/preview.ts @@ -1,7 +1,7 @@ import { previewExam } from '@digabi/exam-engine-rendering' import { Ora } from 'ora' -export default async function ({ exam, spinner }: { exam: string; spinner: Ora }): Promise { +export default async function preview({ exam, spinner }: { exam: string; spinner: Ora }): Promise { spinner.start(`Previewing ${exam}...`) const ctx = await previewExam(exam, { openFirefox: true }) spinner.info(`Server is running at ${ctx.url}`) diff --git a/packages/rendering/src/exam-loader.ts b/packages/rendering/src/exam-loader.ts index 1f41f9b718..ec68986f40 100644 --- a/packages/rendering/src/exam-loader.ts +++ b/packages/rendering/src/exam-loader.ts @@ -11,7 +11,7 @@ function stringifyModule(module: any, attachments: Attachment[] = []): string { return imports + '\nmodule.exports = ' + JSON.stringify(module) } -export default async function (this: webpack.loader.LoaderContext, source: string): Promise { +export default async function examLoader(this: webpack.loader.LoaderContext, source: string): Promise { const callback = this.async()! const baseDir = path.dirname(this.resourcePath) const resolveAttachment = (attachment: string) => path.resolve(baseDir, 'attachments', attachment)