mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-18 06:31:27 +00:00
chore: lint with eslint
This commit is contained in:
parent
8ac0a7cec6
commit
d6ae2c73d9
@ -54,6 +54,7 @@ export default class Builder {
|
|||||||
plugins: Array<{
|
plugins: Array<{
|
||||||
src: string
|
src: string
|
||||||
}>
|
}>
|
||||||
|
|
||||||
relativeToBuild: (...args: string[]) => string
|
relativeToBuild: (...args: string[]) => string
|
||||||
routes: RouteLocationRaw[]
|
routes: RouteLocationRaw[]
|
||||||
supportedExtensions: string[]
|
supportedExtensions: string[]
|
||||||
@ -742,7 +743,7 @@ export default class Builder {
|
|||||||
patterns.push(r(this.options.srcDir, this.options.dir.pages))
|
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)
|
const refreshFiles = debounce(() => this.generateRoutesAndFiles(), 200)
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ export interface Command {
|
|||||||
|
|
||||||
type Hooks = Parameters<Hookable['addHooks']>[0]
|
type Hooks = Parameters<Hookable['addHooks']>[0]
|
||||||
|
|
||||||
|
|
||||||
export default class NuxtCommand extends Hookable {
|
export default class NuxtCommand extends Hookable {
|
||||||
_argv: string[]
|
_argv: string[]
|
||||||
_parsedArgv: null | ParsedArgs
|
_parsedArgv: null | ParsedArgs
|
||||||
@ -145,7 +144,6 @@ export default class NuxtCommand extends Hookable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getNuxt (options: CliConfiguration) {
|
async getNuxt (options: CliConfiguration) {
|
||||||
|
|
||||||
const nuxt = new Nuxt(options)
|
const nuxt = new Nuxt(options)
|
||||||
await nuxt.ready()
|
await nuxt.ready()
|
||||||
|
|
||||||
|
@ -5,10 +5,10 @@ import serveStatic from 'serve-static'
|
|||||||
import compression from 'compression'
|
import compression from 'compression'
|
||||||
import { getNuxtConfig } from 'src/config'
|
import { getNuxtConfig } from 'src/config'
|
||||||
import { TARGETS } from 'src/utils'
|
import { TARGETS } from 'src/utils'
|
||||||
import { common, server } from '../options'
|
|
||||||
import { showBanner } from '../utils/banner'
|
|
||||||
import { Listener } from 'src/server'
|
import { Listener } from 'src/server'
|
||||||
import { Nuxt } from 'src/core'
|
import { Nuxt } from 'src/core'
|
||||||
|
import { common, server } from '../options'
|
||||||
|
import { showBanner } from '../utils/banner'
|
||||||
import type NuxtCommand from '../command'
|
import type NuxtCommand from '../command'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import path from 'path'
|
||||||
import type { WatchOptions as ChokidarWatchOptions } from 'chokidar'
|
import type { WatchOptions as ChokidarWatchOptions } from 'chokidar'
|
||||||
import type { NextHandleFunction, Server as ConnectServer } from 'connect'
|
import type { NextHandleFunction, Server as ConnectServer } from 'connect'
|
||||||
import type { configHooksT } from 'hookable/types/types'
|
import type { configHooksT } from 'hookable/types/types'
|
||||||
@ -5,11 +6,10 @@ import ignore from 'ignore'
|
|||||||
import capitalize from 'lodash/capitalize'
|
import capitalize from 'lodash/capitalize'
|
||||||
import env from 'std-env'
|
import env from 'std-env'
|
||||||
import type { Configuration as WebpackConfiguration } from 'webpack'
|
import type { Configuration as WebpackConfiguration } from 'webpack'
|
||||||
import path from 'path'
|
|
||||||
import { TARGETS, MODES, Target, Mode } from 'src/utils'
|
import { TARGETS, MODES, Target, Mode } from 'src/utils'
|
||||||
|
|
||||||
import type { NormalizedConfiguration } from '../options'
|
|
||||||
import Hookable from 'hookable'
|
import Hookable from 'hookable'
|
||||||
|
import type { NormalizedConfiguration } from '../options'
|
||||||
|
|
||||||
type IgnoreOptions = Parameters<typeof ignore>[0]
|
type IgnoreOptions = Parameters<typeof ignore>[0]
|
||||||
type IgnoreInstance = ReturnType<typeof ignore>
|
type IgnoreInstance = ReturnType<typeof ignore>
|
||||||
|
@ -13,14 +13,12 @@ import type { Options as PugOptions } from 'pug'
|
|||||||
import type { TerserPluginOptions } from 'terser-webpack-plugin'
|
import type { TerserPluginOptions } from 'terser-webpack-plugin'
|
||||||
import type { VueLoaderOptions } from 'vue-loader'
|
import type { VueLoaderOptions } from 'vue-loader'
|
||||||
import type {
|
import type {
|
||||||
Configuration as WebpackConfiguration, WebpackPluginFunction,
|
Configuration as WebpackConfiguration, WebpackPluginFunction
|
||||||
|
|
||||||
|
|
||||||
} from 'webpack'
|
} from 'webpack'
|
||||||
import type { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
|
import type { Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
|
||||||
import type { MiddlewareOptions as WebpackHotMiddlewareOptions, ClientOptions as WebpackHotMiddlewareClientOptions } from 'webpack-hot-middleware'
|
import type { MiddlewareOptions as WebpackHotMiddlewareOptions, ClientOptions as WebpackHotMiddlewareClientOptions } from 'webpack-hot-middleware'
|
||||||
|
|
||||||
|
|
||||||
interface WebpackEnv {
|
interface WebpackEnv {
|
||||||
isClient: boolean
|
isClient: boolean
|
||||||
isDev: boolean
|
isDev: boolean
|
||||||
@ -96,7 +94,6 @@ interface PostcssVariableMap {
|
|||||||
environmentVariables?: Record<string, string>
|
environmentVariables?: Record<string, string>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
interface PostcssConfiguration {
|
interface PostcssConfiguration {
|
||||||
order?: PostcssOrderPreset | string[] | ((names: string[], presets: PostcssOrderPresetFunctions) => string[])
|
order?: PostcssOrderPreset | string[] | ((names: string[], presets: PostcssOrderPresetFunctions) => string[])
|
||||||
plugins?: {
|
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.
|
* 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[]
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -26,7 +26,7 @@ export const getDefaultNuxtConfig = () =>
|
|||||||
cli: cli(),
|
cli: cli(),
|
||||||
generate: generate(),
|
generate: generate(),
|
||||||
export: undefined as undefined | GenerateOptions,
|
export: undefined as undefined | GenerateOptions,
|
||||||
telemetry: undefined as undefined | boolean,
|
telemetry: undefined as undefined | boolean
|
||||||
})
|
})
|
||||||
|
|
||||||
export type DefaultConfiguration = ReturnType<typeof getDefaultNuxtConfig>
|
export type DefaultConfiguration = ReturnType<typeof getDefaultNuxtConfig>
|
@ -10,8 +10,8 @@ import destr from 'destr'
|
|||||||
import * as rc from 'rc9'
|
import * as rc from 'rc9'
|
||||||
|
|
||||||
import { LoadOptions } from 'src/core/load'
|
import { LoadOptions } from 'src/core/load'
|
||||||
import { defaultNuxtConfigFile } from './config'
|
|
||||||
import { CliConfiguration, Configuration } from 'src/config/options'
|
import { CliConfiguration, Configuration } from 'src/config/options'
|
||||||
|
import { defaultNuxtConfigFile } from './config'
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const isJest = typeof jest !== 'undefined'
|
const isJest = typeof jest !== 'undefined'
|
||||||
@ -71,7 +71,7 @@ export async function loadNuxtConfig ({
|
|||||||
// Clear cache
|
// Clear cache
|
||||||
clearRequireCache(configFile)
|
clearRequireCache(configFile)
|
||||||
const _require = createRequire(module)
|
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') {
|
if (typeof _config === 'function') {
|
||||||
try {
|
try {
|
||||||
|
@ -7,9 +7,9 @@ import pick from 'lodash/pick'
|
|||||||
import uniq from 'lodash/uniq'
|
import uniq from 'lodash/uniq'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
import { TARGETS, MODES, guardDir, isNonEmptyString, isPureObject, isUrl, getMainModule, urlJoin, getPKG } from 'src/utils'
|
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 { DefaultConfiguration, defaultNuxtConfigFile, getDefaultNuxtConfig } from './config'
|
||||||
import { deleteProp, mergeConfigs, setProp, overrideProp, Optional } from './transformers'
|
import { deleteProp, mergeConfigs, setProp, overrideProp, Optional } from './transformers'
|
||||||
import type { EnvConfig } from 'src/config/load'
|
|
||||||
|
|
||||||
interface InputConfiguration {
|
interface InputConfiguration {
|
||||||
appTemplatePath?: string
|
appTemplatePath?: string
|
||||||
@ -382,7 +382,6 @@ function normalizeConfig(_options: CliConfiguration) {
|
|||||||
overrideProp(options.server, 'timing', { total: true, ...options.server.timing })
|
overrideProp(options.server, 'timing', { total: true, ...options.server.timing })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
overrideProp(options, 'serverMiddleware', Array.isArray(options.serverMiddleware) ? options.serverMiddleware : Object.entries(options.serverMiddleware)
|
overrideProp(options, 'serverMiddleware', Array.isArray(options.serverMiddleware) ? options.serverMiddleware : Object.entries(options.serverMiddleware)
|
||||||
.map(([path, handler]) => ({ path, handler }))
|
.map(([path, handler]) => ({ path, handler }))
|
||||||
)
|
)
|
||||||
|
@ -6,8 +6,8 @@ import consola from 'consola'
|
|||||||
import type { NormalizedConfiguration } from 'src/config'
|
import type { NormalizedConfiguration } from 'src/config'
|
||||||
import { chainFn, sequence } from 'src/utils'
|
import { chainFn, sequence } from 'src/utils'
|
||||||
|
|
||||||
import Nuxt from './nuxt'
|
|
||||||
import type { NuxtModule, ModuleHandler } from 'src/config/config/_common'
|
import type { NuxtModule, ModuleHandler } from 'src/config/config/_common'
|
||||||
|
import Nuxt from './nuxt'
|
||||||
|
|
||||||
interface TemplateInput {
|
interface TemplateInput {
|
||||||
filename?: string
|
filename?: string
|
||||||
|
@ -43,6 +43,7 @@ export default class Server {
|
|||||||
spaTemplate?: TemplateExecutor
|
spaTemplate?: TemplateExecutor
|
||||||
errorTemplate?: TemplateExecutor
|
errorTemplate?: TemplateExecutor
|
||||||
}
|
}
|
||||||
|
|
||||||
serverContext: ServerContext
|
serverContext: ServerContext
|
||||||
|
|
||||||
constructor (nuxt: Nuxt) {
|
constructor (nuxt: Nuxt) {
|
||||||
|
@ -4,10 +4,10 @@ import consola from 'consola'
|
|||||||
import template from 'lodash/template'
|
import template from 'lodash/template'
|
||||||
import { TARGETS, isModernRequest, waitFor } from 'src/utils'
|
import { TARGETS, isModernRequest, waitFor } from 'src/utils'
|
||||||
|
|
||||||
|
import ServerContext from 'src/server/context'
|
||||||
import SPARenderer from './renderers/spa'
|
import SPARenderer from './renderers/spa'
|
||||||
import SSRRenderer from './renderers/ssr'
|
import SSRRenderer from './renderers/ssr'
|
||||||
import ModernRenderer from './renderers/modern'
|
import ModernRenderer from './renderers/modern'
|
||||||
import ServerContext from 'src/server/context'
|
|
||||||
|
|
||||||
export default class VueRenderer {
|
export default class VueRenderer {
|
||||||
__closed?: boolean
|
__closed?: boolean
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import ServerContext from "nuxt/server/context"
|
import ServerContext from 'nuxt/server/context'
|
||||||
|
|
||||||
export default class BaseRenderer {
|
export default class BaseRenderer {
|
||||||
serverContext: ServerContext
|
serverContext: ServerContext
|
||||||
|
@ -258,7 +258,7 @@ export default class WebpackBaseConfig {
|
|||||||
alias () {
|
alias () {
|
||||||
return {
|
return {
|
||||||
...this.buildContext.options.alias,
|
...this.buildContext.options.alias,
|
||||||
'app': this.buildContext.options.appDir,
|
app: this.buildContext.options.appDir,
|
||||||
'nuxt-build': this.buildContext.options.buildDir,
|
'nuxt-build': this.buildContext.options.buildDir,
|
||||||
'vue-meta': require.resolve(`vue-meta${this.isServer ? '' : '/dist/vue-meta.esm.browser.js'}`)
|
'vue-meta': require.resolve(`vue-meta${this.isServer ? '' : '/dist/vue-meta.esm.browser.js'}`)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user