@@ -35,6 +35,28 @@ const messages = {
35
35
spaceNeededBefore : 'A space is required before \'{{token}}\'' ,
36
36
} ;
37
37
38
+ const BASIC_CONFIG_SCHEMA = {
39
+ type : 'object' ,
40
+ properties : {
41
+ when : {
42
+ enum : SPACING_VALUES ,
43
+ } ,
44
+ allowMultiline : {
45
+ type : 'boolean' ,
46
+ } ,
47
+ spacing : {
48
+ type : 'object' ,
49
+ properties : {
50
+ objectLiterals : {
51
+ enum : SPACING_VALUES ,
52
+ } ,
53
+ } ,
54
+ additionalProperties : false ,
55
+ } ,
56
+ } ,
57
+ additionalProperties : false ,
58
+ } ;
59
+
38
60
/** @type {import('eslint').Rule.RuleModule } */
39
61
module . exports = {
40
62
meta : {
@@ -50,49 +72,25 @@ module.exports = {
50
72
51
73
schema : {
52
74
definitions : {
53
- basicConfig : {
54
- type : 'object' ,
55
- properties : {
56
- when : {
57
- enum : SPACING_VALUES ,
58
- } ,
59
- allowMultiline : {
60
- type : 'boolean' ,
61
- } ,
62
- spacing : {
63
- type : 'object' ,
64
- properties : {
65
- objectLiterals : {
66
- enum : SPACING_VALUES ,
67
- } ,
68
- } ,
69
- } ,
70
- } ,
71
- } ,
72
75
basicConfigOrBoolean : {
73
- anyOf : [ {
74
- $ref : '#/definitions/basicConfig' ,
75
- } , {
76
+ anyOf : [ BASIC_CONFIG_SCHEMA , {
76
77
type : 'boolean' ,
77
78
} ] ,
78
79
} ,
79
80
} ,
80
81
type : 'array' ,
81
82
items : [ {
82
83
anyOf : [ {
83
- allOf : [ {
84
- $ref : '#/definitions/basicConfig' ,
85
- } , {
86
- type : 'object' ,
87
- properties : {
88
- attributes : {
89
- $ref : '#/definitions/basicConfigOrBoolean' ,
90
- } ,
91
- children : {
92
- $ref : '#/definitions/basicConfigOrBoolean' ,
93
- } ,
84
+ type : 'object' ,
85
+ properties : Object . assign ( BASIC_CONFIG_SCHEMA . properties , {
86
+ attributes : {
87
+ $ref : '#/definitions/basicConfigOrBoolean' ,
94
88
} ,
95
- } ] ,
89
+ children : {
90
+ $ref : '#/definitions/basicConfigOrBoolean' ,
91
+ } ,
92
+ } ) ,
93
+ additionalProperties : false ,
96
94
} , {
97
95
enum : SPACING_VALUES ,
98
96
} ] ,
@@ -109,6 +107,7 @@ module.exports = {
109
107
enum : SPACING_VALUES ,
110
108
} ,
111
109
} ,
110
+ additionalProperties : false ,
112
111
} ,
113
112
} ,
114
113
additionalProperties : false ,
0 commit comments