Skip to content

Commit

Permalink
fix(config:vue): allow void elements in "vue/html-self-closing" (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal authored Nov 7, 2020
1 parent 5be7062 commit dfff99b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
1 change: 1 addition & 0 deletions __tests__/fixtures/component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</div>
</transition>

<input type="text" name="my-input" />
<slot />

<MyComponent>
Expand Down
20 changes: 4 additions & 16 deletions __tests__/functional.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,33 +87,27 @@ describe('Functional', function () {
"message": "Component name \\"transition\\" is not PascalCase.",
"ruleId": "vue/component-name-in-template-casing",
},
Object {
"column": 9,
"line": 7,
"message": "Disallow self-closing on HTML void elements (<img/>).",
"ruleId": "vue/html-self-closing",
},
Object {
"column": 29,
"line": 14,
"line": 15,
"message": "Delete \`·\`",
"ruleId": "prettier/prettier",
},
Object {
"column": 5,
"line": 19,
"line": 20,
"message": "Component name \\"v-component\\" is not PascalCase.",
"ruleId": "vue/component-name-in-template-casing",
},
Object {
"column": 5,
"line": 31,
"line": 32,
"message": "Unexpected console statement.",
"ruleId": "no-console",
},
Object {
"column": 17,
"line": 31,
"line": 32,
"message": "Replace \`\\"Hello·world!\\"\` with \`'Hello·world!'\`",
"ruleId": "prettier/prettier",
},
Expand Down Expand Up @@ -147,12 +141,6 @@ describe('Functional', function () {
"message": "Replace \`⏎········my·image:·<img·src=\\"https://example.com/image.png\\"·/>⏎······\` with \`my·image:·<img·src=\\"https://example.com/image.png\\"·/>\`",
"ruleId": "prettier/prettier",
},
Object {
"column": 19,
"line": 6,
"message": "Disallow self-closing on HTML void elements (<img/>).",
"ruleId": "vue/html-self-closing",
},
Object {
"column": 28,
"line": 13,
Expand Down
2 changes: 1 addition & 1 deletion src/config-generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Configuration generator', function () {
registeredComponentsOnly: false,
},
],
'vue/html-self-closing': ['error'],
'vue/html-self-closing': ['error', { html: { void: 'always' } }],
'vue/no-duplicate-attr-inheritance': ['error'],
'vue/no-empty-component-block': ['error'],
'vue/no-template-target-blank': ['error'],
Expand Down
2 changes: 1 addition & 1 deletion src/config-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function configureVue(previousConfig: ESLintConfig, options: Options): ESLintCon
registeredComponentsOnly: false,
},
],
'vue/html-self-closing': ['error'],
'vue/html-self-closing': ['error', { html: { void: 'always' } }],
'vue/no-duplicate-attr-inheritance': ['error'],
'vue/no-empty-component-block': ['error'],
'vue/no-template-target-blank': ['error'],
Expand Down

0 comments on commit dfff99b

Please sign in to comment.