← 返回命令列表

Linux command

textlint 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Lint markdown files

textlint "[docs/**/*.md]"

Lint a directory

textlint [docs/]

Auto-fix problems

textlint --fix [README.md]

Dry run to preview fixes

textlint --fix --dry-run --format diff [README.md]

Use specific config file

textlint -c [.textlintrc.json] [file.md]

Lint stdin

cat [README.md] | textlint --stdin --stdin-filename "README.md"

Output in JSON format

textlint --format json [docs/]

Initialize configuration

textlint --init

说明

textlint is a pluggable linter for natural language text. It checks prose for style issues, grammar problems, and writing inconsistencies using configurable rules. Rules are installed as npm packages and configured in .textlintrc. Available rules cover spelling, terminology, sentence length, redundant phrases, and writing style guidelines. Presets bundle commonly used rule sets. The tool supports Markdown, plain text, and other formats through plugins. It integrates with editors and CI/CD pipelines for automated text quality checks. Auto-fix mode can automatically correct many issues. Use dry-run with diff format to preview changes before applying. Install via npm: `npm install textlint`

参数

-c, --config _file_
Configuration file path.
--ignore-path _file_
File with patterns to ignore (default: .textlintignore).
--init
Create configuration file if not exists.
--fix
Automatically fix problems.
--dry-run
Preview fixes without writing.
--debug
Output debugging information.
--print-config
Print resolved configuration.
--stdin
Lint text from stdin.
--stdin-filename _name_
Filename for stdin input.
-f, --format _format_
Output format: stylish, json, checkstyle, compact, junit, tap, unix.
-o, --output-file _file_
Write report to file.
--no-color
Disable colored output.
--quiet
Report errors only.
--no-textlintrc
Disable .textlintrc loading.
--rule _rule_
Rule package to use.
--preset _preset_
Preset package to load.
--plugin _plugin_
Plugin package to use.
--cache
Only check changed files.
-v, --version
Display version.
-h, --help
Display help.

FAQ

What is the textlint command used for?

textlint is a pluggable linter for natural language text. It checks prose for style issues, grammar problems, and writing inconsistencies using configurable rules. Rules are installed as npm packages and configured in .textlintrc. Available rules cover spelling, terminology, sentence length, redundant phrases, and writing style guidelines. Presets bundle commonly used rule sets. The tool supports Markdown, plain text, and other formats through plugins. It integrates with editors and CI/CD pipelines for automated text quality checks. Auto-fix mode can automatically correct many issues. Use dry-run with diff format to preview changes before applying. Install via npm: `npm install textlint`

How do I run a basic textlint example?

Run `textlint "[docs/**/*.md]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c, --config _file_ do in textlint?

Configuration file path.