textlint

  • Version 14.0.4
  • Published
  • 739 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

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(files: string[]): Promise<TextlintResult[]>;
lintText(text: string, filePath: string): Promise<TextlintResult>;
fixFiles(files: string[]): Promise<TextlintFixResult[]>;
fixText(text: string, filePath: string): Promise<TextlintFixResult>;
};

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

                type LoadTextlintrcOptions

                type LoadTextlintrcOptions = {
                /**
                * config file path
                * /path/to/.textlintrc
                */
                configFilePath?: string;
                /**
                * custom node_modules directory
                */
                node_modulesDir?: string;
                };

                  Package Files (8)

                  Dependencies (26)

                  Dev Dependencies (18)

                  Peer Dependencies (0)

                  No peer dependencies.

                  Badge

                  To add a badge like this onejsDocs.io badgeto 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
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](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>