Skip to content

Commit

Permalink
Fix false negatives with noEmptyLineBetween in combination with the…
Browse files Browse the repository at this point in the history
… `order: "flexible"`

Closes #82
  • Loading branch information
hudochenkov committed Apr 9, 2019
1 parent 433524b commit a1df43f
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions rules/properties-order/createExpectedOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = function createExpectedOrder(input) {

if (item.order && item.order === 'flexible') {
expectedPosition += 1;
groupPosition += 1;

item.properties.forEach(property => {
appendItem(property, true, item);
Expand Down
93 changes: 93 additions & 0 deletions rules/properties-order/tests/no-empty-line-between.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,96 @@ testRule(rule, {
},
],
});

testRule(rule, {
ruleName,
config: [
[
{
emptyLineBefore: 'always',
noEmptyLineBetween: true,
order: 'flexible',
properties: ['height', 'width'],
},
{
emptyLineBefore: 'always',
noEmptyLineBetween: true,
order: 'flexible',
properties: ['font-size', 'font-weight'],
},
],
],
fix: true,

accept: [
{
code: `
a {
height: 1px;
width: 2px;
font-size: 2px;
font-weight: bold;
}
`,
},
{
code: `
a {
height: 1px;
width: 2px;
font-weight: bold;
font-size: 2px;
}
`,
},
],

reject: [
{
code: `
a {
height: 1px;
width: 2px;
font-weight: bold;
font-size: 2px;
}
`,
fixed: `
a {
height: 1px;
width: 2px;
font-weight: bold;
font-size: 2px;
}
`,
message: messages.rejectedEmptyLineBefore('font-size'),
},
{
code: `
a {
height: 1px;
width: 2px;
font-size: 2px;
font-weight: bold;
}
`,
fixed: `
a {
height: 1px;
width: 2px;
font-size: 2px;
font-weight: bold;
}
`,
message: messages.rejectedEmptyLineBefore('font-weight'),
},
],
});

0 comments on commit a1df43f

Please sign in to comment.