The pluggable natural language linter for text and markdown.
MIT License
Bot releases are hidden (Show)
Published by azu almost 2 years ago
Full Changelog: https://github.com/textlint/textlint/compare/v12.5.0...v12.5.1
Published by azu almost 2 years ago
--format=fixed-result
option to fixer format (755dba5), closes #967 by @Sean0628 in https://github.com/textlint/textlint/pull/978
Example:
$ cat README.md | npx textlint --stdin --stdin-filename README.md --fix --format fixed-result --output-file NEW.md
For more details, see https://textlint.github.io/docs/cli.html#pipe-to-textlint
Full Changelog: https://github.com/textlint/textlint/compare/v12.4.0...v12.5.0
Published by azu almost 2 years ago
Full Changelog: https://github.com/textlint/textlint/compare/v12.3.1...v12.4.0
Published by azu almost 2 years ago
createLinter
/loadTextlintrc
/loadLinterFormatter
/loadFixerFormatter
TextLintCore
/TextFixEngine
/TextLintEngine
๐ ESM Rules/Filter/Pluugins only works in createLinter
API.
This is because TextLintCore
/TextFixEngine
/TextLintEngine
were assumed to be synchronous processes.
createLinter
API does loading as async.
No changes in existing CLI.
--stdin-filename
with --stdin
--stdin-filename
may be optional in Old-CLI0
: No Error
1
: Lint Error
2
: Fatal Error
Ww introduce new API like createLinter
for supporting Async APIs.
v13 continue to support current TextLintEngine
and TextFixEngine
for backward compatible.
New createLinter
and loadTextlintrc
support ESM rules/plugins.
In other hands, TextLintEngine
and TextFixEngine
can not support ESM rules/plugins.
API | Description | Behavior | Target Platform | Prev Status | Next Status |
---|---|---|---|---|---|
cli | Command LIne Interface | Async | Node.js | โ | โ ย (Use createTextlint internally) |
textlint | TextLintCore alias | Async | Node.js/CommonJS | โ Deprecated | โ Deprecated |
TextLintCore | Old API. It is Procedural API. Lint Only Single File. Recommended to use @texltint/kernel module instead of It. | Async | Node.js/CommonJS | โ Deprecated | โ Deprecated |
TextLintEngine | Lint Engine API. It load .textlintrc automaticaly | โ Loading is Sync โ Linting is Async | Node.js/CommonJS | โ Recommended | โ Deprecated |
TextFixEngine | Fix Engine API. It load .textlintrc automaticaly | โ Loading is Sync โ Fixing is Async | Node.js/CommonJS | โ Recommended | โ Deprecated |
createLinter/loadTextlintrc | Support Async APIs. | โ Loading is Asyncโ Linting/Fixing is Async | Node.js/CommonJS and ESM | None | โ Recommended |
createLinter
: create linter instance
lintFiles(files)
: lint files and return linter messageslintText(text, filePath)
lint text with virtual filePath and return linter messagesfixFiles(files
lint text and return fixer messagesfixText(text, filePath)
lint text with virtual filePath and return fixer messages
fixFiles
and fixText
does not modify filesloadTextlintrc
: load .textlintrc
config file and return a descriptor objectloadLinerFormatter
and loadFixerFormatter
: load formatterLint files and output to console.
import { createLinter, loadTextlintrc, loadLinterFormatter } from "textlint";
// descriptor is a structure object for linter
// It includes rules, plugins, and options
const descriptor = await loadTextlintrc();
const linter = createLinter({
descriptor
});
const results = await linter.lintFiles(["*.md"]);
// textlint has two types formatter sets for linter and fixer
const formatter = await loadLinterFormatter({ formatterName: "stylish" })
const output = formatter.format(results);
console.log(output);
For more details, see https://textlint.github.io/docs/use-as-modules.html
New CLI is opt-in for avoiding Breaking Changes.
It will be default in next major version.
You can try new textlint CLI via textlint-esm
command.
- $ textlint "**/*.md"
+ $ textlint-esm "**/*.md"
Or, when TEXTLINT_USE_NEW_CLI=1
is set, textlint use new CLI
$ TEXTLINT_USE_NEW_CLI=1 textlint "**/*.md"
๐ฅ Welcome to feedback on Discussion: https://github.com/textlint/textlint/discussions/968
fix #868
fix https://github.com/textlint/textlint/issues/744 - new CLI fix this
fix https://github.com/textlint/textlint/issues/103 - new CLI fix this
fix #797 - extends descriptor
instead of Config
fix #293 - TextlintCore
will be removed in the future
Published by azu almost 2 years ago
This release allow to lint dot file when setting dot file name for extensions
.
{
plugins: {
'@textlint/text': {
extensions: ['.lint-todo'],
},
}
rules: {
'eol-last': true,
}
};
This version can lint .lint-todo
file.
npx textlint .lint-todo
Published by azu almost 2 years ago
Published by azu about 2 years ago
This will fix pnpm issue #903
Published by azu over 2 years ago
Full Changelog: https://github.com/textlint/textlint/compare/v12.1.0...v12.2.1
Published by azu over 2 years ago
Implement Improve error location RFC #835
It will make the error location more details.
This change is for rule developer.
loc
and range
property to TextlintMessage
(result)padding
prorperty to RuleError(message, details)
.locator
object to rule's context
lcoator.at(index)
, locator.range([startIndex, endIndex])
, and locator.loc({ start: { line, column }, end: { line, column }})
.valid
and invalid
support range
propertyindex
, line
and column
property on TextlintMessage
and report
function
filterMessages
to use new range
property on TextlintMessage
readonly [number, number]
as range in all packagesfilterMessages
bug https://github.com/textlint/textlint/pull/836/commits/c8a670f9b4fd7ce628a940dc4c8faabd5e62d396
padding
and locator
objectpeerDependencies
notetextlint v12.2.0 will introduce padding
and locator
.
If your will use it, please add peerDependencies
to package.json
on your rule package.
"peerDependencies": {
"textlint": ">= 12.2.0"
},
"peerDependenciesMeta": {
"textlint": {
"optional": true
}
}
Before:
const { Syntax, report, RuleError } = context;
// .....
report(node, new RuleError(message, {
index: 1
}));
After:
const { Syntax, report, RuleError, locator } = context;
// .....
report(node, new RuleError(message, {
padding: locator.at(1)
}));
If you want to get more correct location, please use locator.range
or locator.loc
const { Syntax, report, RuleError, locator } = context;
// .....
report(node, new RuleError(message, {
padding: locator.range([1, 5]) // The error related to 1 - 5 index.
}));
For more details, see https://textlint.github.io/docs/rule.html#ruleerror
Published by azu over 2 years ago
It will resolve the following audit alert.
ansi-regex 2.1.1 ~ 5.0.0 is vulnerable to Inefficient Regular Expression Complexity: https://github.com/advisories/GHSA-93q8-gq69-wqmw
Thanks to @massongit
Published by azu almost 3 years ago
Published by azu over 3 years ago
The npm dependency [email protected] depends on [email protected] which is vulnerable #801
12.0.2 fixes this dependendies
Published by azu over 3 years ago
This release is addtional fixes for v12.0.0.
Accidentally, 12.0.0 does not include textlint-scirpts
's dependencies.
12.0.1 fix to updatetextlint-scripts
dependencies.
Published by azu over 3 years ago
Blog: https://textlint.github.io/blog/2021/05/24/textlint-12.html
For textlint user
textlint improves markdown parsing, so it may found newer errors.
You can upgrade textlint via following commands:
npm install textlint@12
# or
yarn install textlint@12
textlint 12.0.0 requires Node.js 12+.
If you are using Node.js 10.x, please upgrade your Node.js env.
For textlint rule creator
textlint-tester
and textlint-scripts
are updated.
npm install textlint-scripts@12 --save-dev
# or
yarn install textlint-scripts@12 --dev
textlint-tester@12
use export default
instead of modules.exports =
.
So, you need to use import TextLintTester from "textlint-tester"
instead of const TextLintTester = require("textlint-tester")
.
- const TextLintTester = require("textlint-tester");
+ import TextLintTester from "textlint-tester";
@textlint/*
internal modules use same version
12.0.0
.engines
filels to "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
@textlint/markdown-to-ast@12
use [email protected]
Breaking Changes | Package | Previous version | Current version |
---|---|---|---|
โ | textlint | 11.9.1 | 12.0.0 |
โ | textlint-tester | 5.3.5 | 12.0.0 |
โ | textlint-scripts | 3.0.0 | 12.0.0 |
ใ | @textlint/ast-node-types | 4.4.3 | 12.0.0 |
ใ | @textlint/ast-traverse | 2.3.5 | 12.0.0 |
ใ | @textlint/ast-tester | 2.3.5 | 12.0.0 |
ใ | @textlint/feature-flag | 3.3.5 | 12.0.0 |
ใ | @textlint/fixer-formatter | 3.3.5 | 12.0.0 |
@textlint/kernel | 3.4.5 | 12.0.0 | |
ใ | @textlint/linter-formatter | 3.3.5 | 12.0.0 |
ใ | @textlint/module-interop | 1.2.5 | 12.0.0 |
โ | @textlint/textlint-plugin-markdown | 5.3.5 | 12.0.0 |
ใ | @textlint/textlint-plugin-text | 4.3.5 | 12.0.0 |
โ | @textlint/types | 1.5.5 | 12.0.0 |
@textlint/utils | 1.2.5 | 12.0.0 |
Now, This monorepo includes textlint-scripts
package. #779
Move https://github.com/textlint/textlint-scripts to https://github.com/textlint/textlint/tree/master/packages/textlint-scripts
@textlint/markdown-to-ast
It is a markdown parser in textlint.
We have updated to [email protected] #717 and it has many changes related to Markdown AST
You can see the changes at feat(markdown-to-ast): update to remark-parse@9 #767
It also updates trim
package that is CVE-2020-7753.
FootnoteReference
nodeThe NATO phonetic alphabet[^wiki].
[^wiki]: Read more about it on wikipedia: <http://en.wikipedia.org/wiki/NATO_phonetic_alphabet>.
Previously, It is called LinkReference
, textlint@12 treat it as FootnoteReference
.
Some rules may report new errors on FootnoteReference
.
textlint-tester
export default
instead of export =
#775 #689The textlint-tester
user should use import
instead of require
.
- const TextLintTester = require("textlint-tester");
+ import TextLintTester from "textlint-tester";
Or, pick default
property.
- const TextLintTester = require("textlint-tester");
+ const TextLintTester = require("textlint-tester").default;
textlint-scripts
@textlint/types
getSource
argument type #770@textlint/ast-tester
Discussion: https://github.com/textlint/textlint/discussions/789
12.0.0 beta release
See details in #738.
Please try it and report bugs
npm install textlint@beta
Published by azu over 3 years ago
Published by azu over 3 years ago
Note: Version bump only for package @textlint/kernel
Published by azu over 3 years ago
Note: Version bump only for package gulp-textlint