@@ -11,12 +11,14 @@ const MACROS_PROPS = 'defineProps'
11
11
const MACROS_OPTIONS = 'defineOptions'
12
12
const MACROS_SLOTS = 'defineSlots'
13
13
const MACROS_MODEL = 'defineModel'
14
- const ORDER_SCHEMA = new Set ( [
14
+ const MACROS_EXPOSE = 'defineExpose'
15
+ const KNOWN_MACROS = new Set ( [
15
16
MACROS_EMITS ,
16
17
MACROS_PROPS ,
17
18
MACROS_OPTIONS ,
18
19
MACROS_SLOTS ,
19
- MACROS_MODEL
20
+ MACROS_MODEL ,
21
+ MACROS_EXPOSE
20
22
] )
21
23
const DEFAULT_ORDER = [ MACROS_PROPS , MACROS_EMITS ]
22
24
@@ -133,12 +135,11 @@ function create(context) {
133
135
} ,
134
136
135
137
'CallExpression:exit' ( node ) {
136
- // check if the node is a macro in the order
137
138
if (
138
139
node . callee &&
139
140
node . callee . type === 'Identifier' &&
140
141
order . includes ( node . callee . name ) &&
141
- ! ORDER_SCHEMA . has ( node . callee . name )
142
+ ! KNOWN_MACROS . has ( node . callee . name )
142
143
) {
143
144
macrosNodes . set ( node . callee . name , [ getDefineMacrosStatement ( node ) ] )
144
145
}
@@ -344,8 +345,7 @@ module.exports = {
344
345
meta : {
345
346
type : 'layout' ,
346
347
docs : {
347
- description :
348
- 'enforce order of `defineEmits` and `defineProps` compiler macros' ,
348
+ description : 'enforce order of specified compiler macros.' ,
349
349
categories : undefined ,
350
350
url : 'https://eslint.vuejs.org/rules/define-macros-order.html'
351
351
} ,
@@ -358,8 +358,8 @@ module.exports = {
358
358
order : {
359
359
type : 'array' ,
360
360
items : {
361
- type : string ,
362
- minLength : 1
361
+ type : ' string' ,
362
+ minLength : 1
363
363
} ,
364
364
uniqueItems : true ,
365
365
additionalItems : false
0 commit comments