textlint
- Version 14.4.2
- Published
- 662 kB
- 26 dependencies
- MIT license
Install
npm i textlint
yarn add textlint
pnpm add textlint
Overview
The pluggable linting tool for text and markdown.
Index
Variables
Functions
Classes
Type Aliases
Variables
variable cli
const cli: { execute(args: string | Array<string>, text?: string): Promise<number>; executeWithOptions(executeOptions: ExecuteOptions): Promise<number>;};
Encapsulates all CLI behavior for eslint. Makes it easier to test as well as for other Node.js programs to effectively run the CLI.
variable textlint
const textlint: TextLintCore;
singleton instance
Deprecated
use new APIs https://textlint.github.io/docs/use-as-modules.html#new-apis
Functions
function createLinter
createLinter: (options: CreateLinterOptions) => { lintFiles(filesOrGlobs: string[]): Promise<TextlintResult[]>; lintText(text: string, filePath: string): Promise<TextlintResult>; fixFiles(fileOrGlobs: string[]): Promise<TextlintFixResult[]>; fixText(text: string, filePath: string): Promise<TextlintFixResult>; scanFilePath(filePath: string): Promise<ScanFilePathResult>;};
function loadTextlintrc
loadTextlintrc: ( options?: LoadTextlintrcOptions) => Promise<TextlintKernelDescriptor>;
Classes
class TextFixEngine
class TextFixEngine extends AbstractTextLintEngine<TextlintFixResult> {}
TextFixEngine a adapter for TextLintEngineCore. It aim to pull the whole look together. (TextLintEngine and TextFixEngine)
Deprecated
use new APIs https://textlint.github.io/docs/use-as-modules.html#new-apis
constructor
constructor(...args: any[]);
property onFile
onFile: ( textlintCore: TextLintCore) => (file: string) => Promise<TextlintFixResult>;
Parameter textlintCore
Returns
{function()}
property onFormat
onFormat: ( formatterConfig: TextLintFormatterOption) => (results: TextlintFixResult[]) => string;
Parameter formatterConfig
property onText
onText: ( textlintCore: TextLintCore) => (text: string, ext?: string) => Promise<TextlintFixResult>;
Parameter textlintCore
Returns
{function()}
class TextLintCore
class TextLintCore {}
{TextLintCore}
Deprecated
use new APIs https://textlint.github.io/docs/use-as-modules.html#new-apis
constructor
constructor(config?: Partial<Config>);
property textlintKernelDescriptor
textlintKernelDescriptor: TextlintKernelDescriptor;
method addProcessor
addProcessor: (Processor: TextlintPluginProcessorConstructor) => void;
Use setupPlugins insteadof it.
```` textlint.setupPlugins({ yourPluginName: yourPlugin }); ````
Parameter Processor
Deprecated
It will be removed until textlint@10
method fixFile
fixFile: (filePath: string) => Promise<TextlintFixResult>;
fix file and return fix result object
Parameter filePath
Returns
{Promise.}
method fixText
fixText: (text: string, ext?: string) => Promise<TextlintFixResult>;
fix texts and return fix result object
Parameter text
Parameter ext
Returns
{Promise.}
method lintFile
lintFile: (filePath: string) => Promise<TextlintResult>;
lint file and return result object
Parameter filePath
Returns
{Promise.} result
method lintMarkdown
lintMarkdown: (text: string) => Promise<TextlintResult>;
lint markdown text by registered rules. The result contains target filePath and error messages.
Parameter text
markdown format text
Returns
{Promise.}
method lintText
lintText: (text: string, ext?: string) => Promise<TextlintResult>;
lint text by registered rules. The result contains target filePath and error messages.
Parameter text
Parameter ext
ext is extension. default: .txt
Returns
{Promise.}
method resetRules
resetRules: () => void;
Remove all registered rule and clear messages.
method setupFilterRules
setupFilterRules: (filterRules?: {}, filterRulesOption?: {}) => void;
Register filterRules and filterRulesConfig. if want to release rules, please call resetRules.
Parameter filterRules
rule objects array
Parameter filterRulesOption
ruleConfig is object
method setupPlugins
setupPlugins: ( plugins?: { [index: string]: TextlintPluginCreator }, pluginsConfig?: { [index: string]: TextlintPluginOptions }) => void;
register Processors
Parameter plugins
Parameter pluginsConfig
method setupRules
setupRules: (rules?: {}, rulesOption?: {}) => void;
Register rules and rulesConfig. if want to release rules, please call resetRules.
Parameter rules
rule objects array
Parameter rulesOption
ruleConfig is object
class TextLintEngine
class TextLintEngine extends AbstractTextLintEngine<TextlintResult> {}
TextLintEngine a adapter for TextLintEngineCore. It aim to pull the whole look together. (TextLintEngine and TextFixEngine)
Deprecated
use new APIs https://textlint.github.io/docs/use-as-modules.html#new-apis
constructor
constructor(...args: any[]);
property onFile
onFile: ( textlintCore: TextLintCore) => (file: string) => Promise<TextlintResult>;
Parameter textlintCore
Returns
{function()}
property onFormat
onFormat: ( formatterConfig: TextLintFormatterOption) => (results: TextlintResult[]) => string;
Parameter formatterConfig
property onText
onText: ( textlintCore: TextLintCore) => (text: string, ext: string | undefined) => Promise<TextlintResult>;
Parameter textlintCore
Returns
{function()}
Type Aliases
type CreateLinterOptions
type CreateLinterOptions = { descriptor: TextlintKernelDescriptor; ignoreFilePath?: string; quiet?: boolean; cache?: boolean; cacheLocation?: string; /** * The current working directory */ cwd?: string;};
type LoadTextlintrcOptions
type LoadTextlintrcOptions = { /** * config file path * /path/to/.textlintrc */ configFilePath?: string; /** * custom node_modules directory */ node_modulesDir?: string;};
Package Files (8)
Dependencies (26)
- @textlint/ast-node-types
- @textlint/ast-traverse
- @textlint/config-loader
- @textlint/feature-flag
- @textlint/fixer-formatter
- @textlint/kernel
- @textlint/linter-formatter
- @textlint/module-interop
- @textlint/resolver
- @textlint/textlint-plugin-markdown
- @textlint/textlint-plugin-text
- @textlint/types
- @textlint/utils
- debug
- file-entry-cache
- get-stdin
- glob
- md5
- mkdirp
- optionator
- path-to-glob-pattern
- rc-config-loader
- read-pkg
- read-pkg-up
- structured-source
- unique-concat
Dev Dependencies (18)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/textlint
.
- Markdown[](https://www.jsdocs.io/package/textlint)
- HTML<a href="https://www.jsdocs.io/package/textlint"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4449 ms. - Missing or incorrect documentation? Open an issue for this package.