The pluggable natural language linter for text and markdown.
MIT License
Bot releases are visible (Hide)
See https://github.com/textlint/textlint/blob/master/docs/rule.md#implementation-node-memo for details.
These features are experimental
You can use it with --experimental
flag
$ textlint --experimental
Duplicated messages is ignored by default.
Duplicated messages is that have same position information(index) and same message.
Proposal #212 and implement #214
Support "filters" field and Drop support "ignoring-rule"
These are experimental feature. 🚧
See filter rule document for details.
{
"filters": {
"node-types": {
"nodeTypes": ["BlockQuote"]
}
},
"rules": {}
}
shouldIgnore(range, { ruleId })
API
shouldIgnore
.internal
MessageProcessManager
.TextLintMessage
s.{ ruleId }
option object to shouldIgnore
(#208) (de0ff6f)When the ruleId
of option object is matched ruleId of error message, filter only the message,
Default is filter all message in the ignoring range.
https://github.com/textlint/textlint-rule-ignore-comment
<!-- textlint-disable ruleA -->
this is wrong
<!-- textlint-enable -->
Disable specific rule on the fly.
shouldIgnore(range)
only ignore messages of the ruleId
.
It means that shouldIgnore(range)
=== shouldIgnore(range, { ruleId : this.id })
.
It attempt to make safe by default.
"*"
is danger because "*"
affect to other rules.
Published by azu over 8 years ago
shouldIgnore(range)
API #203Previously, ignoring api is shouldIgnore(<node>)
. #194
But, I think that shouldIgnore([start, end])
is better.
Because, ignoring rule is not always depended on .
It always depended on <range>
which is like [number, number]
.
This change is breaking change, but ignoring feature is experimental support.
As as result, we have published as minor version.
Fix: #202
Refs: #193
Published by azu over 8 years ago
You can use this TextLintNodeType
value by the following way:
import {TextLintNodeType} from "textlint";
console.log(TextLintNodeType.Str); // "Str"
Please see https://github.com/textlint/textlint/blob/master/docs/txtnode.md
Ignore rule is experimental. It used with --experimental
.
Please see https://github.com/textlint/textlint/blob/master/docs/rule.md
context.shouldIgnore(node)
🆕Show where the error is occurring.
When throw error in the rule.
module.exports = function (context) {
var exports = {};
exports[context.Syntax.Str + ":exit"] = function () {
throw new Error("Error in rule");
};
return exports;
};
Before:
Error in rule
After:
Error in rule at ~/textlint/textlint/test/rule-context/fixtures/test.md
See Sharable Configuration for details.
Example : azu/textlint-config-readme: Sharable config for textlint
You can use the config via two step.
npm i -D @azu/textlint-config-readme textlint
$(npm bin)/textlint --config @azu/textlint-config-readme README.md
Published by azu over 8 years ago
Published by azu over 8 years ago
EDIT It is reverted and released 6.1.1.
https://github.com/textlint/textlint/commit/3651f9df61738d1ab49752885138cf436d8675e5
https://github.com/textlint/textlint/commit/106da2f7fa8ae927266df346cbbc89759417c6f7
This change break some test case that has a implementation dependent.
Published by azu over 8 years ago
e.g.) https://github.com/textlint/textlint-plugin-html
When load a plugin, then textlint take cognizance available extensions like ".html".
But, textlint v6.0.3 could not add the additional extension to engine.availableExtensions
.
As as result, alway passed! It is wrong.
Published by azu over 8 years ago
@azer has unpublished all his npm module.
textlint-formatter depened on his modules.
We have fixed ths issue and patch release.
TxtAST
https://github.com/textlint/textlint/blob/master/docs/txtnode.d.ts
TxtNode
to ParentNode
(block) and TextNode
(inline)value
property to TextNodePublished by azu over 8 years ago
These changes won't affect user.
TextLintEngine#setRulesBaseDirectory
Please use
new TextLintEngine({
rulesBaseDirectory: directory
});
--experimental
flag from --fix
TextLintEngine#fixFiles(files)
and TextLintEngine# fixText(text, ext = ".txt")
have been removed at 6.0.
It was introduced at 5.5.3: --fix & --experimental support.
After hard refactoring, TextLintEngine
was split to TextFixEngine
and TextLintEngine
.
Please use TextFixEngine
instead of above method.
TextFixEngine#executeOnFiles(files): TextLintFixResult[]
TextFixEngine#executeOnText(text, evt): TextLintFixResult[]
TextFixEngine
(ae6aacc) #146TextLintCore#setupProcessors
(76ad42e) #146--fix
https://github.com/textlint/textlint/releases/tag/5.5.3
--dry-run
(9aef49f) #150--fix
textlint 5.5~ introduces the --fix
command line argument to automatically fix some rules.
$ textlint --fix README.md
# fixed by each rule
Lint: textlint README.md
Fix: textlint --fix --dry-run -f diff README.md
with dry-run mode
Actually Fix: textlint --fix README.md
📝
Not all rules is fixable.
So, it is difficult that make all rules fixable.
You check textlint/textlint Wiki also.
ℹ️ Please See Creating fixable rule for detail.
Please use textlint-tester.
Published by azu over 8 years ago
This is beta release of 6.0
Please test it!
npm i -D textlint@beta
Please see textlint 6.0 · Issue #145 · textlint/textlint
--format stylish
and --format pretty-error
show _fixable problem_s.