@@ -35,6 +35,28 @@ const messages = {
3535 spaceNeededBefore : 'A space is required before \'{{token}}\'' ,
3636} ;
3737
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+
3860/** @type {import('eslint').Rule.RuleModule } */
3961module . exports = {
4062 meta : {
@@ -50,49 +72,25 @@ module.exports = {
5072
5173 schema : {
5274 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- } ,
7275 basicConfigOrBoolean : {
73- anyOf : [ {
74- $ref : '#/definitions/basicConfig' ,
75- } , {
76+ anyOf : [ BASIC_CONFIG_SCHEMA , {
7677 type : 'boolean' ,
7778 } ] ,
7879 } ,
7980 } ,
8081 type : 'array' ,
8182 items : [ {
8283 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' ,
9488 } ,
95- } ] ,
89+ children : {
90+ $ref : '#/definitions/basicConfigOrBoolean' ,
91+ } ,
92+ } ) ,
93+ additionalProperties : false ,
9694 } , {
9795 enum : SPACING_VALUES ,
9896 } ] ,
@@ -109,6 +107,7 @@ module.exports = {
109107 enum : SPACING_VALUES ,
110108 } ,
111109 } ,
110+ additionalProperties : false ,
112111 } ,
113112 } ,
114113 additionalProperties : false ,
0 commit comments