From 8a87244217df32895abcdd340228ec2d97dbd7d7 Mon Sep 17 00:00:00 2001 From: ota Date: Thu, 28 May 2020 17:01:29 +0900 Subject: [PATCH] Fixed an error for v-slot in `vue/comma-style` rule. --- lib/rules/comma-style.js | 4 +++- tests/lib/rules/comma-style.js | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/rules/comma-style.js b/lib/rules/comma-style.js index 4f7f32b2d..40772dc37 100644 --- a/lib/rules/comma-style.js +++ b/lib/rules/comma-style.js @@ -10,7 +10,9 @@ module.exports = wrapCoreRule(require('eslint/lib/rules/comma-style'), { create(_context, { coreHandlers }) { return { VSlotScopeExpression(node) { - coreHandlers.FunctionExpression(node) + if (coreHandlers.FunctionExpression) { + coreHandlers.FunctionExpression(node) + } } } } diff --git a/tests/lib/rules/comma-style.js b/tests/lib/rules/comma-style.js index 39135a697..f02c3e6d9 100644 --- a/tests/lib/rules/comma-style.js +++ b/tests/lib/rules/comma-style.js @@ -34,6 +34,23 @@ tester.run('comma-style', rule, { , data) => fn()" /> `, options: ['first', { exceptions: { ArrowFunctionExpression: false } }] + }, + { + code: ` + ` + }, + { + code: ` + `, + options: ['first', { exceptions: { FunctionExpression: true } }] } ], invalid: [ @@ -119,6 +136,27 @@ tester.run('comma-style', rule, { // line: 3 // eslint v7.0 } ] + }, + { + code: ` + `, + options: ['last', { exceptions: { FunctionExpression: false } }], + output: ` + `, + errors: [ + { + message: "',' should be placed last." + // line: 3 // eslint v7.0 + } + ] } ] })