diff --git a/examples/hello-world/pages/about.vue b/examples/hello-world/pages/about.vue index b80110a087..017574200d 100755 --- a/examples/hello-world/pages/about.vue +++ b/examples/hello-world/pages/about.vue @@ -1,7 +1,9 @@ diff --git a/examples/hello-world/pages/index.vue b/examples/hello-world/pages/index.vue index e7113c3ccd..5b3e5ae010 100755 --- a/examples/hello-world/pages/index.vue +++ b/examples/hello-world/pages/index.vue @@ -1,7 +1,9 @@ diff --git a/packages/builder/src/builder.js b/packages/builder/src/builder.js index aedbf2c500..81742d127c 100644 --- a/packages/builder/src/builder.js +++ b/packages/builder/src/builder.js @@ -314,7 +314,7 @@ export default class Builder { })).forEach((f) => { const key = f.replace(/\.(js|vue)$/, '') if (/\.vue$/.test(f) || !files[key]) { - files[key] = f.replace(/('|")/g, '\\$1') + files[key] = f.replace(/(['"])/g, '\\$1') } }) templateVars.router.routes = createRoutes( diff --git a/packages/cli/src/list.js b/packages/cli/src/list.js index 7c129fd037..26200756cd 100644 --- a/packages/cli/src/list.js +++ b/packages/cli/src/list.js @@ -18,7 +18,7 @@ export default async function listCommands() { maxLength = Math.max(maxLength, _commands[name].usage.length) } - const _cmmds = commandsHelp.map(([cmd, description]) => { + const _cmds = commandsHelp.map(([cmd, description]) => { const i = indent(maxLength + optionSpaces - cmd.length) return foldLines( chalk.green(cmd) + i + description, @@ -28,7 +28,7 @@ export default async function listCommands() { }).join('\n') const usage = foldLines(`Usage: nuxt [--help|-h]`, startSpaces) - const cmmds = foldLines(`Commands:`, startSpaces) + '\n\n' + _cmmds + const cmds = foldLines(`Commands:`, startSpaces) + '\n\n' + _cmds - process.stderr.write(colorize(`${usage}\n\n${cmmds}\n\n`)) + process.stderr.write(colorize(`${usage}\n\n${cmds}\n\n`)) } diff --git a/packages/cli/src/utils/formatting.js b/packages/cli/src/utils/formatting.js index 8c4ea86171..78b1c82cdc 100644 --- a/packages/cli/src/utils/formatting.js +++ b/packages/cli/src/utils/formatting.js @@ -31,7 +31,7 @@ export function foldLines(string, spaces, firstLineSpaces, maxCharsPerLine) { export function colorize(text) { return text - .replace(/\[[^ ]+\]/g, m => chalk.grey(m)) + .replace(/\[[^ ]+]/g, m => chalk.grey(m)) .replace(/<[^ ]+>/g, m => chalk.green(m)) .replace(/ (-[-\w,]+)/g, m => chalk.bold(m)) .replace(/`(.+)`/g, (_, m) => chalk.bold.cyan(m)) diff --git a/packages/common/src/utils.js b/packages/common/src/utils.js index 07f0793152..5f890e84d5 100644 --- a/packages/common/src/utils.js +++ b/packages/common/src/utils.js @@ -256,7 +256,7 @@ function cleanChildrenRoutes(routes, isChild = false) { return routes } -const DYNAMIC_ROUTE_REGEX = /^\/(:|\*)/ +const DYNAMIC_ROUTE_REGEX = /^\/([:*])/ const sortRoutes = function sortRoutes(routes) { routes.sort((a, b) => { diff --git a/packages/config/src/options.js b/packages/config/src/options.js index 3e4367b3bb..178fdc3227 100644 --- a/packages/config/src/options.js +++ b/packages/config/src/options.js @@ -70,7 +70,7 @@ export function getNuxtConfig(_options) { defaultsDeep(options, nuxtConfig) - // Check srcDir and generate.dir excistence + // Check srcDir and generate.dir existence const hasSrcDir = isNonEmptyString(options.srcDir) const hasGenerateDir = isNonEmptyString(options.generate.dir) diff --git a/packages/core/src/resolver.js b/packages/core/src/resolver.js index 4fe7500dd4..d364e7e812 100644 --- a/packages/core/src/resolver.js +++ b/packages/core/src/resolver.js @@ -22,10 +22,9 @@ export default class Resolver { resolveModule(path) { try { - const resolvedPath = Module._resolveFilename(path, { + return Module._resolveFilename(path, { paths: this.options.modulesDir }) - return resolvedPath } catch (error) { if (error.code === 'MODULE_NOT_FOUND') { return undefined diff --git a/packages/vue-app/template/App.js b/packages/vue-app/template/App.js index 24461500ba..320a923f53 100644 --- a/packages/vue-app/template/App.js +++ b/packages/vue-app/template/App.js @@ -104,8 +104,8 @@ export default { }, loadLayout(layout) { const undef = !layout - const inexisting = !(layouts['_' + layout] || resolvedLayouts['_' + layout]) - let _layout = '_' + ((undef || inexisting) ? 'default' : layout) + const nonexistent = !(layouts['_' + layout] || resolvedLayouts['_' + layout]) + let _layout = '_' + ((undef || nonexistent) ? 'default' : layout) if (resolvedLayouts[_layout]) { return Promise.resolve(resolvedLayouts[_layout]) } diff --git a/packages/vue-renderer/src/spa-meta.js b/packages/vue-renderer/src/spa-meta.js index 8d0e6a7198..a97e445e63 100644 --- a/packages/vue-renderer/src/spa-meta.js +++ b/packages/vue-renderer/src/spa-meta.js @@ -21,7 +21,7 @@ export default class SPAMetaRenderer { }) } - async getMeta(url) { + async getMeta() { const vm = new Vue({ render: h => h(), // Render empty html tag head: this.options.head || {} @@ -45,7 +45,7 @@ export default class SPAMetaRenderer { } // Get vue-meta context - const m = await this.getMeta(url) + const m = await this.getMeta() // HTML_ATTRS meta.HTML_ATTRS = m.htmlAttrs.text() diff --git a/packages/webpack/src/builder.js b/packages/webpack/src/builder.js index 60065235be..076a38ec1e 100644 --- a/packages/webpack/src/builder.js +++ b/packages/webpack/src/builder.js @@ -31,7 +31,7 @@ export class WebpackBundler { if (this.context.options.dev) { this.mfs = new MFS() - // TODO: Enable when async FS rquired + // TODO: Enable when async FS required // this.mfs.exists = function (...args) { return Promise.resolve(this.existsSync(...args)) } // this.mfs.readFile = function (...args) { return Promise.resolve(this.readFileSync(...args)) } } @@ -108,7 +108,7 @@ export class WebpackBundler { return compiler }) - // Warmup perfLoader before build + // Warm up perfLoader before build if (options.build.parallel) { consola.info('Warming up worker pools') PerfLoader.warmupAll({ dev: options.dev }) @@ -172,7 +172,7 @@ export class WebpackBundler { if (options.build.quiet === true) { return Promise.reject(stats.toString(options.build.stats)) } else { - // Actual error will be printet by webpack + // Actual error will be printed by webpack throw new Error('Nuxt Build Error') } } diff --git a/packages/webpack/src/config/base.js b/packages/webpack/src/config/base.js index c8b090c0da..18c321c9c2 100644 --- a/packages/webpack/src/config/base.js +++ b/packages/webpack/src/config/base.js @@ -90,7 +90,7 @@ export default class WebpackBaseConfig { fileName = fileName(this.nuxtEnv) } if (this.options.dev) { - const hash = /\[(chunkhash|contenthash|hash)(?::(\d+))?\]/.exec(fileName) + const hash = /\[(chunkhash|contenthash|hash)(?::(\d+))?]/.exec(fileName) if (hash) { consola.warn(`Notice: Please do not use ${hash[1]} in dev mode to prevent memory leak`) } diff --git a/packages/webpack/src/plugins/warnfix.js b/packages/webpack/src/plugins/warnfix.js index ae2802a498..582fc422be 100644 --- a/packages/webpack/src/plugins/warnfix.js +++ b/packages/webpack/src/plugins/warnfix.js @@ -1,16 +1,10 @@ export default class WarnFixPlugin { apply(compiler) /* istanbul ignore next */ { compiler.hooks.done.tap('warnfix-plugin', (stats) => { - stats.compilation.warnings = stats.compilation.warnings.filter((warn) => { - if ( - warn.name === 'ModuleDependencyWarning' && + stats.compilation.warnings = stats.compilation.warnings.filter(warn => + !(warn.name === 'ModuleDependencyWarning' && warn.message.includes(`export 'default'`) && - warn.message.includes('nuxt_plugin_') - ) { - return false - } - return true - }) + warn.message.includes('nuxt_plugin_'))) }) } } diff --git a/packages/webpack/src/utils/postcss.js b/packages/webpack/src/utils/postcss.js index 753cf4be8f..fb48315d02 100644 --- a/packages/webpack/src/utils/postcss.js +++ b/packages/webpack/src/utils/postcss.js @@ -118,8 +118,7 @@ export default class PostcssConfig { if (opts === false) { return // Disabled } - const instance = plugin(opts) - return instance + return plugin(opts) }) .filter(Boolean) } diff --git a/test/fixtures/spa/layouts/custom.vue b/test/fixtures/spa/layouts/custom.vue index da28a42595..675f81c88a 100644 --- a/test/fixtures/spa/layouts/custom.vue +++ b/test/fixtures/spa/layouts/custom.vue @@ -1,7 +1,7 @@ diff --git a/test/fixtures/spa/layouts/default.vue b/test/fixtures/spa/layouts/default.vue index 0ac566cd1c..54a18850dc 100644 --- a/test/fixtures/spa/layouts/default.vue +++ b/test/fixtures/spa/layouts/default.vue @@ -1,7 +1,7 @@