The pluggable natural language linter for text and markdown.
MIT License
Bot releases are hidden (Show)
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.
If you want to know for detail, please see the documents: https://github.com/textlint/textlint/blob/master/docs/rule.md#ruleerror
Previously, textlint's RuleError
support line
and column
.
e.g.) It is wrong that column
doen't consider line break.
// surrogate pair
function stringToArray(value) {
return value.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
}
export default function (context) {
let {Syntax, RuleError, report, getSource} = context;
return {
[Syntax.Str](node){
const text = getSource(node);
const strArray = stringToArray(text);
for (let index = 0; index < strArray.length; index++) {
const item = strArray[index];
if (/❌/.test(item)) {
report(node, new RuleError("Use X insteadof ❌", {
column: index
}));
}
}
}
}
}
Input:
string
❌
string
Result of TextLintMessage:
{
"message": "Use X insteadof ❌",
"line": 1,
"column": 7
}
Expected:
{
"message": "Use X insteadof ❌",
"line": 2,
"column": 1
}
5.6.0 allow to write this like
// surrogate pair
function stringToArray(value) {
return value.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
}
export default function (context) {
let {Syntax, RuleError, report, getSource} = context;
return {
[Syntax.Str](node){
const text = getSource(node);
const strArray = stringToArray(text);
for (let index = 0; index < strArray.length; index++) {
const item = strArray[index];
if (/❌/.test(item)) {
report(node, new RuleError("Use X insteadof ❌", {
index: index // <= index
}));
}
}
}
}
}
)
Published by azu over 8 years ago
Published by azu over 8 years ago
Published by azu over 8 years ago
--fix
and --experimental
support ⚠️Status: experimental 🚧
You can use automatically fixes feature with experimental flag.
$ textlint --experimental --fix README.md
# fixed by each rule
Currently, --fix
is unstable(use with --experimental
).
It mean that there is a possibility of change in the future.
Not all rules is fixable.
So, it is difficult that make all rules fixable.
🚧 If you found a bug, please file issue 🆘
ℹ️ Please See Creating fixable rule for detail.
If you want to improve fixable feature, please comment above the issue.
We don't think that this feature is complete 💭
If you see following error
.../node_modules/textlint/lib/textlint-core.js:80
throw new Error('Definition for rule \'' + key + '\' was not found.');
^
Error: Definition for rule 'prh' was not found.
You should update textlint to ^5.5
.
Some rules like textlint-rule-prh
dependent on textlint >= 5.5
.
npm install -D textlint@^5.5
Published by azu over 8 years ago
Published by azu over 8 years ago
fix
options (8fce575)Published by azu over 8 years ago
If you see this warning, please update textlint to 5.4.1.
(node) warning: possible EventEmitter memory leak detected. 11 Str listeners added. Use emitter.setMaxListeners() to increase limit.
Published by azu over 8 years ago
--init
option like eslint. #127 by @takahashimtextlint --init
create a .textlintrc
file in your directory.
$ textlint --init
If you are instersted in improving this, please see --init options: Create .textlintrc file #129