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/define-macros-order.js b/tests/lib/rules/define-macros-order.js index ef31450c5..bd46ac3d6 100644 --- a/tests/lib/rules/define-macros-order.js +++ b/tests/lib/rules/define-macros-order.js @@ -128,6 +128,26 @@ tester.run('define-macros-order', rule, { parserOptions: { parser: require.resolve('@typescript-eslint/parser') } + }, + { + filename: 'test.vue', + code: ` + + `, + 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 + } + ] } ] })