Skip to content

Commit

Permalink
Fix: Add unicode-bom to unsatisfiable rules (refs #75)
Browse files Browse the repository at this point in the history
  • Loading branch information
btmills committed Sep 4, 2017
1 parent 7ed8342 commit ce2b94b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
3 changes: 2 additions & 1 deletion lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var remarkParse = require("remark-parse");

var SUPPORTED_SYNTAXES = ["js", "javascript", "node", "jsx"];
var UNSATISFIABLE_RULES = [
"eol-last" // The Markdown parser strips trailing newlines in code fences
"eol-last", // The Markdown parser strips trailing newlines in code fences
"unicode-bom" // Code blocks will begin in the middle of Markdown files
];

var markdown = unified().use(remarkParse);
Expand Down
29 changes: 22 additions & 7 deletions tests/lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,30 @@ describe("processor", function() {
assert.equal(result[4].column, 2);
});

it("should exclude eol-last messages", function() {
var result = processor.postprocess([
[
{ line: 4, column: 3, message: "Newline required at end of file but not found.", ruleId: "eol-last" }
]
]);
describe("should exclude messages from unsatisfiable rules", function() {

it("eol-last", function() {
var result = processor.postprocess([
[
{ line: 4, column: 3, message: "Newline required at end of file but not found.", ruleId: "eol-last" }
]
]);

assert.equal(result.length, 0);
});

it("unicode-bom", function() {
var result = processor.postprocess([
[
{ line: 1, column: 1, message: "Expected Unicode BOM (Byte Order Mark).", ruleId: "unicode-bom" }
]
]);

assert.equal(result.length, 0);
});

assert.equal(result.length, 0);
});

});

});

0 comments on commit ce2b94b

Please sign in to comment.