@@ -27,27 +27,28 @@ export default createRule("html-self-closing", {
27
27
} ,
28
28
schema : [
29
29
{
30
- enum : [ "all" , "html" , "none" ] ,
31
- default : "all" ,
32
- } ,
33
- {
34
- type : "object" ,
35
- properties : {
36
- void : {
37
- enum : [ "never" , "always" , "ignore" ] ,
38
- } ,
39
- normal : {
40
- enum : [ "never" , "always" , "ignore" ] ,
41
- } ,
42
- component : {
43
- enum : [ "never" , "always" , "ignore" ] ,
30
+ oneOf : [
31
+ {
32
+ properties : {
33
+ void : {
34
+ enum : [ "never" , "always" , "ignore" ] ,
35
+ } ,
36
+ normal : {
37
+ enum : [ "never" , "always" , "ignore" ] ,
38
+ } ,
39
+ component : {
40
+ enum : [ "never" , "always" , "ignore" ] ,
41
+ } ,
42
+ svelte : {
43
+ enum : [ "never" , "always" , "ignore" ] ,
44
+ } ,
45
+ } ,
46
+ additionalProperties : false ,
44
47
} ,
45
- svelte : {
46
- enum : [ "never" , "always" , "ignore" ] ,
47
- } ,
48
- } ,
49
- additionalProperties : false ,
50
- optional : true ,
48
+ {
49
+ enum : [ "all" , "html" , "none" ] ,
50
+ }
51
+ ] ,
51
52
} ,
52
53
] ,
53
54
} ,
@@ -59,30 +60,33 @@ export default createRule("html-self-closing", {
59
60
svelte : "always" ,
60
61
}
61
62
62
- switch ( ctx . options ?. [ 0 ] ?? "" ) {
63
- case "none" :
64
- options = {
65
- void : "never" ,
66
- normal : "never" ,
67
- component : "never" ,
68
- svelte : "never" ,
69
- }
70
- break
71
- case "html" :
72
- options = {
73
- void : "always" ,
74
- normal : "never" ,
75
- component : "never" ,
76
- svelte : "always" ,
77
- }
78
- break
79
- default :
80
- break
81
- }
82
-
83
- options = {
84
- ...options ,
85
- ...ctx . options ?. [ 1 ] ,
63
+ if ( typeof ctx . options ?. [ 0 ] === 'object' ) {
64
+ options = {
65
+ ...options ,
66
+ ...AST . options ?. [ 0 ] ?? { }
67
+ }
68
+ } else {
69
+
70
+ switch ( ctx . options ?. [ 0 ] ?? "" ) {
71
+ case "none" :
72
+ options = {
73
+ void : "never" ,
74
+ normal : "never" ,
75
+ component : "never" ,
76
+ svelte : "never" ,
77
+ }
78
+ break
79
+ case "html" :
80
+ options = {
81
+ void : "always" ,
82
+ normal : "never" ,
83
+ component : "never" ,
84
+ svelte : "always" ,
85
+ }
86
+ break
87
+ default :
88
+ break
89
+ }
86
90
}
87
91
88
92
/**
0 commit comments