diff --git a/lib/rules/component-api-style.js b/lib/rules/component-api-style.js index 12ad52e2d..550eebfed 100644 --- a/lib/rules/component-api-style.js +++ b/lib/rules/component-api-style.js @@ -162,7 +162,7 @@ function buildAllowedPhrase(allowsOpt) { phrases.push('Options API') } return phrases.length > 2 - ? `${phrases.slice(0, -1).join(',')} or ${phrases.slice(-1)[0]}` + ? `${phrases.slice(0, -1).join(', ')} or ${phrases.slice(-1)[0]}` : phrases.join(' or ') } diff --git a/lib/rules/define-macros-order.js b/lib/rules/define-macros-order.js index 24e7f8085..baf03a40e 100644 --- a/lib/rules/define-macros-order.js +++ b/lib/rules/define-macros-order.js @@ -137,7 +137,7 @@ function create(context) { // need move only second if (secondStatement !== shouldSecondNode) { - reportNotOnTop(order[1], shouldSecondNode, shouldFirstNode) + reportNotOnTop(order[1], shouldSecondNode, secondStatement) } return diff --git a/tests/lib/rules/component-api-style.js b/tests/lib/rules/component-api-style.js index 534751254..a33321251 100644 --- a/tests/lib/rules/component-api-style.js +++ b/tests/lib/rules/component-api-style.js @@ -817,6 +817,31 @@ tester.run('component-api-style', rule, { column: 9 } ] + }, + { + filename: 'test.vue', + code: ` + + `, + options: [['script-setup', 'composition', 'composition-vue2']], + errors: [ + { + message: + 'Options API is not allowed in your project. `data` option is part of the Options API. Use ` + `, + options: optionsPropsFirst + }, + { + filename: 'test.vue', + code: ` + + ` } ], invalid: [ @@ -454,6 +474,52 @@ tester.run('define-macros-order', rule, { line: 2 } ] + }, + { + filename: 'test.vue', + code: ` + + `, + output: ` + + `, + options: optionsEmitsFirst, + errors: [ + { + message: message('defineProps'), + line: 4 + } + ] + }, + { + filename: 'test.vue', + code: ` + + `, + output: ` + + `, + options: optionsEmitsFirst, + errors: [ + { + message: message('defineProps'), + line: 5 + } + ] } ] }) diff --git a/tests/lib/rules/max-attributes-per-line.js b/tests/lib/rules/max-attributes-per-line.js index d8bae0580..252bd22c1 100644 --- a/tests/lib/rules/max-attributes-per-line.js +++ b/tests/lib/rules/max-attributes-per-line.js @@ -113,6 +113,27 @@ job="Vet">`, options: [{ singleline: 3, multiline: 1 }], output: ``, + errors: [ + { + message: "'age' should be on a new line.", + type: 'VAttribute', + line: 2 + } + ] + }, + { + code: ``, + options: [{ multiline: { max: 1 } }], + output: `