textlint v14.0.0
We are pleased to announce the release of textlint v14.0.0. This release includes a number of new features and improvements.
Summary
textlint v14 requires Node.js v18.14.0;.
Node.js 16 is already EOL, so we drop support for Node.js 16. If you use older Node.js, you need to upgrade Node.js to LTS(Long Term Support) version.
Breaking Changes for user
Drop Node.js 16 support
textlint v14 requires Node.js v18.14.0+. You need to upgrade Node.js to 18 or 20.
For textlint developer, textlint-scripts
also requires Node.js v18.19.0+.
gulp-textlint
to out of monorepo
Move We move gulp-textlint
to out of monorepo.
- chore!: move gulp-textlint to out of monorepo by azu · Pull Request #1319 · textlint/textlint
- textlint/gulp-textlint
gulp-textlint
is not maintained by textlint core team.
If you interested in gulp-textlint
, please check the following issue:
--parallel
and --maxConcurrency
flag
Remove textlint v14 removes --parallel
and --maxConcurrency
flag.
This flag is for parallel linting, but It is not used by many users.
We may visit again, but we will delete this experimental flag once.
- Issue: Parallel linting · Issue #633 · textlint/textlint
- PR: fix(textlint): remove
--parallel
and--maxConcurrency
flag by azu · Pull Request #1338 · textlint/textlint
@textlint/linter-formatter
CLI
Remove @textlint/linter-formatter
includes CLI, but it is not used by many users.
So, we remove the CLI from @textlint/linter-formatter
.
- PR: Removes CLI from @textlint/linter-formatter by kapooraryan · Pull Request #1272 · textlint/textlint
Breaking Changes for developer
Change textlint-scirpts output target
textlint-scripts
output target is changed to Node.js v18.14.0.
Previously, It output ES2015-compatible JavaScript. In textlint v14, It outputs ES2022-compatible JavaScript.
It means that textlint-scripts
output JavaScript is compatible with Node.js v18.14.0+.
It aims to support the latest JavaScript features and improve the performance of the output.
Add deprecation warning to old APIs
textlint v14 adds a deprecation warning to old APIs.
Old APIs are textlint
, TextLintCore
, TextLintEngine
, and TextFixEngine
of textlint
package.
There are replaced by createLinter
and loadTextlintrc
, and loadLinerFormatter
since v13.0.0.
Depretead old APIs
Depreacate four APIs in textlint
package.
Old API | New API |
---|---|
textlint | use @textlint/legacy-textlint-core or @textlint/kernel |
TextLintCore | use @textlint/legacy-textlint-core or @textlint/kernel |
TextLintEngine | use createLinter and loadTextlintrc |
TextFixEngine | use createLinter and loadTextlintrc |
How to control the deprecation message?
- If the
NODE_OPTIONS=--throw-deprecation
is used, the deprecation warning is thrown as an exception rather than being emitted as an event. - If the
NODE_OPTIONS=--no-deprecation
is used, the deprecation warning is suppressed. - If the
NODE_OPTIONS=--trace-deprecation
is used, the deprecation warning is printed to stderr along with the full stack trace.
If you want to find the usage of deprecation APIs, you can run with NODE_OPTIONS=--throw-deprecation
env.
NODE_OPTIONS=--throw-deprecation node your-script.js
For more details, see process.emitWarning(warning[, options]).
Documentaion for New APIs
Migration Guide
TextLintEngine
/TextFixEngine
migration
Use createLinter
and loadTextlintrc
instead of TextLintEngine
/TextFixEngine
import { TextLintEngine } from "textlint";
import path from "path";
function lintFile(filePath) {
const engine = new TextLintEngine({
formatterName: "stylish",
});
const filePathList = [filePath];
return engine.executeOnFiles(filePathList).then(function (results) {
const output = engine.formatResults(results);
console.log(output);
});
}
lintFile(path.resolve(process.cwd(), "README.md"));
→
import { createLinter, loadTextlintrc, loadLinterFormatter } from "textlint";
import path from "node:path";
import { fileURLToPath } from "node:url";
async function lintFile(filePath) {
// descriptor is a structure object for linter
// It includes rules, plugins, and options
const descriptor = await loadTextlintrc({
configFilePath: path.join(process.cwd(), ".textlintrc.json")
});
const linter = createLinter({
descriptor
});
const results = await linter.lintFiles([filePath]);
// textlint has two types formatter sets for linter and fixer
const formatter = await loadLinterFormatter({ formatterName: "stylish" });
const output = formatter.format(results);
console.log(output);
}
lintFile(path.join(process.cwd(), "README.md")
TextLintCore
and textlint
migration
Use @textlint/legacy-textlint-core
instead of it.
This package is deprecated, but you can migrate it smooth.
- import { TextLintCore } from "textlint";
+ import { TextLintCore } from "@textlint/legacy-textlint-core";
const textlint = new TextLintCore();
Full Changelog
Thanks for Support!
Many people support us, Thanks!
If you're interested in GitHub Sponsor, please check @azu on GitHub Sponsors!