From b4d81dc584683807d4b6668532c5db00e28cb7c4 Mon Sep 17 00:00:00 2001 From: Alexander Lichter Date: Fri, 10 Aug 2018 09:41:23 +0200 Subject: [PATCH] lint: require await in async function (#3676) * lint: require await in async function * lint: replace "error" with 2 in config --- .eslintrc.js | 18 +++++++++++------- lib/core/module.js | 2 +- .../basic/pages/callback-async-data.vue | 2 +- .../children/pages/patch/_id/child/_slug.vue | 2 +- test/fixtures/ssr/pages/asyncData.vue | 2 +- test/fixtures/ssr/pages/fetch.vue | 2 +- test/unit/basic.config.defaults.test.js | 4 ++-- test/unit/basic.dev.test.js | 4 ++-- test/unit/basic.fail.generate.test.js | 2 +- test/unit/basic.generate.test.js | 10 +++++----- test/unit/basic.ssr.csp.test.js | 2 +- test/unit/error.test.js | 2 +- test/unit/fallback.generate.test.js | 2 +- test/unit/module.test.js | 6 +++--- 14 files changed, 32 insertions(+), 28 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 18d1fb6447..25c7274cf9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,7 +14,7 @@ module.exports = { 'standard-jsx', 'plugin:import/errors', 'plugin:import/warnings', - "plugin:vue/recommended" + 'plugin:vue/recommended' ], plugins: [ 'vue', @@ -33,7 +33,7 @@ module.exports = { 'import/first': 2, // Other import rules - "import/no-mutable-exports": 2, + 'import/no-mutable-exports': 2, // Allow unresolved imports 'import/no-unresolved': 0, @@ -48,12 +48,16 @@ module.exports = { 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, // Prefer const over let - "prefer-const": ["error", { - "destructuring": "any", - "ignoreReadBeforeAssign": false + 'prefer-const': [2, { + 'destructuring': 'any', + 'ignoreReadBeforeAssign': false }], + + // No async function without await + 'require-await': 2, 'dot-notation': 2, + // Do not allow console.logs etc... 'no-console': 2, 'space-before-function-paren': [2, { @@ -63,8 +67,8 @@ module.exports = { 'vue/no-parsing-error': [2, { 'x-invalid-end-tag': false }], - "vue/max-attributes-per-line": [2, { - "singleline": 5, + 'vue/max-attributes-per-line': [2, { + 'singleline': 5, }] }, diff --git a/lib/core/module.js b/lib/core/module.js index eb8741aaa4..5446cbae16 100644 --- a/lib/core/module.js +++ b/lib/core/module.js @@ -92,7 +92,7 @@ export default class ModuleContainer { return this.addModule(moduleOpts, true /* require once */) } - async addModule(moduleOpts, requireOnce) { + addModule(moduleOpts, requireOnce) { let src let options let handler diff --git a/test/fixtures/basic/pages/callback-async-data.vue b/test/fixtures/basic/pages/callback-async-data.vue index 07481dd1fb..1e72f15ba2 100644 --- a/test/fixtures/basic/pages/callback-async-data.vue +++ b/test/fixtures/basic/pages/callback-async-data.vue @@ -4,7 +4,7 @@