Skip to main content

Performance improvements in textlint and its rules

· 14 min read
azu
textlint creator

In the last two weeks, we improved the performance of textlint and of the rules and libraries that many textlint users install. In our benchmarks, a lint that took 75.5 seconds now takes 7.2 seconds, and uses less than half of the memory.

Your configuration and your rules do not need to change. Update textlint and your rules to get the improvements.

The run time of the textlint CLI for each install date. preset-jtf-style on MDN Web Docs in Japanese: 75.5, 29.2, 8.7, 8.5, 7.4, and 7.2 seconds. preset-ja-technical-writing on js-primer: 40.6, 19.3, 18.9, 18.4, 4.3, and 4.1 seconds. preset-ja-technical-writing on web/javascript of MDN Web Docs in Japanese: 150, 95.8, 96.7, 93.5, 16.0, and 15.3 seconds.

Each bar is the run time with the versions of textlint and the rules that npm install installed on that day: textlint 15.8.0 on 2026-11-08, and textlint 16.1.3 on 2026-11-23.

  • preset-jtf-style on the Japanese translation of MDN Web Docs (10,452 files): 75.5 s → 7.17 s, and the peak memory 1,022 MB → 475 MB.
  • preset-ja-technical-writing on js-primer (105 files): 40.6 s → 4.10 s, and 905 MB → 290 MB.
  • preset-ja-technical-writing on web/javascript of MDN Web Docs in Japanese (1,043 files): 149.9 s → 15.3 s, and 2,555 MB → 313 MB.

The values are the run time of the textlint CLI and the largest memory of the process (peak RSS). How we measured describes the details.

This post describes why we worked on performance, how the numbers changed, what we changed, and how we keep textlint from getting slower.

Why performance matters now​

Speed was not a goal of textlint before. textlint is a pluggable linter for natural language, and every rule is a package outside of textlint. A rule may load a dictionary or analyze Japanese text into words, so the rules take most of the time of a run. We chose this freedom of rules over speed.

Two things changed.

  • Documents are growing faster than before. AI agents write documents as well as code, and more text is written in the life cycle of development: specifications, design documents, and guides.
  • A linter gives the same result for the same text. People and AI agents run it after every edit, so the time of a lint is paid many times a day.

When the number of documents grows, a linter that takes a minute is not run after every edit. So we now treat performance as a goal of textlint.

What we kept​

textlint has many rules that we do not maintain, and we can not change them. So we set one condition for this work: existing rules and configurations keep working, and they report the same results.

  • We did not change the rule API or TxtAST to make textlint faster.
  • We made the existing work cheaper: textlint and the libraries did the same work many times, created objects that nobody used, and kept data longer than needed.
  • For every change, we compared the lint results before and after on real documents.

The only steps you need are in How to update. textlint v16 requires Node.js 22.12.0 or later, as the v16.0.0 release post describes.

How the numbers changed​

Three sets of releases made most of the difference in the chart at the top.

  • 2026-11-15: textlint 16.0.0 and sentence-splitter 5.1.0. Both have a new parser. jtf-style on MDN went from 75.5 s to 29.2 s, and ja-technical-writing on js-primer went from 40.6 s to 19.3 s.
  • 2026-11-16: preset-jtf-style 3.1.0, with match-index 1.0.4 and textlint-rule-helper 2.6.0. jtf-style on MDN went from 29.2 s to 8.69 s.
  • 2026-11-21: kuromojin 3.1.0 and textlint 16.1.2. ja-technical-writing went from 18.4 s to 4.25 s on js-primer, and from 93.5 s to 16.0 s on MDN web/javascript. The peak memory went from 2,482 MB to 324 MB there, and from 955 MB to 475 MB for jtf-style on MDN, which does not use kuromojin.

textlint and the rules both matter​

Which update matters depends on the rules. The following table updates only textlint, or only the rules.

jtf-style, MDNja-technical-writing, js-primer
textlint 15.8.0 and the rules of 2026-11-0875.5 s40.6 s
Only textlint is new (16.1.3)27.1 s35.4 s
Only the rules are new52.6 s6.13 s
Both are new7.17 s4.10 s
  • preset-jtf-style has 33 rules that check text with regular expressions. Each rule is cheap, so the time of textlint itself was a large part of the run.
  • preset-ja-technical-writing analyzes Japanese text into words with kuromojin. Almost all of the time was in the rules and their libraries.

So updating only textlint is not enough. Update your rules too.

What we changed in textlint​

We started with textlint itself.

Each number is the measurement in the pull request, with preset-jtf-style where rules are used.

