mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
Merge pull request #47 from cj/eslint/no-console
added no-console to eslint
This commit is contained in:
commit
ce7e47c7f1
@ -21,7 +21,9 @@ module.exports = {
|
|||||||
// allow async-await
|
// allow async-await
|
||||||
'generator-star-spacing': 0,
|
'generator-star-spacing': 0,
|
||||||
// allow debugger during development
|
// allow debugger during development
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
|
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||||
|
// do not allow console.logs etc...
|
||||||
|
'no-console': 2
|
||||||
},
|
},
|
||||||
globals: {}
|
globals: {}
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,13 @@ if (typeof options.rootDir !== 'string') {
|
|||||||
}
|
}
|
||||||
options.dev = false // Create production build when calling `nuxt build`
|
options.dev = false // Create production build when calling `nuxt build`
|
||||||
|
|
||||||
console.log('[nuxt] Building...')
|
console.log('[nuxt] Building...') // eslint-disable-line no-console
|
||||||
const nuxt = new Nuxt(options)
|
const nuxt = new Nuxt(options)
|
||||||
nuxt.build()
|
nuxt.build()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('[nuxt] Building done')
|
console.log('[nuxt] Building done') // eslint-disable-line no-console
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err)
|
console.error(err) // eslint-disable-line no-console
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
|
@ -19,13 +19,13 @@ if (typeof options.rootDir !== 'string') {
|
|||||||
}
|
}
|
||||||
options.dev = false // Force production mode (no webpack middlewares called)
|
options.dev = false // Force production mode (no webpack middlewares called)
|
||||||
|
|
||||||
console.log('[nuxt] Generating...')
|
console.log('[nuxt] Generating...') // eslint-disable-line no-console
|
||||||
const nuxt = new Nuxt(options)
|
const nuxt = new Nuxt(options)
|
||||||
nuxt.generate()
|
nuxt.generate()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('[nuxt] Generate done')
|
console.log('[nuxt] Generate done') // eslint-disable-line no-console
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err)
|
console.error(err) // eslint-disable-line no-console
|
||||||
process.exit()
|
process.exit()
|
||||||
})
|
})
|
||||||
|
@ -39,9 +39,9 @@ const promise = (isProd ? Promise.resolve() : nuxt.build())
|
|||||||
promise.then(() => {
|
promise.then(() => {
|
||||||
app.use(nuxt.render)
|
app.use(nuxt.render)
|
||||||
app.listen(3000)
|
app.listen(3000)
|
||||||
console.log('Server is listening on http://localhost:3000')
|
console.log('Server is listening on http://localhost:3000') // eslint-disable-line no-console
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error)
|
console.error(error) // eslint-disable-line no-console
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
|
@ -282,5 +282,5 @@ Promise.all(resolveComponents)
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error('[nuxt.js] Cannot load components', err)
|
console.error('[nuxt.js] Cannot load components', err) // eslint-disable-line no-console
|
||||||
})
|
})
|
||||||
|
@ -93,9 +93,9 @@ exports.build = function * () {
|
|||||||
*/
|
*/
|
||||||
if (!fs.existsSync(join(this.dir, 'pages'))) {
|
if (!fs.existsSync(join(this.dir, 'pages'))) {
|
||||||
if (fs.existsSync(join(this.dir, '..', 'pages'))) {
|
if (fs.existsSync(join(this.dir, '..', 'pages'))) {
|
||||||
console.error('> No `pages` directory found. Did you mean to run `nuxt` in the parent (`../`) directory?')
|
console.error('> No `pages` directory found. Did you mean to run `nuxt` in the parent (`../`) directory?') // eslint-disable-line no-console
|
||||||
} else {
|
} else {
|
||||||
console.error('> Couldn\'t find a `pages` directory. Please create one under the project root')
|
console.error('> Couldn\'t find a `pages` directory. Please create one under the project root') // eslint-disable-line no-console
|
||||||
}
|
}
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
@ -263,8 +263,8 @@ function webpackWatchAndUpdate () {
|
|||||||
this.webpackServerWatcher = serverCompiler.watch({}, (err, stats) => {
|
this.webpackServerWatcher = serverCompiler.watch({}, (err, stats) => {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
stats = stats.toJson()
|
stats = stats.toJson()
|
||||||
stats.errors.forEach(err => console.error(err))
|
stats.errors.forEach(err => console.error(err)) // eslint-disable-line no-console
|
||||||
stats.warnings.forEach(err => console.warn(err))
|
stats.warnings.forEach(err => console.warn(err)) // eslint-disable-line no-console
|
||||||
createRenderer.call(this, mfs.readFileSync(outputPath, 'utf-8'))
|
createRenderer.call(this, mfs.readFileSync(outputPath, 'utf-8'))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ function webpackRunClient () {
|
|||||||
const serverCompiler = webpack(clientConfig)
|
const serverCompiler = webpack(clientConfig)
|
||||||
serverCompiler.run((err, stats) => {
|
serverCompiler.run((err, stats) => {
|
||||||
if (err) return reject(err)
|
if (err) return reject(err)
|
||||||
console.log('[nuxt:build:client]\n', stats.toString({ chunks: false, colors: true }))
|
console.log('[nuxt:build:client]\n', stats.toString({ chunks: false, colors: true })) // eslint-disable-line no-console
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -287,7 +287,7 @@ function webpackRunServer () {
|
|||||||
const serverCompiler = webpack(serverConfig)
|
const serverCompiler = webpack(serverConfig)
|
||||||
serverCompiler.run((err, stats) => {
|
serverCompiler.run((err, stats) => {
|
||||||
if (err) return reject(err)
|
if (err) return reject(err)
|
||||||
console.log('[nuxt:build:server]\n', stats.toString({ chunks: false, colors: true }))
|
console.log('[nuxt:build:server]\n', stats.toString({ chunks: false, colors: true })) // eslint-disable-line no-console
|
||||||
const bundlePath = join(serverConfig.output.path, serverConfig.output.filename)
|
const bundlePath = join(serverConfig.output.path, serverConfig.output.filename)
|
||||||
readFile(bundlePath, 'utf8')
|
readFile(bundlePath, 'utf8')
|
||||||
.then((bundle) => {
|
.then((bundle) => {
|
||||||
@ -325,7 +325,7 @@ function watchPages () {
|
|||||||
var d = Date.now()
|
var d = Date.now()
|
||||||
co(generateRoutesAndFiles.bind(this))
|
co(generateRoutesAndFiles.bind(this))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('Time to gen:' + (Date.now() - d) + 'ms')
|
console.log('Time to gen:' + (Date.now() - d) + 'ms') // eslint-disable-line no-console
|
||||||
})
|
})
|
||||||
}, 200)
|
}, 200)
|
||||||
this.pagesFilesWatcher = chokidar.watch(patterns, options)
|
this.pagesFilesWatcher = chokidar.watch(patterns, options)
|
||||||
|
@ -72,7 +72,7 @@ module.exports = function () {
|
|||||||
if (route.path.includes(':') || route.path.includes('*')) {
|
if (route.path.includes(':') || route.path.includes('*')) {
|
||||||
const routeParams = this.options.generate.routeParams[route.path]
|
const routeParams = this.options.generate.routeParams[route.path]
|
||||||
if (!routeParams) {
|
if (!routeParams) {
|
||||||
console.error(`Could not generate the dynamic route ${route.path}, please add the mapping params in nuxt.config.js (generate.routeParams).`)
|
console.error(`Could not generate the dynamic route ${route.path}, please add the mapping params in nuxt.config.js (generate.routeParams).`) // eslint-disable-line no-console
|
||||||
return process.exit(1)
|
return process.exit(1)
|
||||||
}
|
}
|
||||||
const toPath = pathToRegexp.compile(route.path)
|
const toPath = pathToRegexp.compile(route.path)
|
||||||
@ -120,8 +120,8 @@ function resolveRouteParams (routeParams) {
|
|||||||
routeParams[routePath] = routeParamsData
|
routeParams[routePath] = routeParamsData
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.error(`Could not resolve routeParams[${routePath}]`)
|
console.error(`Could not resolve routeParams[${routePath}]`) // eslint-disable-line no-console
|
||||||
console.error(e)
|
console.error(e) // eslint-disable-line no-console
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
promises.push(promise)
|
promises.push(promise)
|
||||||
|
@ -5,7 +5,7 @@ const { getContext } = require('./utils')
|
|||||||
|
|
||||||
exports.render = function (req, res) {
|
exports.render = function (req, res) {
|
||||||
if (!this.renderer && !this.dev) {
|
if (!this.renderer && !this.dev) {
|
||||||
console.error('> No build files found, please run `nuxt build` before launching `nuxt start`')
|
console.error('> No build files found, please run `nuxt build` before launching `nuxt start`') // eslint-disable-line no-console
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
if (!this.renderer) {
|
if (!this.renderer) {
|
||||||
|
@ -19,7 +19,7 @@ class Server {
|
|||||||
host = host || 'localhost'
|
host = host || 'localhost'
|
||||||
port = port || 3000
|
port = port || 3000
|
||||||
this.server.listen(port, host, () => {
|
this.server.listen(port, host, () => {
|
||||||
console.log('Ready on http://%s:%s', host, port)
|
console.log('Ready on http://%s:%s', host, port) // eslint-disable-line no-console
|
||||||
})
|
})
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user