# solid/self-closing-comp Disallow extra closing tags for components without children. This rule is **a warning** by default. [View source](../src/rules/self-closing-comp.ts) ยท [View tests](../test/rules/self-closing-comp.test.ts) ## Rule Options Options shown here are the defaults. ```js { "solid/self-closing-comp": ["warn", { // which Solid components should be self-closing when possible component: "all", // "all" | "none" // which native elements should be self-closing when possible html: "all", // "all" | "void" | "none" }] } ``` ## Tests ### Invalid Examples These snippets cause lint errors, and all of them can be auto-fixed. ```js let el =
; // after eslint --fix: let el =
; let el = ; // after eslint --fix: let el = ; /* eslint solid/self-closing-comp: ["error", { "html": "void" }] */ let el =
; // after eslint --fix: let el =
; /* eslint solid/self-closing-comp: ["error", { "html": "void" }] */ let el =
; // after eslint --fix: let el =
; /* eslint solid/self-closing-comp: ["error", { "html": "none" }] */ let el = ; // after eslint --fix: let el = ; /* eslint solid/self-closing-comp: ["error", { "html": "none" }] */ let el = ; // after eslint --fix: let el = ; let el =
; // after eslint --fix: let el =
; let el = ; // after eslint --fix: let el = ; /* eslint solid/self-closing-comp: ["error", { "component": "none" }] */ let el = ; // after eslint --fix: let el = ; ``` ### Valid Examples These snippets don't cause lint errors. ```js let el = ; let el = ; let el = ( ); let el = ( ); let el = ( ); let el = ( ); let el = ; let el = ; let el = ; let el =
 
; let el =
; /* eslint solid/self-closing-comp: ["error", { "html": "none" }] */ let el =
; /* eslint solid/self-closing-comp: ["error", { "html": "none" }] */ let el = ; /* eslint solid/self-closing-comp: ["error", { "html": "void" }] */ let el =
; /* eslint solid/self-closing-comp: ["error", { "html": "none" }] */ let el =
; /* eslint solid/self-closing-comp: ["error", { "component": "none" }] */ let el = ; ```