-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename to textlint-filter-rule-comments (#2)
* test(fixer): add test * Breaking Change(npm): rename to textlint-filter-rule-comments * chore(readme): fix name of travis
- Loading branch information
Showing
5 changed files
with
175 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
{ | ||
"name": "textlint-rule-ignore-comments", | ||
"name": "textlint-filter-rule-comments", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/textlint/textlint-rule-ignore-comments.git" | ||
"url": "https://github.com/textlint/textlint-filter-rule-comments.git" | ||
}, | ||
"author": "azu", | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/textlint/textlint-rule-ignore-comments", | ||
"homepage": "https://github.com/textlint/textlint-filter-rule-comments", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/textlint/textlint-rule-ignore-comments/issues" | ||
"url": "https://github.com/textlint/textlint-filter-rule-comments/issues" | ||
}, | ||
"files": [ | ||
"src/", | ||
"lib/" | ||
], | ||
"version": "1.1.0", | ||
"description": "textlint rule that ignore texts using comments directive.", | ||
"main": "lib/textlint-rule-ignore-comments.js", | ||
"main": "lib/textlint-filter-rule-comments.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
|
@@ -40,7 +40,7 @@ | |
"mocha": "^2.4.5", | ||
"power-assert": "^1.4.0", | ||
"textlint": "^6.8.0", | ||
"textlint-rule-report-node-types": "^1.0.1" | ||
"textlint-rule-report-node-types": "^1.1.0" | ||
}, | ||
"peerDependencies": { | ||
"textlint": ">=6.8.0" | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
// LICENSE : MIT | ||
"use strict"; | ||
const TextLintCore = require("textlint").TextLintCore; | ||
const TextLintNodeType = require("textlint").TextLintNodeType; | ||
const filterRule = require("../src/textlint-filter-rule-comments"); | ||
const reportRule = require("textlint-rule-report-node-types"); | ||
const assert = require("power-assert"); | ||
describe.skip("textlint-rule-ignore-node-types --fix", function () { | ||
context("no options", function () { | ||
context("when before textlint-enable", function () { | ||
it("should not ignored", function () { | ||
const textlint = new TextLintCore(); | ||
textlint.setupRules({ | ||
ignore: filterRule, | ||
report: reportRule | ||
}, { | ||
report: { | ||
nodeTypes: [TextLintNodeType.Str] | ||
} | ||
}); | ||
return textlint.fixText(` | ||
This is Error. | ||
<!-- textlint-disable --> | ||
This is ignored. | ||
<!-- textlint-enable --> | ||
`, ".md").then(({messages}) => { | ||
console.log(messages); | ||
assert.equal(messages.length, 1); | ||
}); | ||
}); | ||
}); | ||
context("when during disable -- enable", function () { | ||
it("should messages is ignored between disable and enable", function () { | ||
const textlint = new TextLintCore(); | ||
textlint.setupRules({ | ||
ignore: filterRule, | ||
report: reportRule | ||
}, { | ||
report: { | ||
nodeTypes: [TextLintNodeType.Str] | ||
} | ||
}); | ||
return textlint.fixText(` | ||
<!-- textlint-disable --> | ||
This is text. | ||
<!-- textlint-enable --> | ||
`, ".md").then(({messages}) => { | ||
assert.equal(messages.length, 0); | ||
}); | ||
}); | ||
}); | ||
context("when after textlint-enable", function () { | ||
it("should not ignored", function () { | ||
const textlint = new TextLintCore(); | ||
textlint.setupRules({ | ||
ignore: filterRule, | ||
report: reportRule | ||
}, { | ||
report: { | ||
nodeTypes: [TextLintNodeType.Str] | ||
} | ||
}); | ||
return textlint.fixText(` | ||
<!-- textlint-disable --> | ||
This is ignored. | ||
<!-- textlint-enable --> | ||
This is Error. | ||
`, ".md").then(({messages}) => { | ||
assert.equal(messages.length, 1); | ||
}); | ||
}); | ||
}); | ||
}); | ||
context("with ruleId options", function () { | ||
context("when disable <ruleA>", function () { | ||
it("should ignore messages of ruleA", function () { | ||
const textlint = new TextLintCore(); | ||
textlint.setupRules({ | ||
ignore: filterRule, | ||
ruleA: reportRule | ||
}, { | ||
ruleA: { | ||
nodeTypes: [TextLintNodeType.Str] | ||
} | ||
}); | ||
return textlint.fixText(` | ||
<!-- textlint-disable ruleA --> | ||
This is text. | ||
<!-- textlint-enable ruleA --> | ||
`, ".md").then(({messages}) => { | ||
assert.equal(messages.length, 0); | ||
}); | ||
}); | ||
it("should not ignore messages of other rules", function () { | ||
const textlint = new TextLintCore(); | ||
textlint.setupRules({ | ||
ignore: filterRule, | ||
ruleX: reportRule | ||
}, { | ||
ruleX: { | ||
nodeTypes: [TextLintNodeType.Str] | ||
} | ||
}); | ||
return textlint.fixText(` | ||
<!-- textlint-disable ruleA --> | ||
This is text. | ||
<!-- textlint-enable --> | ||
`, ".md").then(({messages}) => { | ||
assert.equal(messages.length, 1); | ||
}); | ||
}); | ||
}); | ||
context("after textlint-enable <ruleA>", function () { | ||
it("should ignore messages of ruleA", function () { | ||
const textlint = new TextLintCore(); | ||
textlint.setupRules({ | ||
ignore: filterRule, | ||
ruleA: reportRule, | ||
ruleB: reportRule | ||
}, { | ||
ruleA: { | ||
nodeTypes: [TextLintNodeType.Str] | ||
}, | ||
ruleB: { | ||
nodeTypes: [TextLintNodeType.Str] | ||
} | ||
}); | ||
return textlint.fixText(` | ||
<!-- textlint-disable ruleA,ruleB --> | ||
This is ignored. RuleA and RuleB | ||
<!-- textlint-enable ruleA --> | ||
This is Error of RuleA. | ||
`, ".md").then(({messages}) => { | ||
assert.equal(messages.length, 1); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters