Installations
npm install textlint
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>=18.14.0
Node Version
18.20.5
NPM Version
lerna/8.1.9/node@v18.20.5+x64 (linux)
Score
61.8
Supply Chain
64.4
Quality
87.2
Maintenance
100
Vulnerability
96.4
License
Releases
Contributors
Languages
TypeScript (84.21%)
JavaScript (15.14%)
CSS (0.6%)
HTML (0.05%)
Developer
Download Statistics
Total Downloads
7,943,429
Last Day
9,802
Last Week
51,742
Last Month
234,819
Last Year
2,228,877
GitHub Statistics
2,870 Stars
3,687 Commits
157 Forks
39 Watching
11 Branches
81 Contributors
Package Meta Information
Latest Version
14.4.0
Package Id
textlint@14.4.0
Unpacked Size
640.06 kB
Size
95.74 kB
File Count
367
NPM Version
lerna/8.1.9/node@v18.20.5+x64 (linux)
Node Version
18.20.5
Publised On
01 Dec 2024
Total Downloads
Cumulative downloads
Total Downloads
7,943,429
Last day
-16.7%
9,802
Compared to previous day
Last week
-12%
51,742
Compared to previous week
Last month
6%
234,819
Compared to previous month
Last year
13.1%
2,228,877
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
26
textlint
The pluggable linting tool for text and markdown.
textlint is similar to ESLint, but it's for use with natural language.
Website
- Online demo
- Searchable documents
- Release blog
Visit https://textlint.github.io/.
Features
- No bundled rules.
- To use a rule, install a textlint rule via npm.
npm install textlint-rule-xxx
.- See collection of textlint rules
- Markdown and plain text are supported by default. Support is available for HTML and other file formats via plugins.
- Supports the use of custom formatters and formatter bundles formatter(reporter)
Quick Tour
For a quick tour of textlint, checkout our Getting Started guide :squirrel:
Installation
You can install the textlint
command using npm:
$ npm install textlint --save-dev
Requirements:
- Node.js 16+
If you're not sure what version of Node you're running, you can run node -v
in your console to find out.
:warning: Warning:
- If you have installed
textlint
globally you must install each reference rule globally as well. - If you have installed
textlint
locally you must install each rule locally as well.
We recommend installing textlint
locally.
For Node.js beginners
If you've never used Node.js and npm, please see the following:
Usage
textlint has no default rules!!
You can run textlint with .textlintrc.json
config file.
1# Install textlint and rules into local directory 2npm install --save-dev textlint textlint-rule-no-todo
npx textlint --init
command create .textlintrc.json
file from installed rules.
1npx textlint --init
.textlintrc.json
will be created like this:
1{ 2 "rules": { 3 "no-todo": true 4 } 5}
Lint files via textlint:
1npx textlint ./README.md
textlint
load .textlintrc.json
from current directory and lint README.md
.
CLI
Run npx textlint -h
for information on how to use the CLI.
$ textlint [options] file.md [file|dir|glob*]
Options:
-h, --help Show help.
-c, --config path::String Use configuration from this file or sharable config.
--ignore-path path::String Specify path to a file containing patterns that describes files to ignore. - default: .textlintignore
--init Create the config file if not existed. - default: false
--fix Automatically fix problems
--dry-run Enable dry-run mode for --fix. Only show result, don't change the file.
--debug Outputs debugging information
--print-config Print the config object to stdout
-v, --version Outputs the version number.
Using stdin:
--stdin Lint text provided on <STDIN>. - default: false
--stdin-filename String Specify filename to process STDIN as
Output:
-o, --output-file path::String Enable report to be written to a file.
-f, --format String Use a specific output format.
Available formatter : checkstyle, compact, jslint-xml, json, junit, pretty-error, stylish, table, tap, unix
Available formatter for --fix: compats, diff, fixed-result, json, stylish - default: stylish
--no-color Disable color in piped output.
--quiet Report errors only. - default: false
Specifying rules and plugins:
--no-textlintrc Disable .textlintrc
--plugin [String] Set plugin package name
--rule [String] Set rule package name
--preset [String] Set preset package name and load rules from preset package.
--rulesdir [path::String] Use additional rules from this directory
Caching:
--cache Only check changed files - default: false
--cache-location path::String Path to the cache file or directory - default: .textlintcache
Experimental:
--experimental Enable experimental flag.Some feature use on experimental.
--rules-base-directory path::String Set module base directory. textlint load modules(rules/presets/plugins) from the base directory.
When running textlint, you can target files to lint using the glob patterns. Make sure that you enclose any glob parameter you pass in quotes.
1$ npx textlint "docs/**"
For more details, see CLI documentation.
- Documentation: CLI
Example:
- :information_source: See examples/cli
.textlintrc
.textlintrc
is config file that is loaded as JSON, YAML or JS via azu/rc-config-loader.
Running textlint with the following arguments
$ npx textlint --rule no-todo --rule very-nice-rule README.md
is equivalent to running textlint README.md
in a directory with a .textlintrc.json
containing the following json
1{ 2 "rules": { 3 "no-todo": true, 4 "very-nice-rule": true 5 } 6}
You can also configure options for specific rules in your .textlintrc.json
file.
1{ 2 "rules": { 3 "no-todo": false, // disable 4 "very-nice-rule": { 5 "key": "value" 6 } 7 } 8}
For example here we pass the options ("key": "value") to very-nice-rule
.
Options can be specified in your .textlintrc.json
file as follows:
1{ 2 // Allow to comment in JSON 3 "rules": { 4 "<rule-name>": true | false | object 5 } 6}
:information_source: for more details see
Plugin
A textlint plugin is a set of rules and rulesConfig or customize parser.
To enable plugin, put the "plugin-name" into .textlintrc.json
.
1// `.textlintrc.json` 2{ 3 "plugins": [ 4 "plugin-name" 5 ], 6 // overwrite-plugins rules config 7 // <plugin>/<rule> 8 "rules": { 9 "plugin-name/rule-name" : false 10 } 11}
:information_source: See docs/plugin.md
Supported file formats
textlint supports Markdown and plain text by default.
Install Processor Plugin and add new file format support.
For example, if you want to lint HTML, use textlint-plugin-html as a plugin.
npm install textlint-plugin-html --save-dev
Add "html"
to .textlintrc.json
{
"plugins": [
"html"
]
}
Run textlint on .html
files:
textlint index.html
- Example: examples/html-plugin
- Documentation: docs/plugin.md
Optional supported file types:
- HTML: textlint-plugin-html
- reStructuredText: textlint-plugin-rst
- AsciiDoc/Asciidoctor: textlint-plugin-asciidoc-loose
- Re:VIEW: textlint-plugin-review
- Org-mode: textlint-plugin-org
See Processor Plugin List for details.
Rules list :green_heart:
textlint has not built-in rules, but there are 100+ pluggable rules:
See A Collection of textlint rule · textlint/textlint Wiki for more details.
If you create a new rule, and add it to the wiki :)
Fixable
Some rules are fixable using the --fix
command line flag.
1$ npx textlint --fix README.md 2# As a possible, textlint fix the content.
Also, support dry run mode.
$ npx textlint --fix --dry-run --format diff README.md
# show the difference between fixed content and original content.
You can copy and paste to your README.
1[![textlint fixable rule](https://img.shields.io/badge/textlint-fixable-green.svg?style=social)](https://textlint.github.io/)
Built-in formatters
Use the following formatters:
- stylish (defaults)
- compact
- checkstyle
- jslint-xml
- junit
- tap
- table
- pretty-error
- json
- unix
e.g. use pretty-error
formatter:
$ npx textlint -f pretty-error file.md
More details in @textlint/linter-formatter.
Use as node module
You can use textlint as node module.
$ npm install textlint --save-dev
Minimal usage:
1import { createLinter, loadTextlintrc, loadLinterFormatter } from "textlint"; 2const descriptor = await loadTextlintrc(); 3const linter = createLinter({ descriptor }); 4const results = await linter.lintFiles(["*.md"]); 5// textlint has two types formatter sets for linter and fixer 6const formatter = await loadLinterFormatter({ formatterName: "stylish" }); 7const output = formatter.format(results); 8console.log(output);
More details info, please read the following documents:
@textlint/kernel is a low level API for textlint. It is useful for the browser or non-Node.js environments.
1import { TextlintKernel } from "@textlint/kernel"; 2const kernel = new TextlintKernel(); 3const options = { 4 filePath: "/path/to/file.md", 5 ext: ".md", 6 plugins: [ 7 { 8 pluginId: "markdown", 9 plugin: require("@textlint/textlint-plugin-markdown") 10 } 11 ], 12 rules: [ 13 { 14 ruleId: "no-todo", 15 rule: require("textlint-rule-no-todo").default 16 } 17 ] 18}; 19kernel.lintText("TODO: text", options).then(result => { 20 assert.ok(typeof result.filePath === "string"); 21 assert.ok(result.messages.length === 1); 22});
Conclusion
textlint has four extensible points:
- rule
- rule is a rule for linting.
- filter rule
- filter rule is a rule for filtering result of errors.
- rule-preset
- rule-preset contains rules.
- plugin
- plugin contains a processor.
FAQ: How to create rules?
Please see docs/
- docs/txtnode.md
- What is TxtNode?
- docs/rule.md
- How to create rules?
- Tutorial: creating
no-todo
rule.
- docs/rule-advanced.md
- Advanced tutorial for creating rule.
FAQ: How to suppress error by comments like <!-- textlint-disable -->
?
You can use filter rule like textlint-filter-rule-comments.
Please see Ignoring Text · textlint for more details.
Integrations
For more details, see integrations document.
App
- textlint-app
- Standalone cross platform app. No need Node.js environment.
Build Systems
- gulp plugin
- Grunt plugin
Editors
- Atom Editor
- SublimeText
- Vim
- VS Code
- micro
- NetBeans
Browser
- Chrome Extension
Other
Who's using textlint?
- survivejs/webpack-book
- hoodiehq/hoodie
- asciidwango/js-primer
- vuejs-jp/vuejs.org
- cypress-io/cypress-documentation
Packages
This repository is a monorepo that we manage using Lerna. That means that we actually publish several packages to npm from the same codebase, including:
Core
These modules are parts of textlint.
Package | Version | Description |
---|---|---|
textlint | textlint command line tool itself | |
@textlint/kernel | textlint main logic module. It is universal JavaScript. | |
@textlint/linter-formatter | textlint output formatter | |
@textlint/fixer-formatter | textlint output formatter for fixer | |
@textlint/textlint-plugin-markdown | markdown support for textlint | |
@textlint/textlint-plugin-text | plain text support for textlint | |
@textlint/ast-tester | Compliance tests for textlint's AST | |
@textlint/markdown-to-ast | markdown parser | |
@textlint/ast-traverse | TxtNode traverse library | |
@textlint/text-to-ast | plain text parser | |
@textlint/config-loader | Load .textlintrc config file |
Rule/Plugin helper
These modules are useful for textlint rule/plugin author.
Package | Version | Description |
---|---|---|
@textlint/ast-node-types | textlint AST(Abstract Syntax Tree) type definition | |
textlint-tester | textlint rule testing tools | |
textlint-scripts | textlint rule npm run-scripts | |
create-textlint-rule | create textlint rule with no build configuration |
Integrations
These modules are useful integration with textlint.
Package | Version | Description |
---|---|---|
gulp-textlint | gulp plugin for textlint |
Internal
These modules are internal usage in the monorepo.
Package | Version | Description |
---|---|---|
@textlint/feature-flag | feature flag manager |
Semantic Versioning Policy
textlint project follow Semantic Versioning. However, textlint is not different with most semver project.
- Patch release (intended to not break your lint build)
- A bug fix to the CLI or core (including formatters).
- Improvements to documentation.
- Non-user-facing changes such as refactoring.
- Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
- Minor release (might break your lint build)
- A new option.
- An existing rule is deprecated.
- A new CLI capability is created.
- New public API are added (new classes, new methods, new arguments to existing methods, etc.).
- It might break type interface(
.d.ts
)
- It might break type interface(
- A new formatter is created.
- Major release (break your lint build)
- A new option to an existing rule that results in textlint reporting more errors by default.
- An existing formatter is removed.
- Part of the public API is removed or changed in an incompatible way.
Contributing
For bugs and feature requests, please create an issue.
Pull requests is always welcome.
For more details, see Contributing Guide.
License
MIT © azu
Copy some code from ESLint.
ESLint
Copyright (c) 2013 Nicholas C. Zakas. All rights reserved.
https://github.com/eslint/eslint/blob/master/LICENSE
Logos & Icons
Download from textlint/media.
Related Work
Acknowledgements
Thanks to ESLint.
textlint website is powered by Netlify.
No vulnerabilities found.
Reason
20 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
packaging workflow detected
Details
- Info: Project packages its releases by way of GitHub Actions.: .github/workflows/release-canary.yml:9
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/textlint/.github/SECURITY.md:1
- Info: Found linked content: github.com/textlint/.github/SECURITY.md:1
- Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy
- Info: Found text in security policy: github.com/textlint/.github/SECURITY.md:1
Reason
SAST tool detected but not run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Warn: 23 commits out of 30 are checked with a SAST tool
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:76: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:98: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:101: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/ci.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:70: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/create-release-pr.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/create-release-pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/create-release-pr.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/create-release-pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/create-release-pr.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/create-release-pr.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/create-release-pr.yml:53: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/create-release-pr.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-canary.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/release-canary.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release-canary.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/release-canary.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/release.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:87: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/release.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:96: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:107: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/release.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/website.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/website.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/website.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/website.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/website.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/textlint/textlint/website.yml/master?enable=pin
- Info: 0 out of 24 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 5 third-party GitHubAction dependencies pinned
- Info: 7 out of 7 npmCommand dependencies pinned
Reason
Found 5/23 approved changesets -- score normalized to 2
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: jobLevel 'contents' permission set to 'write': .github/workflows/ci.yml:34
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/release.yml:24
- Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:54
- Warn: jobLevel 'packages' permission set to 'write': .github/workflows/release.yml:57
- Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yml:5
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: topLevel 'contents' permission set to 'write': .github/workflows/create-release-pr.yml:15
- Info: topLevel 'contents' permission set to 'read': .github/workflows/release-canary.yml:6
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Info: topLevel 'contents' permission set to 'read': .github/workflows/website.yml:8
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
34 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-7wwv-vh3v-89cq
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-33f9-j839-rf8h
- Warn: Project is vulnerable to: GHSA-c36v-fmgq-m8hx
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx
- Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
5.8
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More