Skip to content

Commit

Permalink
Update list-item-spacing message
Browse files Browse the repository at this point in the history
Closes GH-60.
Closes GH-62.
  • Loading branch information
despairblue authored and wooorm committed Jun 6, 2016
1 parent 019ff36 commit d562d6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
15 changes: 11 additions & 4 deletions lib/rules/list-item-spacing.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,17 @@ function listItemSpacing(ast, file, preferred, done) {
*/

if (isTight !== isTightList) {
file.warn('List item should be ' + type + ', isn’t', {
'start': end(item),
'end': start(next)
});
if (type === 'loose') {
file.warn('Missing new line after list item', {
'start': end(item),
'end': start(next)
});
} else {
file.warn('Extraneous new line after list item', {
'start': end(item),
'end': start(next)
});
}
}
});
});
Expand Down
8 changes: 4 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1416,13 +1416,13 @@ describe('Rules', function () {
describeRule('list-item-spacing', function () {
describeSetting(true, function () {
assertFile('list-item-spacing-tight-invalid.md', [
'list-item-spacing-tight-invalid.md:2:1-3:1: List item should be tight, isn’t',
'list-item-spacing-tight-invalid.md:4:1-5:1: List item should be tight, isn’t'
'list-item-spacing-tight-invalid.md:2:1-3:1: Extraneous new line after list item',
'list-item-spacing-tight-invalid.md:4:1-5:1: Extraneous new line after list item'
]);

assertFile('list-item-spacing-loose-invalid.md', [
'list-item-spacing-loose-invalid.md:2:9-3:1: List item should be loose, isn’t',
'list-item-spacing-loose-invalid.md:3:11-4:1: List item should be loose, isn’t'
'list-item-spacing-loose-invalid.md:2:9-3:1: Missing new line after list item',
'list-item-spacing-loose-invalid.md:3:11-4:1: Missing new line after list item'
]);

assertFile('list-item-spacing-tight-valid.md', []);
Expand Down

0 comments on commit d562d6e

Please sign in to comment.