Skip to content

Commit 796611e

Browse files
author
Filipa Lacerda
committed
Improves code coverage
1 parent 39d0743 commit 796611e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lib/rules/max-attributes-per-line.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ module.exports = {
113113
if (options.multiline) {
114114
if (typeof options.multiline === 'number') {
115115
defaults.multiline = options.multiline
116-
} else if (options.multiline) {
116+
} else if (typeof options.multiline === 'object') {
117117
if (options.multiline.max) {
118118
defaults.multiline = options.multiline.max
119119
}

lib/utils/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ module.exports = {
402402
/**
403403
* Check whether the component is declared in a single line or not.
404404
* @param {ASTNode} node
405-
* @returns {boolean
405+
* @returns {boolean}
406406
*/
407407
isSingleLine (node) {
408408
return node.loc.start.line === node.loc.end.line

tests/lib/rules/max-attributes-per-line.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ ruleTester.run('max-attributes-per-line', rule, {
9393
</template>`,
9494
errors: ['Attribute "job" should be on a new line.']
9595
},
96+
{
97+
code: `<template><component name="John Doe" age="30"></component></template>`,
98+
options: [{ singleline: { max: 1 }}],
99+
errors: ['Attribute "age" should be on a new line.']
100+
},
96101
{
97102
code: `<template><component name="John Doe" age="30" job="Vet"></component></template>`,
98103
options: [{ singleline: 1, multiline: { max: 1, allowFirstLine: false }}],
@@ -115,6 +120,15 @@ ruleTester.run('max-attributes-per-line', rule, {
115120
options: [{ singleline: 3, multiline: { max: 1, allowFirstLine: false }}],
116121
errors: ['Attribute "age" should be on a new line.']
117122
},
123+
{
124+
code: `<template><component
125+
name="John Doe" age="30"
126+
job="Vet">
127+
</component>
128+
</template>`,
129+
options: [{ singleline: 3, multiline: 1 }],
130+
errors: ['Attribute "age" should be on a new line.']
131+
},
118132
{
119133
code: `<template><component
120134
name="John Doe" age="30"

0 commit comments

Comments
 (0)