Skip to content

Commit

Permalink
Rename to textlint-filter-rule-comments (#2)
Browse files Browse the repository at this point in the history
* test(fixer): add test

* Breaking Change(npm): rename to textlint-filter-rule-comments

* chore(readme): fix name of travis
  • Loading branch information
azu committed May 29, 2016
1 parent a423c73 commit d045284
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 18 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# textlint-rule-ignore-comments [![Build Status](https://travis-ci.org/textlint/textlint-rule-ignore-comment.svg?branch=master)](https://travis-ci.org/textlint/textlint-rule-ignore-comment)
# textlint-filter-rule-comments [![Build Status](https://travis-ci.org/textlint/textlint-filter-rule-comments.svg?branch=master)](https://travis-ci.org/textlint/textlint-filter-rule-comments)

textlint rule that ignore texts using comments directive.

## Install

Install with [npm](https://www.npmjs.com/):

npm install textlint-rule-ignore-comments
npm install textlint-filter-rule-comments

Dependencies:

- [textlint](http://textlint.github.io/ "textlint") >= 6.8
- [textlint](http://textlint.github.io/ "textlint") >= 6.9

## Usage

Expand Down Expand Up @@ -115,7 +115,7 @@ textlint --rule ignore-comments README.md

## Changelog

See [Releases page](https://github.com/textlint/textlint-rule-ignore-comments/releases).
See [Releases page](https://github.com/textlint/textlint-filter-rule-comments/releases).

## Acknowledgement

Expand All @@ -130,7 +130,7 @@ Install devDependencies and Run `npm test`:
## Contributing

Pull requests and stars are always welcome.
For bugs and feature requests, [please create an issue](https://github.com/textlint/textlint-rule-ignore-comments/issues).
For bugs and feature requests, [please create an issue](https://github.com/textlint/textlint-filter-rule-comments/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
Expand Down
12 changes: 6 additions & 6 deletions package.json
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"
},
Expand All @@ -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"
Expand Down
File renamed without changes.
157 changes: 157 additions & 0 deletions test/textlint-filter-rule-comments-fix-test.js
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);
});
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"use strict";
const TextLintCore = require("textlint").TextLintCore;
const TextLintNodeType = require("textlint").TextLintNodeType;
const ignoreRule = require("../src/textlint-rule-ignore-comments");
const filterRule = require("../src/textlint-filter-rule-comments");
const reportRule = require("textlint-rule-report-node-types");
const assert = require("power-assert");
describe("textlint-rule-ignore-node-types", function () {
Expand All @@ -11,7 +11,7 @@ describe("textlint-rule-ignore-node-types", function () {
it("should not ignored", function () {
const textlint = new TextLintCore();
textlint.setupRules({
ignore: ignoreRule,
ignore: filterRule,
report: reportRule
}, {
report: {
Expand All @@ -35,7 +35,7 @@ This is ignored.
it("should messages is ignored between disable and enable", function () {
const textlint = new TextLintCore();
textlint.setupRules({
ignore: ignoreRule,
ignore: filterRule,
report: reportRule
}, {
report: {
Expand All @@ -57,7 +57,7 @@ This is text.
it("should not ignored", function () {
const textlint = new TextLintCore();
textlint.setupRules({
ignore: ignoreRule,
ignore: filterRule,
report: reportRule
}, {
report: {
Expand All @@ -84,7 +84,7 @@ This is Error.
it("should ignore messages of ruleA", function () {
const textlint = new TextLintCore();
textlint.setupRules({
ignore: ignoreRule,
ignore: filterRule,
ruleA: reportRule
}, {
ruleA: {
Expand All @@ -104,7 +104,7 @@ This is text.
it("should not ignore messages of other rules", function () {
const textlint = new TextLintCore();
textlint.setupRules({
ignore: ignoreRule,
ignore: filterRule,
ruleX: reportRule
}, {
ruleX: {
Expand All @@ -126,7 +126,7 @@ This is text.
it("should ignore messages of ruleA", function () {
const textlint = new TextLintCore();
textlint.setupRules({
ignore: ignoreRule,
ignore: filterRule,
ruleA: reportRule,
ruleB: reportRule
}, {
Expand Down

0 comments on commit d045284

Please sign in to comment.