Parsing and calling rules (16.0.0)​

  • A new Markdown parser without third-party dependencies. Parsing js-primer went from 1,070 ms to 18 ms (#2188).
  • Less work for each node when calling rules. A lint of 2,691 files with a rule that does nothing went from 696 ms to about 490 ms (#2202).

Output and startup (16.1.1)​

  • The stylish formatter measures each cell once. Formatting 175,883 messages went from 4.7 s to 0.66 s (#2214).
  • The MCP server is loaded only with --mcp. textlint --version went from 300 ms to about 150 ms (#2219).
  • read-package-up is replaced with a small helper, so 21 fewer packages (about 3.4 MB) are installed (#2218).

Memory (16.1.2)​

  • At most 8 files are in process at the same time, and a file is read when its turn comes. MDN went from 7.78 s to 6.67 s, and the peak memory from 980 MB to 713 MB (#2222).
  • The AST of a file is released soon after the lint of the file. The pause of the minor GC on MDN went from about 470 ms to about 210 ms (#2227).

We could not find the cause of the second one by reading the code. So we profiled the garbage collection to see where the problem was. The cause was where V8 allocates a function: a function that is assigned to a property in a constructor was allocated in the old generation, and it kept the AST of each file alive until the next major GC.

--fix (16.1.3)​

  • --fix parses a file again only after a fix. --fix --dry-run on MDN went from 33.2 s to 18.4 s (#2233).

What we changed in rules and libraries​

After the changes of textlint, the rules took most of the remaining time. So we profiled the rules, and improved the libraries that many rules share.

sentence-splitter 5.1.0​

sentence-splitter splits a paragraph into sentences. Many rules use it, such as sentence-length and max-ten.

  • The 5.0.x patch releases keep only the text of the node, instead of the whole file, for each paragraph (#61).
  • 5.1.0 has a new parser that scans the text into flat typed arrays and creates the nodes once (#70).

splitAST() of 5.1.0 is about 25–29 times faster than 5.0.3, and about 1,300–1,600 times faster than 5.0.0 (v5.1.0 release notes).

kuromojin 3.1.0​

kuromojin analyzes Japanese text into words. Many Japanese rules use it, and it took about 70% of a run with preset-ja-technical-writing.

kuromojin 3.1.0 no longer depends on kuromoji.js: it includes the analysis as its own analyzer and its own dictionary file. The tokens are compatible with the ones of kuromoji.js.

Compared with 3.0.2, the v3.1.0 release notes report the following.

  • Load of the dictionary: 440 ms → 51 ms
  • Analysis of each line of js-primer: 2,206 ms → 167 ms
  • Memory after the load: 182 MB → 27.2 MB
  • Installed size with dependencies: 47.7 MB → 5.10 MB

We did not start from the implementation. We knew that kuromojin took a large part of the time of the rules, so first we wrote several prototypes to see how much could be removed. The first prototype removed about 60%, and we also measured a run where the analysis costs nothing, to know the upper limit. Then we set a rough goal to remove 80% of the time. After that, we wrote the requirements and the design of the analyzer, the dictionary format, and the dictionary versions as specifications, and implemented them. For example, a new word in the dictionary changes the tokens, and so the lint results. So the specification of the dictionary versions keeps the dictionary the same within a major version, and uses a newer dictionary only when the dictionaryVersion option is given.

preset-jtf-style 3.1.0 and shared helpers​

Keeping textlint from getting slower​

A fast release does not stay fast by itself. The main policy from now on is to notice when textlint gets slower, more than to chase speed.

textlint --profile​

--profile prints where the time of a run is spent, instead of the lint results (#2206). The following output is the start of the profile of preset-ja-technical-writing on js-primer.

$ npx textlint --profile source/
## textlint profile

Total: 5871.34 ms, 105 files

### Phases

| Phase | Time (ms) | % | Count |
| --- | ---: | ---: | ---: |
| startup | 80.71 | 1.4% | 1 |
| load-config | 71.12 | 1.2% | 1 |
| search-files | 23.09 | 0.4% | 1 |
| lint | 5638.96 | 96.0% | 1 |
| ↳ parse | 74.81 | 1.3% | 105 |
| ↳ traverse | 171.79 | 2.9% | 105 |
| ↳ rules | 4623.91 | 78.8% | 285266 |
| ↳ post-process | 3.78 | 0.1% | 105 |
| format | 53.49 | 0.9% | 1 |

### Rules

| Rule | Time (ms) | % | Calls |
| --- | ---: | ---: | ---: |
| ja-technical-writing/no-double-negative-ja | 852.67 | 14.5% | 15498 |
| ja-technical-writing/ja-no-abusage | 632.59 | 10.8% | 15498 |
| ja-technical-writing/max-ten | 498.09 | 8.5% | 7199 |
...

A run with --profile is slower than a usual run, because textlint measures every call of a rule. If your lint is slow, run it with --profile and look at the Rules table first. See Profile for how to read the output.

Comparison of two builds in CI​

pnpm run compare in the textlint repository builds the base branch and the working tree, lints the same documents with both, and prints the differences. The "Profile and benchmark" workflow runs it for every pull request.

  • The documents are four sets: small (5 files), medium (js-primer), large (web/javascript of MDN Web Docs in Japanese), and huge (MDN Web Docs in Japanese).
  • It compares the lint results, the run time of the CLI, the run time with --fix, the pause of the garbage collection, the parsers, and the traversal.
  • A difference of the lint results is shown first, so a change that makes textlint faster but changes the results does not pass unnoticed.

kuromojin has the same comparison for the load of the dictionary, the analysis, and the memory.

The specifications are Performance profile and Change comparison.

How to update​

  1. Use Node.js 22.12.0 or later.
  2. Update textlint to 16.1.3 or later.
  3. Update your rules and presets, and the lock file.
npm install --save-dev textlint@latest
npm update

Then check the versions of the libraries.

npm ls kuromojin sentence-splitter
  • kuromojin should be 3.1.0 or later, and sentence-splitter should be 5.1.0 or later.
  • If npm ls shows two or more versions of kuromojin, each copy loads its own dictionary. See Troubleshooting: use one copy of kuromojin.

How we measured​

  • Each directory was installed with npm install --before=<the end of the date in JST> textlint textlint-rule-preset-jtf-style textlint-rule-preset-ja-technical-writing, so that textlint, the presets, and all of their dependencies are the versions of that day.
  • Command: textlint --format json with a configuration that enables one preset with its default options.
  • Documents: files/ja of mdn/translated-content at 8a8b2ad7 (10,452 files), its web/javascript directory (1,043 files), and source of js-primer v7.0.0 (105 files).
  • Machine: Linux with 4 CPUs, Node.js 22.23.5. The values are the median of 3 runs, all measured on 2026-11-23 on the same machine.
  • Memory is the peak RSS of the process (process.resourceUsage().maxRSS).
  • For "only textlint is new", the rules were installed as of 2026-11-08 and then textlint@16.1.3 was installed. For "only the rules are new", textlint was installed as of 2026-11-08 and then the latest presets were installed.

The lint results are as follows.

  • preset-jtf-style on MDN: the 177,741 messages are identical on every install date, including their positions.
  • preset-ja-technical-writing on MDN web/javascript: the 12,613 messages have the same rules and texts on every install date. The columns of 1,390 messages differ, because sentence-splitter 5.1.0 fixed the columns that it reports.
  • preset-ja-technical-writing on js-primer: 847 messages with textlint 15.8.0, and 850 with textlint 16. The three messages come from the parser changes of v16.0.0, not from the performance work.

What is next​

textlint lints files one by one in one thread. To handle many more files, textlint needs something more fundamental, such as linting files in parallel. It is hard for a linter whose rules are all added from outside: each thread has to load the rules and their dictionaries again. We do not know the best design yet.

If you have a large set of documents, please tell us the output of textlint --profile in GitHub Discussions. If textlint helps your work, you can support the development through GitHub Sponsors.

textlint v16.0.0

· 14 min read
azu
textlint creator

We are pleased to announce the release of textlint v16.0.0. This is a small major release: it requires Node.js 22.12, replaces the Markdown parser with a faster in-house parser, and makes the built-in plugins ESM-only.

Most users only need to update Node.js. This post first describes the changes for users who run textlint, and then the changes for developers of rules, plugins, and tools.

Summary​

For users:

  • Node.js 22.12.0 or later is required. Node.js 20 reached end-of-life. Update Node.js in your environment and CI.
  • Markdown parsing is much faster. textlint parses Markdown with a new in-house parser, and installs 59 third-party packages instead of 139 in v15.8.0. Rules report the same errors for most documents.
  • The node type of YAML front matter is renamed from Yaml to yaml. If your configuration lists "Yaml", such as in textlint-filter-rule-node-types, change it to "yaml". Otherwise front matter is checked as prose.
  • The output of some formatters changes slightly. table no longer throws on a tab in a message, and pretty-error no longer prints undefined for an empty file.
  • New options. --cache-strategy content detects changed files by content, --stdin works with the pretty-error and diff formatters, and the Markdown plugin's cjkFriendlyEmphasis recognizes emphasis in CJK text such as **強調。**この文.

For rule and plugin developers:

textlint started writing down its specifications, which were ambiguous, as Requirements and Design documents. While writing them, we made the ambiguous parts of TxtAST stricter. Most of the changes below come from this work.

  • @textlint/textlint-plugin-markdown and @textlint/textlint-plugin-text are ESM-only. Code that loads them directly with require() gets the module namespace, so use require(...).default or import.
  • @textlint/markdown-to-ast is a new CommonMark 0.31.2 + GFM parser. The AST is compatible. It differs only in edge cases where the new parser follows CommonMark and GitHub, and the hidden position property is removed.
  • Node types that are not in @textlint/ast-node-types are lowercase. Front matter and footnote references are not part of CommonMark or GFM, so Yaml, Toml, Json, and FootnoteReference become yaml, toml, json, and footnoteReference. The casing tells whether a node type is shared by all formats (TxtAST Requirements: Extension nodes).
  • Lines end with LF, CR, or CRLF in every format. U+2028 and U+2029 are no longer line endings in messages, and a lone CR is a line ending in plain text (TxtAST Requirements: Lines).
  • The plain text parser keeps one Paragraph per line. Every line ending at the end of the text becomes a Break, and a BOM is no longer included in the first Str (Plain text parsing Requirements).
  • @textlint/ast-tester checks that raw, range, and loc agree. Tests of a rule can fail if your plugin produces an AST that breaks the conventions (TxtAST Requirements: Checking an AST).
  • Deprecated type re-exports are removed from @textlint/kernel. Import the types from @textlint/types.
  • Formatters receive the source text through a getSource option. API users can pass in-memory text to loadFormatter().

For Users​

Node.js 22.12+ Required​

textlint v16 requires Node.js 22.12.0 or later, because Node.js 20 reached end-of-life on 2026-04-30.

Migration Required:

  • Update your Node.js version to 22.12.0 or later
  • Update your CI and Docker images to use Node.js 22.12+

#2182, #2201

Faster Markdown parsing​

textlint v16 parses Markdown with a new in-house parser instead of remark. It supports the same syntax as before: CommonMark, GFM (tables, strikethrough, task list items, autolink literals, footnotes), Pandoc-style inline notes (^[note]), and YAML/TOML/JSON front matter.

Parsing time with Node.js 22:

DocumentsBeforev16
js-primer (88 .md files, 1.4 MB)1,070 ms (v15.8.0)18 ms (about 58x faster)
3,189 real-world .md files (15.3 MB)18,506 ms (remark-based parser)about 400 ms (about 45x faster)

Inputs that took tens of seconds, such as a table with 20,000 rows, are parsed in milliseconds, and documents nested deeper than 100 levels are linted instead of throwing RangeError. @textlint/markdown-to-ast has no third-party dependencies, instead of 96 packages (7.5 MB).

textlint installs 59 third-party packages in production, instead of 139 in v15.8.0 (-80). The new parser, the in-house formatter helpers (#2183), the removal of unused dependencies (#2184), and the in-house line table of the kernel (#2199) removed them.

How much faster the textlint CLI finishes depends on how much of the time rules take:

ProjectBeforev16
webpack-book (62 files, 489 KB)1,448 ms (remark-based parser)949 ms (-34%)
magi-hacker (5 files, 5.5 KB)632 ms (remark-based parser)505 ms (-20%)
js-primer (60 files, with its own rules)18.7 s (v15.8.0)18.9 s (no change)

In js-primer, almost all of the time is spent in rules, such as the morphological analysis of Japanese text, so a faster parser does not change the total.

Rules report the same errors for most documents. A few edge cases follow CommonMark and GitHub more closely. For example, when a document starts with --- that is not a front matter fence, the lists in the document are now recognized. Another example is a footnote definition followed by link reference definitions without a blank line. The following lines are now part of the footnote, the same as micromark and the latest remark-gfm, so add a blank line after the footnote definition. See New Markdown parser for the details.

#2188

Front matter node type is yaml​

The node types of front matter and footnote references are renamed to lowercase: Yaml, Toml, Json, FootnoteReference → yaml, toml, json, footnoteReference.

If your configuration lists "Yaml" among node types to ignore, such as in the options of a filter rule or a rule, front matter is checked as prose in v16 without any error.

Migration Required (only if your configuration lists these node types):

Use "yaml" instead, or both names to support v15 and v16.

{
"filters": {
"node-types": {
"nodeTypes": ["yaml"]
}
}
}

#2188

Formatter output changes​

The output of the formatters is the same in most cases, with these differences:

  • table: a message that contains a control character such as a tab no longer throws an error
  • table: escape sequences in a message or a rule id are removed in the table cells. Without color, the output is the same as before
  • pretty-error: a message in an empty file no longer prints undefined
  • Column widths of some emoji follow newer Unicode data

#2183, #2180

Line endings in rare documents​

textlint counts lines by LF, CR, and CRLF in every format, the same as CommonMark, editors, and the Language Server Protocol. The line and column of errors change only for documents that contain a lone CR or U+2028/U+2029.

#2197, #2199

--cache-strategy​

--cache-strategy content detects changed files by their content hash instead of mtime and size, which is reliable in CI. The default is metadata, the same behavior as before.

textlint --cache --cache-strategy content "docs/**/*.md"

#2096

--stdin with pretty-error and diff​

textlint --stdin --format pretty-error now shows the code frame of the stdin text, and textlint --fix --stdin --format diff shows the diff of the stdin text.

#2186

cjkFriendlyEmphasis option of the Markdown plugin​

CommonMark does not recognize some emphasis in Chinese, Japanese, and Korean text, such as **強調。**この文, because a punctuation mark is inside the closing ** and a letter follows it. The new cjkFriendlyEmphasis option parses emphasis, strong emphasis, and strikethrough with the CommonMark CJK-friendly Amendments, the same as VitePress and Rspress. It is disabled by default. Enable it when your documents are rendered with these rules.

{
"plugins": {
"@textlint/markdown": {
"cjkFriendlyEmphasis": true
}
}
}

The AST does not record this option. A rule whose fixes depend on it needs its own cjkFriendlyEmphasis option, so enable both. For example, ja-space-around-strong and ja-space-around-emphasis of textlint-rule-preset-ja-spacing add the option in textlint-ja/textlint-rule-preset-ja-spacing#144.

#2203

Bug Fixes​

  • TIMING=1 reports each rule's own time instead of including other rules' time #2189
  • A relative --rules-base-directory is resolved from the current directory #2190
  • The github formatter escapes workflow command values #2159
  • The MCP server marks its tools as read-only #2136

For Rule and Plugin Developers​

Specifications of TxtAST and the parsers​

textlint started writing down its specifications, which were ambiguous, as Requirements and Design documents under docs/products/. The TxtAST Requirements define what rules can rely on in every format, and the Markdown parsing and plain text parsing Requirements define the AST of each format.

While writing them, we made the ambiguous parts of TxtAST stricter:

  • Node types that are not in @textlint/ast-node-types are lowercase
  • Lines end with LF, CR, or CRLF in every format
  • raw, range, and loc of a node agree with each other, and @textlint/ast-tester checks it

The breaking changes in this section come from these rules.

#2192

Built-in plugins are ESM-only​

@textlint/textlint-plugin-markdown and @textlint/textlint-plugin-text are now ESM-only packages. textlint, textlint-tester, and @textlint/legacy-textlint-core stay CommonJS and load them with dynamic import(), so you do not need to change anything if you use textlint through them. Node.js 22.12.0 enables require(esm) by default, so CommonJS code can also require() them.

Migration Required (only if you load a built-in plugin directly):

// Before
const markdownPlugin = require("@textlint/textlint-plugin-markdown");

// After (CommonJS): require() returns the module namespace
const { default: markdownPlugin } = require("@textlint/textlint-plugin-markdown");

// After (ESM)
import markdownPlugin from "@textlint/textlint-plugin-markdown";

#2109

New Markdown parser​

@textlint/markdown-to-ast no longer uses remark. It is now an in-house CommonMark 0.31.2 + GFM parser that creates TxtAST directly.

The output AST is the same as the remark-based parser of v16 development for all existing fixtures, all CommonMark and GFM spec examples, and thousands of real-world Markdown files. The differences are in edge cases, where the new parser follows CommonMark and GitHub:

  • When a document starts with --- (a thematic break) that is not a front matter fence, lists in the document are now recognized
  • loc of the text after a task list checkbox and a line ending now matches its range
  • A list item that ends with an unclosed fenced code block no longer overlaps the next item
  • A few positions of nodes with trailing whitespace inside nested containers with tabs

The Markdown AST also changed compared with v15 because of the remark upgrade in #2109. If your rule depends on the exact AST, please check it with v16.

The hidden position property (unist compatibility) is removed from nodes. Use range and loc.

Nesting deeper than 100 levels is not parsed as syntax. Block quotes and list items beyond the limit, and emphasis or links beyond 100 inline levels, stay as text.

#2188

Renamed node types​

Node types that are defined in @textlint/ast-node-types use PascalCase, and other node types use lowercase. Front matter and footnotes are not part of CommonMark or the GFM specification and are not in @textlint/ast-node-types, so their node types are now lowercase, like footnoteDefinition already was. The rule is defined in TxtAST Requirements: Extension nodes.

v15v16
Yamlyaml
Tomltoml
Jsonjson
FootnoteReferencefootnoteReference

If your rule or filter rule ignores "Yaml" by default, use "yaml" instead, or both names to support v15 and v16. Plugin authors who copied the mapping of @textlint/markdown-to-ast, such as for MDX, should rename these node types too.

Line endings are LF, CR, and CRLF​

textlint counts lines by LF, CR, and CRLF in every format.

  • Plain text: a lone CR is now a line ending, so the text is split into Paragraph, Break, and Paragraph, and loc of the following nodes changes #2197
  • Messages: the line and column of messages no longer treat U+2028 and U+2029 as line endings. rangeToLocation, locationToRange, positionToIndex, and indexToPosition of TextlintSourceCode follow the same definition. @textlint/kernel no longer depends on structured-source #2199

Plain text parser​

@textlint/text-to-ast was rewritten and keeps one Paragraph per line. The AST changes only for unusual texts:

  • Every line ending at the end of the text becomes a Break. a\n\n gives two Break nodes instead of one, and \n gives one instead of none
  • A BOM is no longer included in the first Str, so offsets are no longer one character too large
  • loc.end of Break is column 0 of the next line

#2198, #2194

@textlint/ast-tester checks position conventions​

test() throws and isTxtAST() returns false for an AST whose raw, range, and loc disagree with each other. textlint runs the tester only while testing a rule or plugin with textlint-tester, so linting documents is not affected. Plugin authors: the tests of a rule can start failing if your plugin produces such an AST. Count lines by LF, CR, and CRLF, and keep raw equal to the text sliced by range.

#2194, #2197

Removed deprecated type re-exports from @textlint/kernel​

The following types are no longer exported from @textlint/kernel. Import them from @textlint/types instead.

TextlintRuleReporter, TextlintRuleModule, TextlintRuleOptions, TextlintRuleSeverityLevel, TextlintFilterRuleReporter, TextlintFilterRuleOptions, TextlintPluginCreator, TextlintPluginOptions, TextlintPluginProcessor, TextlintPluginProcessorConstructor

// Before
import type { TextlintRuleModule } from "@textlint/kernel";
// After
import type { TextlintRuleModule } from "@textlint/types";

#2182

getSource option for formatters​

Formatters get the source text through a getSource(filePath) option instead of reading files by themselves. API users can pass in-memory text with loadFormatter({ formatterName, getSource }).

#2186

Other Changes​

  • The kernel calls rule handlers with less work per node: event emission, parent definition, and traversal of @textlint/ast-traverse avoid extra allocations. The order of visited nodes and the arguments of handlers do not change #2202
  • @textlint/ast-node-types: the children types include Definition, LinkReference, and ImageReference #2196
  • Removed unused dependencies #2184

Full Changelog​

See the release notes of v16.0.0 for all changes, and v15.8.0...v16.0.0 for all commits.

Thanks​

Thanks to all contributors and sponsors.

textlint v15.0.0

· 8 min read
azu
textlint creator

We are pleased to announce the release of textlint v15.0.0. This release includes major breaking changes by removing all deprecated legacy APIs.

Summary​

textlint v15 is a major release that removes all deprecated APIs that have been marked as deprecated since v12.3.0. This significantly reduces the codebase size and maintenance burden while providing a cleaner, more modern API surface.

Breaking Changes:

  • Requires Node.js 20 or later
  • Removed TextLintEngine - Use createLinter() instead
  • Removed TextFixEngine - Use createLinter() instead
  • Removed TextLintCore - Use createLinter() or @textlint/kernel instead
  • Removed textlint (singleton instance) - Use createLinter() instead
  • Removed createFormatter - Use loadFormatter() instead

New Features:

  • Enhanced MCP integration with structured output, JSON schema validation, and improved error handling

Breaking Changes​

Node.js 20+ Required​

textlint v15 requires Node.js 20.0.0 or later. This change aligns with Node.js LTS support and enables the use of modern JavaScript features.

Migration Required:

  • Update your Node.js version to 20.0.0 or later
  • Update your CI/CD environments to use Node.js 20+
  • Update any Docker images or deployment configurations

Removed Deprecated APIs​

Removed module Field for Webpack Compatibility​

In textlint v15, the module field has been removed from all @textlint packages that had both type: "commonjs" and a module field, to improve compatibility with Webpack. Previously, having both fields caused resolution issues in Webpack, requiring users to add workarounds.

Details:

  • Removed the module field from 15 @textlint packages
  • No longer necessary to set custom mainFields in Webpack
  • Issue #1587 / PR #1588

With this change, Webpack users can use textlint packages out-of-the-box, and module resolution issues are resolved without extra configuration.

The following deprecated APIs have been completely removed from the textlint package:

TextLintEngine → createLinter()​

Before (v14 and earlier):

const { TextLintEngine } = require("textlint");

const engine = new TextLintEngine({
configFile: ".textlintrc.json"
});
const results = await engine.executeOnFiles(["*.md"]);
const output = engine.formatResults(results);
console.log(output);

After (v15+):

import { createLinter, loadTextlintrc, loadLinterFormatter } from "textlint";

const descriptor = await loadTextlintrc({
configFilePath: ".textlintrc.json"
});
const linter = createLinter({ descriptor });
const results = await linter.lintFiles(["*.md"]);
const formatter = await loadLinterFormatter({ formatterName: "stylish" });
const output = formatter.format(results);
console.log(output);

TextFixEngine → createLinter()​

Before (v14 and earlier):

const { TextFixEngine } = require("textlint");

const engine = new TextFixEngine();
const results = await engine.executeOnFiles(["*.md"]);

After (v15+):

import { createLinter, loadTextlintrc } from "textlint";

const descriptor = await loadTextlintrc();
const linter = createLinter({ descriptor });
const results = await linter.fixFiles(["*.md"]);

TextLintCore → createLinter() or @textlint/kernel​

Before (v14 and earlier):

const { TextLintCore } = require("textlint");

const textlint = new TextLintCore();
textlint.setupRules({
"rule-name": require("./my-rule")
});
const result = await textlint.lintText("Hello world", "test.md");

After (v15+):

import { createLinter } from "textlint";
import { TextlintKernelDescriptor } from "@textlint/kernel";
import { moduleInterop } from "@textlint/module-interop";

const descriptor = new TextlintKernelDescriptor({
rules: [
{
ruleId: "rule-name",
rule: moduleInterop((await import("./my-rule")).default)
}
]
});
const linter = createLinter({ descriptor });
const result = await linter.lintText("Hello world", "test.md");

Singleton textlint → createLinter()​

Before (v14 and earlier):

const { textlint } = require("textlint");

textlint.setupRules({ "rule-name": ruleModule });
const result = await textlint.lintText("text", "file.md");

After (v15+):

import { createLinter } from "textlint";
import { TextlintKernelDescriptor } from "@textlint/kernel";

const descriptor = new TextlintKernelDescriptor({
rules: [{ ruleId: "rule-name", rule: ruleModule }]
});
const linter = createLinter({ descriptor });
const result = await linter.lintText("text", "file.md");

createFormatter → loadFormatter​

Before (v14 and earlier):

const { createFormatter } = require("@textlint/linter-formatter");

const formatter = createFormatter({
formatterName: "stylish"
});
const output = formatter([results]);

After (v15+):

import { loadFormatter } from "@textlint/linter-formatter";

const formatter = await loadFormatter({
formatterName: "stylish"
});
const output = formatter.format(results);

Improved Exit Status Handling​

textlint v15 improves exit status handling to align with ESLint's behavior, helping scripts distinguish between different types of errors.

Key Changes:

  • File search errors now return exit status 2 (previously 1)
  • Lint errors continue to return exit status 1
  • Success cases return exit status 0
# v15+ behavior (now matches ESLint)
textlint nonexistent-file.md # Exit Status: 2 (file search error)
textlint file-with-errors.md # Exit Status: 1 (lint errors)
textlint clean-file.md # Exit Status: 0 (success)

This enables better CI/CD error handling and aligns with ESLint's behavior. For comprehensive documentation, see the Exit Status FAQ.

Fixed Ignore Pattern Handling for Absolute Paths​

textlint v15 fixes a bug where absolute file paths did not respect .textlintignore patterns.

What was fixed:

# Before v15 (Bug)
textlint /absolute/path/to/ignored-file.md # ❌ Would lint even if ignored

# v15+ (Fixed)
textlint /absolute/path/to/ignored-file.md # ✅ Properly respects .textlintignore

This fix is important for CI/CD systems and IDE integrations that use absolute paths. See GitHub Issue #1412 for details.

Migration Guide​

📖 For detailed migration instructions with comprehensive examples, see the complete migration guide.

Quick Reference​

Deprecated APINew APIMethod Change
new TextLintEngine()createLinter()executeOnFiles() → lintFiles()
new TextFixEngine()createLinter()executeOnFiles() → fixFiles()
new TextLintCore()createLinter()lintText() → lintText()
createFormatter()loadFormatter()Async loading, .format() method
engine.formatResults()loadLinterFormatter()Separate formatter loading

Common Migration Patterns​

Pattern 1: Simple File Linting​

Before:

const { TextLintEngine } = require("textlint");
const engine = new TextLintEngine();
const results = await engine.executeOnFiles(["README.md"]);

After:

import { createLinter, loadTextlintrc } from "textlint";
const descriptor = await loadTextlintrc();
const linter = createLinter({ descriptor });
const results = await linter.lintFiles(["README.md"]);

Pattern 2: Text Processing with Custom Rules​

Before:

const { TextLintCore } = require("textlint");
const textlint = new TextLintCore();
textlint.setupRules({ "my-rule": myRule });
const result = await textlint.lintText("text", "file.md");

After:

import { createLinter } from "textlint";
import { TextlintKernelDescriptor } from "@textlint/kernel";

const descriptor = new TextlintKernelDescriptor({
rules: [{ ruleId: "my-rule", rule: myRule }]
});
const linter = createLinter({ descriptor });
const result = await linter.lintText("text", "file.md");

Pattern 3: Mixing Configuration and Custom Rules​

Before:

const { TextLintCore } = require("textlint");
const { Config } = require("textlint/lib/config/config");

const config = new Config({ configFile: ".textlintrc.json" });
const textlint = new TextLintCore(config);
textlint.setupRules({ "custom-rule": customRule });

After:

import { createLinter, loadTextlintrc } from "textlint";
import { TextlintKernelDescriptor } from "@textlint/kernel";

const textlintrcDescriptor = await loadTextlintrc({
configFilePath: ".textlintrc.json"
});
const customDescriptor = new TextlintKernelDescriptor({
rules: [{ ruleId: "custom-rule", rule: customRule }]
});
const linter = createLinter({
descriptor: customDescriptor.concat(textlintrcDescriptor)
});

New Features​

Enhanced Model Context Protocol (MCP) Support​

textlint v15 introduces significant improvements to Model Context Protocol (MCP) support, making it easier to integrate textlint with AI assistants and language models.

Key Improvements:

  • Structured Output: Better formatted results for AI consumption
  • JSON Schema Support: Validation using output schemas
  • Enhanced Error Handling: More detailed error reporting for MCP clients
  • Improved Documentation: Better MCP integration examples

For more details, see the MCP documentation.

Improvements:

  • Exit Status Improvement: File search errors now return exit status 2 (aligned with ESLint)
  • Ignore Pattern Fix: Absolute file paths now correctly respect .textlintignore patterns

Improved Exit Status Handling​

textlint v15 improves exit status handling to align with ESLint's behavior, helping scripts distinguish between different types of errors.

Key Changes:

  • File search errors now return exit status 2 (previously 1)
  • Lint errors continue to return exit status 1
  • Success cases return exit status 0
# v15+ behavior (now matches ESLint)
textlint nonexistent-file.md # Exit Status: 2 (file search error)
textlint file-with-errors.md # Exit Status: 1 (lint errors)
textlint clean-file.md # Exit Status: 0 (success)

This enables better CI/CD error handling and aligns with ESLint's behavior. For comprehensive documentation, see the Exit Status FAQ.

Fixed Ignore Pattern Handling for Absolute Paths​

textlint v15 fixes a bug where absolute file paths did not respect .textlintignore patterns.

What was fixed:

# Before v15 (Bug)
textlint /absolute/path/to/ignored-file.md # ❌ Would lint even if ignored

# v15+ (Fixed)
textlint /absolute/path/to/ignored-file.md # ✅ Properly respects .textlintignore

This fix is important for CI/CD systems and IDE integrations that use absolute paths. See GitHub Issue #1412 for details.

Resources​

Conclusion​

textlint v15 represents a significant step forward in modernizing the API surface while maintaining the powerful linting capabilities that users expect. While the migration requires some code changes, the new API provides better TypeScript support, modern ESM compatibility, and a cleaner architecture that will serve as a solid foundation for future development.

We encourage all users to migrate to the new APIs as soon as possible. The deprecated APIs have been removed, so upgrading to v15 will require code changes.

Thank you for your continued support of textlint!

textlint v14.0.0

· 5 min read
azu
textlint creator

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+.

Move gulp-textlint to out of monorepo​

We move gulp-textlint to out of monorepo.

gulp-textlint is not maintained by textlint core team.

If you interested in gulp-textlint, please check the following issue:

Remove --parallel and --maxConcurrency flag​

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.

Remove @textlint/linter-formatter CLI​

@textlint/linter-formatter includes CLI, but it is not used by many users. So, we remove the CLI from @textlint/linter-formatter.

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 APINew API
textlintuse @textlint/legacy-textlint-core or @textlint/kernel
TextLintCoreuse @textlint/legacy-textlint-core or @textlint/kernel
TextLintEngineuse createLinter and loadTextlintrc
TextFixEngineuse 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]).

Documentation 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!

textlint v13.0.0

· 6 min read
azu
textlint creator

We just publish textlint v13.0.0, which is a major release upgrade of textlint.

textlint v13 support ESM rules/plugins native.

We have rewritten CLI and textlint package. However, it is not a breaking change for most textlint CLI users. Almost CLI behaviors are the same as textlint v12.

Summary​

For textlint user

You can upgrade textlint via following commands:

npm install textlint@13 --save-dev
# or
yarn install textlint@13 --dev

textlint 13.0.0 requires Node.js 16+. If you use Node.js 14, you need to upgrade Node.js to 16+.

For textlint rule creator

You can write own rule as ESM module.

textlint v13.0.0 can load ESM rules native. So you need to transpile your rule to CommonJS.

textlint CLI load ESM rules and lint files!

⚠️ However, textlint editor plugin may not support ESM rules yet. You need to wait for editor plugin author migrate to textlint new APIs.

For textlint module user

If you use textlint as node module, you should use new APIs.

textlint package provides new APIs from v12.3.0

We have introduced new API like createLinter for supporting Async APIs. v13 continue to support current TextlintCore, TextLintEngine and TextFixEngine for backward compatible. However, These API will be retired in the future.

New createLinter and loadTextlintrc supports ESM rules/plugins. textlint modules user should use these instead of TextlintCore, TextLintEngine and TextFixEngine.

ℹ️ Timeline:

  • textlint v12.3.0 support old APIs(deprecated) and new APIs
    • use old APIs as default
  • textlint v13.0.0 support old APIs(deprecated) and new APIs
    • use new APIs as default - CURRENT
  • textlint v14.0.0 drop to support old APIs
APIDescriptionBehaviorTarget Platformv13+
cliCommand LIne InterfaceAsyncNode.js✅ (Use createLinter and loadTextlintrc internally)
textlintTextLintCore aliasAsyncNode.js/CommonJS❌ Deprecated
TextLintCoreOld API. It is Procedural API. Lint Only Single File. Recommended to use @texltint/kernel module instead of It.AsyncNode.js/CommonJS❌ Deprecated
TextLintEngineLint Engine API. It load .textlintrc automatically◉ Loading is Sync
◉ Linting is Async
Node.js/CommonJS❌ Deprecated
TextFixEngineFix Engine API. It load .textlintrc automatically◉ Loading is Sync
◉ Fixing is Async
Node.js/CommonJS❌ Deprecated
createLinter/loadTextlintrcSupport Async APIs.◉ Loading is Async
◉ Linting/Fixing is Async
Node.js/CommonJS and ESM✅ Recommended

New APIs​

textlint v12.3.0 introduce new APIs. textlint will drop support old APIs(textlint, TextLintEngine, TextFixEngine, and TextLintCore) in the future.

📝 Old APIs can not support ECMAScript modules, new APIs support ECMAScript modules.

  • createLinter: create linter instance
    • lintFiles(files): Promise<TextlintResult[]>: lint files and return linter messages
    • lintText(text, filePath): Promise<TextlintResult> lint text with virtual filePath and return linter messages
    • fixFiles(files): Promise<TextlintFixResult[]> lint text and return fixer messages
    • fixText(text, filePath): Promise<TextlintFixResult> lint text with virtual filePath and return fixer messages
      • fixFiles and fixText does not modify files
  • loadTextlintrc: load .textlintrc config file and return a descriptor object
  • loadLinerFormatter and loadFixerFormatter: load formatter

Examples​

Lint 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, please read next document.

If you have any questions, please ask us via GitHub Discussion.

ChangeLog​

🔥 Breaking Changes​

  • Require Node.js 16+
  • textlint --init output .textlintrc.json
    • Previously, textlint --init output .textlintrc
  • Improve @textlint/ast-node-types types
    • Now, All node types are defined!
    • It changes the existing node type and it is a breaking change
    • If you want to know TxtAST, please read TxtAST Interface
  • Use New-CLI instead of Old-CLI
    • textlint has introduced New-CLI and New-APIs in v12.3.0
    • New-CLI uses new APIs: createLinter/loadTextlintrc/loadLinterFormatter/loadFixerFormatter( If you want to know new APIs, please read Use as Node Modules)
    • It means that textlint support rules/plugins that are written by ESM 🎉
    • Remove Old-CLI

Difference between Old-CLI and New-CLI​

  • New CLI support ESM rules/plugins
  • New CLI must require --stdin-filename with --stdin
    • --stdin-filename may be optional in Old-CLI
  • Correct exit status

Exit Status on new CLI​

0: No Error

  • Not found lint error
  • --fix: found errors but fix all errors, so exit with 0
  • --output-file: Found lint error but --output-file is specified
  • --dryRun: Found lint error but --dryRun is specified

1: Lint Error

  • found lint error
  • --fix: found errors and could not fix all errors, so exit with 1

2: Fatal Error

  • Crash textlint process
  • Fail to load config/rule/plugin etc...

🆕 Features​

Add individual Node type and Add Table/TableRow/TableCell node #1008​

  • Define all node types in @textlint/ast-node-types
  • Add Table/TableRow/TableCell node to @textlint/ast-node-types

These types are defined in @textlint/ast-node-types.

Type nameNode typeDescription
ASTNodeTypes.DocumentTxtDocumentNode(TxtParentNode)Root Node
ASTNodeTypes.DocumentExitTxtDocumentNode(TxtParentNode)
ASTNodeTypes.ParagraphTxtParagraphNode(TxtParentNode)Paragraph Node
ASTNodeTypes.ParagraphExitTxtParagraphNode(TxtParentNode)
ASTNodeTypes.BlockQuoteTxtBlockQuoteNode(TxtParentNode)> Block Quote Node
ASTNodeTypes.BlockQuoteExitTxtBlockQuoteNode(TxtParentNode)
ASTNodeTypes.ListTxtListNode(TxtParentNode)List Node
ASTNodeTypes.ListExitTxtListNode(TxtParentNode)
ASTNodeTypes.ListItemTxtListItemNode(TxtParentNode)List (each) item Node
ASTNodeTypes.ListItemExitTxtListItemNode(TxtParentNode)
ASTNodeTypes.HeaderTxtHeaderNode(TxtParentNode)# Header Node
ASTNodeTypes.HeaderExitTxtHeaderNode(TxtParentNode)
ASTNodeTypes.CodeBlockTxtCodeBlockNode(TxtParentNode)Code Block Node
ASTNodeTypes.CodeBlockExitTxtCodeBlockNode(TxtParentNode)
ASTNodeTypes.HtmlBlockTxtHtmlBlockNode(TxtParentNode)HTML Block Node
ASTNodeTypes.HtmlBlockExitTxtHtmlBlockNode(TxtParentNode)
ASTNodeTypes.LinkTxtLinkNode(TxtParentNode)Link Node
ASTNodeTypes.LinkExitTxtLinkNode(TxtParentNode)
ASTNodeTypes.DeleteTxtDeleteNode(TxtParentNode)Delete Node(~Str~)
ASTNodeTypes.DeleteExitTxtDeleteNode(TxtParentNode)
ASTNodeTypes.EmphasisTxtEmphasisNode(TxtParentNode)Emphasis(*Str*)
ASTNodeTypes.EmphasisExitTxtEmphasisNode(TxtParentNode)
ASTNodeTypes.StrongTxtStrongNode(TxtParentNode)Strong Node(**Str**)
ASTNodeTypes.StrongExitTxtStrongNode(TxtParentNode)
ASTNodeTypes.BreakTxtBreakNodeHard Break Node(Str<space><space>)
ASTNodeTypes.BreakExitTxtBreakNode
ASTNodeTypes.ImageTxtImageNodeImage Node
ASTNodeTypes.ImageExitTxtImageNode
ASTNodeTypes.HorizontalRuleTxtHorizontalRuleNodeHorizontal Node(---)
ASTNodeTypes.HorizontalRuleExitTxtHorizontalRuleNode
ASTNodeTypes.CommentTxtCommentNodeComment Node
ASTNodeTypes.CommentExitTxtCommentNode
ASTNodeTypes.StrTxtStrNodeStr Node
ASTNodeTypes.StrExitTxtStrNode
ASTNodeTypes.CodeTxtCodeNodeInline Code Node
ASTNodeTypes.CodeExitTxtCodeNode
ASTNodeTypes.HtmlTxtHtmlNodeInline HTML Node
ASTNodeTypes.HtmlExitTxtHtmlNode
ASTNodeTypes.TableTxtTableNodeTable node. textlint 13+
ASTNodeTypes.TableExitTxtTableNode
ASTNodeTypes.TableRowTxtTableRowNodeTable row node. textlint 13+
ASTNodeTypes.TableRowExitTxtTableRowNode
ASTNodeTypes.TableCellTxtTableCellNodeTable cell node. textlint 13+
ASTNodeTypes.TableCellExitTxtTableCellNode

Some nodes have additional properties. For example, TxtHeaderNode has level property.

export interface TxtHeaderNode extends TxtParentNode {
type: "Header";
depth: 1 | 2 | 3 | 4 | 5 | 6;
children: PhrasingContent[];
}

For more details, see @textlint/ast-node-types.

Full Changelog​

Thanks for Support!​

Many people support us, Thanks!

If you're interested in GitHub Sponsor, please check @azu on GitHub Sponsors!

textlint v12.0.0

· 5 min read
azu
textlint creator

We just publish textlint v12.0.0, which is a major release upgrade of textlint.

This release adds some new features and fixes several bugs found in the previous release. This release also has some breaking changes.

Summary​

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";

Migration script using Semgrep.

# Install semgrep
# For macOS
$ brew install semgrep

# For Ubuntu / Windows via WSL / Linux / macOS
$ python3 -m pip install semgrep

# ---- After installation ----

# Run migration script
semgrep --config s/azu:textlint-12-migration

Breaking Changes​

  • All @textlint/* internal modules use same version
    • All modules are released as 12.0.0.
  • Drop Node.js 10.x support #600
    • update engines filels to "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
  • Modules require ES2015 supported environments #777 #774
    • Now, all module target is ES2015
    • It means that textlint does not support IE
    • 📝 Node.js 12+ support ES2018+
  • Built-in markdown parser is updated

Package Versions​

Breaking ChangesPackagePrevious versionCurrent version
✔textlint11.9.112.0.0
✔textlint-tester5.3.512.0.0
✔textlint-scripts3.0.012.0.0
 @textlint/ast-node-types4.4.312.0.0
 @textlint/ast-traverse2.3.512.0.0
 @textlint/ast-tester2.3.512.0.0
 @textlint/feature-flag3.3.512.0.0
 @textlint/fixer-formatter3.3.512.0.0
@textlint/kernel3.4.512.0.0
 @textlint/linter-formatter3.3.512.0.0
 @textlint/module-interop1.2.512.0.0
✔@textlint/textlint-plugin-markdown5.3.512.0.0
 @textlint/textlint-plugin-text4.3.512.0.0
✔@textlint/types1.5.512.0.0
@textlint/utils1.2.512.0.0

Now, This monorepo includes textlint-scripts package in #779.

@textlint/markdown-to-ast​

It is a markdown parser in textlint. We have updated to remark@13.0.0, 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

This package updates also includes security fixes. CVE-2020-7753 has been fixed in textlint 12.0.0.

Features​

Add FootnoteReference node​

The 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.

Known bugs​

textlint-tester​

  • use export default instead of export = #775 #689

The 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​

  • Update to mocha@8

@textlint/types​

  • Fix getSource argument type #770

@textlint/ast-tester​

  • Improve error message #783

Community News 🆕​

Thanks to Support!​

VELC supports @azu as GitHub Sponsors!

Many people support me, Thanks again!

If you're interested in GitHub Sponsor, please check @azu on GitHub Sponsors!

textlint 11 released

· 8 min read
azu
textlint creator

We just pushed textlint v11.0.0, which is a major release upgrade of textlint.

This release adds some new features and fixes several bugs found in the previous release. This release also has some breaking changes.

⭐️ Features​

@textlint/textlint-plugin-text and @textlint/textlint-plugin-markdown support extensions option​

Notes: @textlint/textlint-plugin-text and @textlint/textlint-plugin-markdown are built-in plugin.

For example, if you want to treat .hown as markdown, put extensions options to .textlintrc

{
"plugins": {
"@textlint/markdown": {
"extensions": [".hown"]
}
}
}

For more details, please see custom extension example.

For developer:

if you want to support extensions options, see Plugin · textlint.

Show message if textlint --init is success #529​

Add message to textlint --init

screen shot

🔥BREAKING CHANGE​

Drop Node.js 4.x support #443​

textlint does no more test on Node.js 4.x. Node.js 4.x was end of support.

If you use Node.js 4.x, please update Node.js.

[Developer] Freeze Rule's Context #508​

textlint 11 freeze rule's context object.

Next code should throw error in textlint 11.

export default function(context) {
// Error: `context` object can not be modified
context.modifiedContext = true;
const { Syntax } = context;
return {
[Syntax.Str](node) {
}
};
}

[Developer] Change default value of Rule's options and Plugin's options #535 #540​

textlint@11 change the default value of options from true to {} (empty object).

For example, very-nice-rule's option is true(enable the rule) in .textlintrc

{
"rules": {
"very-nice-rule": true
}
}

Before

very-nice-rule.js rule get true as options.

export default function(context, options) {
console.log(options); // true
}

After:

very-nice-rule.js rule get {} (empty object) as options.

export default function(context, options) {
console.log(options); // {}
}

⚠ Deprecation​

[Developer] Deprecate static availableExtensions() in plugin Processor​

Insteadof it, support availableExtensions() instance method in plugin #534

You should change the implementation of plugin. textlint still support static availableExtensions for backward-compatibility.

- static availableExtensions() {
+ availableExtensions() {
return [".txt", ".text"];
}

This change allow to extends availableExtensions() by options.

For more information, see availableExtensions(): string[].


ALL CHANGELOG

textlint@11.0.0​

fixes​

  • textlint: add engine.availableExtensions for backward-compatible (e8652bc)
  • textlint: fix config type (0f2fd6f)
  • deps: update mocha (5df8af4)
  • textlint: add type of public TextlintrcDescriptor (7268b9e)
  • textlint: make static availableExtensions() optional (d471637)
  • remove @textlint/textlintrc-descriptor (3613e1f)
  • textlint: use shallowMerge (95d056d)
  • kernel: merge textlintrc-descriptor to kernel (3c01067)
  • kernel: separate linter and fixer descriptor (b5bc8bd)
  • textlint: fix to import util (6629bd5)
  • textlint: remove `extensions` from Config (7bc9ab8)
  • textlintrc-descriptor: Introduce textlintrc-descriptor (6177794)

features​

  • textlint: show message if `textlint --init` is success (#529) (102d568)
  • textlint: support availableExtensions() instance method in plugin (a7cd053)
  • kernel: add plugin's option tests (f362257)
  • textlint: add cli output test (#533) (abd314a), closes #532
  • textlint: add tests for object-to-kernel-format (5fbb22d)
  • textlint: fix plugin tests (bbfc8f6)

breakingChanges​

#535 #540

Change default value of Rule's options and Plugin's options.

textlint@11 change the default value of options from true to {} (empty object).

For example, very-nice-rule's option is true(enable the rule) in .textlintrc

{
"rules": {
"very-nice-rule": true
}
}

Before

very-nice-rule.js rule get true as options.

export default function(context, options) {
console.log(options); // true
}

After:

very-nice-rule.js rule get {} (empty object) as options.

export default function(context, options) {
console.log(options); // {}
}

@textlint/kernel@3.0.0​

fixes​

  • kernel: kernel use TextlintrcDescriptor (efd89c2)
  • kernel: make rule and plugin's option value {} by default (b7aa63d)
  • deps: update mocha (5df8af4)
  • remove @textlint/textlintrc-descriptor (3613e1f)
  • kernel: add comment (582d0d6)
  • kernel: add Processor validation (86ed609)
  • kernel: fix test title (4eeeff8)
  • kernel: support instance availableExtensions() method (b821fc5)
  • textlint: make static availableExtensions() optional (d471637)
  • textlint: use shallowMerge (95d056d)
  • kernel: merge textlintrc-descriptor to kernel (3c01067)
  • kernel: remove TextlintRuleDescriptorType (a5b0f30)
  • kernel: Replace Object.freeze directly with factory function (c43580b)
  • kernel: separate linter and fixer descriptor (b5bc8bd)
  • kernel: use textlintrc-descriptor instead of rule-creator-helper (f0eb4bf)
  • textlintrc-descriptor: Introduce textlintrc-descriptor (6177794)
  • typescript: update to TypeScript 2.8 (f7b2b08)

features​

  • kernel: Freeze Context (7fc9ec8), closes #508 #508
  • textlint: support availableExtensions() instance method in plugin (a7cd053)
  • kernel: Add missing Readonly<T> (c5313c8)
  • kernel: add plugin's option tests (f362257)
  • textlint: add tests for object-to-kernel-format (5fbb22d)

breakingChanges​

  • kernel: Previously, textlint pass true to rule and plugin as default value of option. #535 #540

@textlint/textlint-plugin-markdown@5.0.0​

fixes​

  • kernel: make rule and plugin's option value {} by default (b7aa63d)
  • deps: update mocha (5df8af4)
  • plugin: add plugin configuration (6e179ec)

features​

  • textlint-plugin-markdown: Support "extensions" option (c3d55fe)

breakingChanges​

  • kernel: Previously, textlint pass true to rule and plugin as default value of option. #535 #540

@textlint/textlint-plugin-text@4.0.0​

fixes​

  • kernel: make rule and plugin's option value {} by default (b7aa63d)
  • deps: update mocha (5df8af4)
  • plugin: add "extensions" option to docs (8026997)
  • plugin: add plugin configuration (6e179ec)

features​

  • textlint-text-markdown: support "extensions" option (cce29ed)

breakingChanges​

  • kernel: Previously, textlint pass `true` to rule and plugin as default value of option. #535 #540

gulp-textlint@5.0.11​

fixes​

  • deps: update to natives@1.1.3 (0c20f42)
  • deps: update mocha (5df8af4)

textlint-tester@5.0.0​

fixes​

  • kernel: make rule and plugin's option value {} by default (b7aa63d)
  • deps: update mocha (5df8af4)
  • kernel: separate linter and fixer descriptor (b5bc8bd)

breakingChanges​

  • kernel: Previously, textlint pass `true` to rule and plugin as default value of option.

textlint-website@10.4.0​

fixes​

  • website: update index.css (6f7977e)
  • website: use https image (4495ed3)
  • website: use short menu name (81911ad)
  • website: add { search: true }, (0c3c4a9)
  • website: add Edit url (e85c6bf)
  • website: add new blog (cabc987)
  • website: add project link (2000dc4)
  • website: add textlint icon (54873c0)
  • website: change vuejs usecase (9d832e5)
  • website: Add a project depends on textlint (#523) (80b4b73)

features​

Renewing

· One min read
azu
textlint creator

We're renewing our website to be able to give you better experience.