Gathering detailed insights and metrics for @textlint/types
Gathering detailed insights and metrics for @textlint/types
Gathering detailed insights and metrics for @textlint/types
Gathering detailed insights and metrics for @textlint/types
The pluggable natural language linter for text and markdown.
npm install @textlint/types
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2,850 Stars
3,681 Commits
158 Forks
39 Watching
11 Branches
81 Contributors
Updated on 28 Nov 2024
TypeScript (84.2%)
JavaScript (15.15%)
CSS (0.6%)
HTML (0.05%)
Cumulative downloads
Total Downloads
Last day
9.5%
29,501
Compared to previous day
Last week
-0.1%
136,246
Compared to previous week
Last month
4.9%
567,698
Compared to previous month
Last year
30.8%
5,472,007
Compared to previous year
The pluggable linting tool for text and markdown.
textlint is similar to ESLint, but it's for use with natural language.
Visit https://textlint.github.io/.
npm install textlint-rule-xxx
.For a quick tour of textlint, checkout our Getting Started guide :squirrel:
You can install the textlint
command using npm:
$ npm install textlint --save-dev
Requirements:
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:
textlint
globally you must install each reference rule globally as well.textlint
locally you must install each rule locally as well.We recommend installing textlint
locally.
If you've never used Node.js and npm, please see the following:
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
.
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.
Example:
.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
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
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
Optional supported file types:
See Processor Plugin List for details.
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 :)
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/)
Use the following formatters:
e.g. use pretty-error
formatter:
$ npx textlint -f pretty-error file.md
More details in @textlint/linter-formatter.
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});
textlint has four extensible points:
Please see docs/
no-todo
rule.<!-- textlint-disable -->
?You can use filter rule like textlint-filter-rule-comments.
Please see Ignoring Text · textlint for more details.
For more details, see integrations document.
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:
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 |
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 |
These modules are useful integration with textlint.
Package | Version | Description |
---|---|---|
gulp-textlint | gulp plugin for textlint |
These modules are internal usage in the monorepo.
Package | Version | Description |
---|---|---|
@textlint/feature-flag | feature flag manager |
textlint project follow Semantic Versioning. However, textlint is not different with most semver project.
.d.ts
)For bugs and feature requests, please create an issue.
Pull requests is always welcome.
For more details, see Contributing Guide.
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
Download from textlint/media.
Thanks to ESLint.
textlint website is powered by Netlify.
No vulnerabilities found.
Reason
17 commit(s) and 4 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
Reason
packaging workflow detected
Details
Reason
security policy file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
Found 5/23 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
34 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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