7
7
8
8
const utils = require ( '../utils' ) ;
9
9
10
+ const defaultOrder = [
11
+ 'filename' ,
12
+ 'code' ,
13
+ 'output' ,
14
+ 'options' ,
15
+ 'parser' ,
16
+ 'languageOptions' , // flat-mode only
17
+ 'parserOptions' , // eslintrc-mode only
18
+ 'globals' , // eslintrc-mode only
19
+ 'env' , // eslintrc-mode only
20
+ 'errors' ,
21
+ ] ;
22
+
10
23
// ------------------------------------------------------------------------------
11
24
// Rule Definition
12
25
// ------------------------------------------------------------------------------
@@ -30,6 +43,7 @@ module.exports = {
30
43
elements : { type : 'string' } ,
31
44
} ,
32
45
] ,
46
+ defaultOptions : [ defaultOrder ] ,
33
47
messages : {
34
48
inconsistentOrder :
35
49
'The properties of a test case should be placed in a consistent order: [{{order}}].' ,
@@ -40,18 +54,7 @@ module.exports = {
40
54
// ----------------------------------------------------------------------
41
55
// Public
42
56
// ----------------------------------------------------------------------
43
- const order = context . options [ 0 ] || [
44
- 'filename' ,
45
- 'code' ,
46
- 'output' ,
47
- 'options' ,
48
- 'parser' ,
49
- 'languageOptions' , // flat-mode only
50
- 'parserOptions' , // eslintrc-mode only
51
- 'globals' , // eslintrc-mode only
52
- 'env' , // eslintrc-mode only
53
- 'errors' ,
54
- ] ;
57
+ const order = context . options [ 0 ] || defaultOrder ;
55
58
const sourceCode = context . sourceCode || context . getSourceCode ( ) ; // TODO: just use context.sourceCode when dropping eslint < v9
56
59
57
60
return {
0 commit comments