chore: lint with eslint

This commit is contained in:
pooya parsa 2020-08-04 12:26:22 +02:00
parent 8ac0a7cec6
commit d6ae2c73d9
24 changed files with 84 additions and 88 deletions

View File

@ -54,6 +54,7 @@ export default class Builder {
plugins: Array<{
src: string
}>
relativeToBuild: (...args: string[]) => string
routes: RouteLocationRaw[]
supportedExtensions: string[]
@ -742,7 +743,7 @@ export default class Builder {
patterns.push(r(this.options.srcDir, this.options.dir.pages))
}
patterns = patterns.map((path) => upath.normalizeSafe(this.globPathWithExtensions(path)))
patterns = patterns.map(path => upath.normalizeSafe(this.globPathWithExtensions(path)))
const refreshFiles = debounce(() => this.generateRoutesAndFiles(), 200)

View File

@ -26,7 +26,6 @@ export interface Command {
type Hooks = Parameters<Hookable['addHooks']>[0]
export default class NuxtCommand extends Hookable {
_argv: string[]
_parsedArgv: null | ParsedArgs
@ -145,7 +144,6 @@ export default class NuxtCommand extends Hookable {
}
async getNuxt (options: CliConfiguration) {
const nuxt = new Nuxt(options)
await nuxt.ready()

View File

@ -5,10 +5,10 @@ import serveStatic from 'serve-static'
import compression from 'compression'
import { getNuxtConfig } from 'src/config'
import { TARGETS } from 'src/utils'
import { common, server } from '../options'
import { showBanner } from '../utils/banner'
import { Listener } from 'src/server'
import { Nuxt } from 'src/core'
import { common, server } from '../options'
import { showBanner } from '../utils/banner'
import type NuxtCommand from '../command'
export default {

View File

@ -1,3 +1,4 @@
import path from 'path'
import type { WatchOptions as ChokidarWatchOptions } from 'chokidar'
import type { NextHandleFunction, Server as ConnectServer } from 'connect'
import type { configHooksT } from 'hookable/types/types'
@ -5,11 +6,10 @@ import ignore from 'ignore'
import capitalize from 'lodash/capitalize'
import env from 'std-env'
import type { Configuration as WebpackConfiguration } from 'webpack'
import path from 'path'
import { TARGETS, MODES, Target, Mode } from 'src/utils'
import type { NormalizedConfiguration } from '../options'
import Hookable from 'hookable'
import type { NormalizedConfiguration } from '../options'
type IgnoreOptions = Parameters<typeof ignore>[0]
type IgnoreInstance = ReturnType<typeof ignore>

View File

@ -13,14 +13,12 @@ import type { Options as PugOptions } from 'pug'
import type { TerserPluginOptions } from 'terser-webpack-plugin'
import type { VueLoaderOptions } from 'vue-loader'
import type {
Configuration as WebpackConfiguration, WebpackPluginFunction,
Configuration as WebpackConfiguration, WebpackPluginFunction
} from 'webpack'
import type { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
import type { MiddlewareOptions as WebpackHotMiddlewareOptions, ClientOptions as WebpackHotMiddlewareClientOptions } from 'webpack-hot-middleware'
interface WebpackEnv {
isClient: boolean
isDev: boolean
@ -96,7 +94,6 @@ interface PostcssVariableMap {
environmentVariables?: Record<string, string>
}
interface PostcssConfiguration {
order?: PostcssOrderPreset | string[] | ((names: string[], presets: PostcssOrderPresetFunctions) => string[])
plugins?: {
@ -380,6 +377,6 @@ export default () => ({
/**
* You can provide your custom files to watch and regenerate after changes. This feature is specially useful for using with modules.
*/
watch: [] as string[],
watch: [] as string[]
})

View File

@ -26,7 +26,7 @@ export const getDefaultNuxtConfig = () =>
cli: cli(),
generate: generate(),
export: undefined as undefined | GenerateOptions,
telemetry: undefined as undefined | boolean,
telemetry: undefined as undefined | boolean
})
export type DefaultConfiguration = ReturnType<typeof getDefaultNuxtConfig>

View File

@ -10,8 +10,8 @@ import destr from 'destr'
import * as rc from 'rc9'
import { LoadOptions } from 'src/core/load'
import { defaultNuxtConfigFile } from './config'
import { CliConfiguration, Configuration } from 'src/config/options'
import { defaultNuxtConfigFile } from './config'
// @ts-ignore
const isJest = typeof jest !== 'undefined'
@ -71,7 +71,7 @@ export async function loadNuxtConfig ({
// Clear cache
clearRequireCache(configFile)
const _require = createRequire(module)
let _config: Configuration | ((ctx: Record<string, any>) => Promise<Configuration>) = interopDefault(_require(configFile) || {})
const _config: Configuration | ((ctx: Record<string, any>) => Promise<Configuration>) = interopDefault(_require(configFile) || {})
if (typeof _config === 'function') {
try {

View File

@ -7,9 +7,9 @@ import pick from 'lodash/pick'
import uniq from 'lodash/uniq'
import destr from 'destr'
import { TARGETS, MODES, guardDir, isNonEmptyString, isPureObject, isUrl, getMainModule, urlJoin, getPKG } from 'src/utils'
import type { EnvConfig } from 'src/config/load'
import { DefaultConfiguration, defaultNuxtConfigFile, getDefaultNuxtConfig } from './config'
import { deleteProp, mergeConfigs, setProp, overrideProp, Optional } from './transformers'
import type { EnvConfig } from 'src/config/load'
interface InputConfiguration {
appTemplatePath?: string
@ -382,7 +382,6 @@ function normalizeConfig(_options: CliConfiguration) {
overrideProp(options.server, 'timing', { total: true, ...options.server.timing })
}
overrideProp(options, 'serverMiddleware', Array.isArray(options.serverMiddleware) ? options.serverMiddleware : Object.entries(options.serverMiddleware)
.map(([path, handler]) => ({ path, handler }))
)

View File

@ -6,8 +6,8 @@ import consola from 'consola'
import type { NormalizedConfiguration } from 'src/config'
import { chainFn, sequence } from 'src/utils'
import Nuxt from './nuxt'
import type { NuxtModule, ModuleHandler } from 'src/config/config/_common'
import Nuxt from './nuxt'
interface TemplateInput {
filename?: string

View File

@ -43,6 +43,7 @@ export default class Server {
spaTemplate?: TemplateExecutor
errorTemplate?: TemplateExecutor
}
serverContext: ServerContext
constructor (nuxt: Nuxt) {

View File

@ -4,10 +4,10 @@ import consola from 'consola'
import template from 'lodash/template'
import { TARGETS, isModernRequest, waitFor } from 'src/utils'
import ServerContext from 'src/server/context'
import SPARenderer from './renderers/spa'
import SSRRenderer from './renderers/ssr'
import ModernRenderer from './renderers/modern'
import ServerContext from 'src/server/context'
export default class VueRenderer {
__closed?: boolean

View File

@ -1,4 +1,4 @@
import ServerContext from "nuxt/server/context"
import ServerContext from 'nuxt/server/context'
export default class BaseRenderer {
serverContext: ServerContext

View File

@ -258,7 +258,7 @@ export default class WebpackBaseConfig {
alias () {
return {
...this.buildContext.options.alias,
'app': this.buildContext.options.appDir,
app: this.buildContext.options.appDir,
'nuxt-build': this.buildContext.options.buildDir,
'vue-meta': require.resolve(`vue-meta${this.isServer ? '' : '/dist/vue-meta.esm.browser.js'}`)
}