textlint

The pluggable natural language linter for text and markdown.

MIT License

Downloads
7.4M
Stars
2.8K
Committers
83

Bot releases are visible (Hide)

textlint -

Published by azu over 5 years ago

[email protected]

  • deps: move some dependencies to devDependencies #581

Thanks to @karak

All updates

textlint -

Published by azu almost 6 years ago

Changes between https://github.com/textlint/textlint/compare/[email protected]@11.2.0

Summary

Rule creator can use constant value for *:exit.


-                    [Syntax.Str + ":exit"](node) {
+                    [Syntax.StrExit](node) {
                        report(node, new RuleError("message"));
                    }

For more details, See https://textlint.github.io/docs/txtnode.html#type

@textlint/[email protected]

features

This changes add constant type for *:exit Syntax like DocumentExit.

  • ast-node-types: add `*Exit` type as constant value (7106f5d)
  • ast-node-types: add `TypeofTxtNode` type function (69bc1ea)

For more details, See https://textlint.github.io/docs/txtnode.html#type

@textlint/[email protected]

fixes

  • textlint-plugin-markdown: remove cycle dependency (b241962)
  • textlint-plugin-text: Use @textlint/kernel instead of textlint (5a2fd25), closes #567

@textlint/[email protected]

fixes

  • types: enhance `TextlintRuleReportHandler` typing (aa354d1)

[email protected]

fixes

  • types: enhance `TextlintRuleReportHandler` typing (aa354d1)

[email protected]

fixes

  • textlint: fix package's keyword (2a600b8)

features

  • ast-node-types: add `*Exit` type as constant value (7106f5d)

All versions

textlint -

Published by azu almost 6 years ago

This minor release does not includes breaking change.
Almost changes is related with TypeScript definition.

In other words, almost changes is not related textlint CLI user.

📝 Summary

@textlint/[email protected]

Features

  • types: Add AnyTxtNode #562

@textlint/[email protected]

  • Add @textlint/types pacakge #561 #562

This pacakge define types for textlint.

@textlint/[email protected]

fixes

[email protected]

fixes

♻️ Refactoring

Move following types to @textlint/types from @textlint/kernel.
Also, @textlint/kernel export these types for back-compatible reason.

  • TextlintResult
  • TextlintFixResult
  • TextlintMessageFixCommand
  • TextlintMessage
  • TextlintRuleReporter,
  • TextlintRuleModule
  • TextlintRuleOptions
  • TextlintRuleSeverityLevel,
  • TextlintFilterRuleReporter,
  • TextlintFilterRuleOptions,
  • TextlintPluginCreator
  • TextlintPluginOptions
  • TextlintPluginProcessor
  • TextlintPluginProcessorConstructor

Move files

Move following codes to @textlint/types from @textlint/kernel.
Also, @textlint/types export it.

  • TextlintSourceCode
  • TextlintSourceCodeArgs
  • TextlintSourceCodeRange
  • TextlintSourceCodeLocation

Add types

@textlint/types and @textlint/kernel export these new types.

  • TextlintRuleSeverityLevel
  • TextlintMessageFixCommand
  • AnyTxtNode
    • @textlint/ast-node-types

Realted refactoring

  • @textlint/linter-formatter: use @textlint/types instead of @textlint/kernel
  • @textlint/fixer-formatter: use @textlint/types instead of @textlint/kernel

For more details, see #561

textlint - [email protected] support Node.js 11

Published by azu almost 6 years ago

Summary 📝

  • textlint support Node.js 11
  • Fix a bug about textlint-tester

[email protected] and @textlint/[email protected]

fixes

  • kernel: fix applyFix order on Node.js 11 (714a90c)

[email protected]

fixes

  • gulp-textlint: upgrade to gulp@4 (47a3ad9)

[email protected]

fixes

  • textlint-tester: fix text only valid test is always passed (#551) (c104007)
textlint -

Published by azu about 6 years ago

[email protected]

refactor

  • make arguments optional correctly #546

[email protected]

fixes

  • textlint-tester: fix text only valid test is always passed (#551) (c104007)
textlint -

Published by azu over 6 years ago

textlint - Fix regression [email protected]

Published by azu over 6 years ago

This version will fix regression of [email protected] #517

@textlint/[email protected]

fixes

  • markdown-to-ast: enable yaml frontmatter parse by default (121c62f) #518
textlint -

Published by azu over 6 years ago

@textlint/[email protected]

fixes

  • upgrade remark@^9.0.0 (8a70c0f) #514

[email protected]

fixes

features

  • support --no-textlintrc (466e257) #512 #225
textlint -

Published by azu over 6 years ago

[email protected]

fixes

  • textlint: remove utf-8-validate (7668c1b)
  • test: use ts-node-test-register for TypeScript testing (be746d8), closes #451
textlint -

Published by azu over 6 years ago

Summary

Move core modules to @textlint namespace · Issue #455

Move core pacakges to @textlint scoped.

PR Before After
#473 txt-to-ast @textlint/text-to-ast
#460 markdown-to-ast @textlint/markdown-to-ast
#483 textlint-ast-test @textlint/ast-tester
#484 txt-ast-traverse @textlint/ast-traverse
#482 textlint-fixer-formatter @textlint/fixer-formatter
#474 textlint-formatter @textlint/linter-formatter
#485 textlint-plugin-markdown @textlint/textlint-plugin-markdown
#486 textlint-plugin-text @textlint/textlint-plugin-text

For more details, see #455

For textlint user

If you have seen following deprecated warning, please update latester textlint, textlint-tester, or textlint-scripts.

warning textlint-scripts > textlint-tester > textlint > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > textlint-plugin-text > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > textlint-plugin-markdown > [email protected]: See https://github.com/textlint/textlint/issues/455
warning textlint-scripts > textlint-tester > textlint > @textlint/kernel > [email protected]: See https://github.com/textlint/textlint/issues/455

Update latest version

npm install textlint@latest
npm install textlint-scripts@latest

For node modules user

If you use someone of Migration pacakges, please move to scoped version.

For example, If you use markdown-to-ast, you migrate from markdown-to-ast to @textlint/markdown-to-ast.

npm uninstall markdown-to-ast
npm install @textlint/markdown-to-ast

And, you should change require("markdown-to-ast") to require("@textlint/markdown-to-ast").

textlint-tester: use with plugin #488

textlint-tester support multiple rules and plugins.

You can write a test for using plugins.

const TextLintTester = require("textlint-tester");
const htmlPlugin = require("textlint-plugin-html");
const noTodoRule = require("textlint-rule-no-todo");
const maxNumberOfLineRule = require("textlint-rule-max-number-of-lines");
const tester = new TextLintTester();

tester.run(
    "new-style-of-test: rule and plugin",
    {
        plugins: [
            {
                pluginId: "html",
                plugin: htmlPlugin
            }
        ],
        rules: [
            {
                ruleId: "no-todo",
                rule: noTodoRule
            }
        ]
    },
    {
        valid: [
            {
                text: "<p>日本語 is Japanese.</p>",
                ext: ".html"
            }
        ],
        invalid: [
            // line, column
            {
                text: `<p>TODO: no todo</p>
<p>Another paragraph</p>
<p>Yet another paragraph</p>`,
                ext: ".html",
                errors: [
                    {
                        message: "Found TODO: 'TODO: no todo'",
                        line: 1,
                        column: 4
                    }
                ]
            }
        ]
    }
);

Changelog

@textlint/[email protected]

fixes

@textlint/[email protected]

fixes

@textlint/[email protected]

fixes

[email protected]

fixes

  • textlint-tester: clarify when multiple options were found (5ffe903)
  • textlint-tester: correct options handling for rules and plugins (985d03a)
  • textlint-tester: make plugins at TestConfig optional (3ebc1d7)
  • textlint-tester: add user-defined type guard (77b0e95)
  • textlint-tester: improve codes according to review comments (178ba8a)
  • textlint-tester: rename TestTarget to TestConfig (59ed69d)
  • textlint-tester: update README (46aed3f)
  • textlint-tester: update README with new function signature (d419a15),

features

  • textlint-tester: add multiple rules and plugins test support (bedf761)
  • textlint-tester: add new style test case (9e36143)
  • textlint-tester: add valid test case which pass a TestConfig that has multiple rules only (c02a1ec)
  • textlint-tester: implement configuration assertion (09c9db3)
textlint - Migrate to @textlint pacakges

Published by azu almost 7 years ago

Migrate to @textlint pacakges

Currently, textlint move to scoped pacakge(@textlint). #455
This release is progress report in this migration.

PR Before After
#473 txt-to-ast @textlint/text-to-ast
#460 markdown-to-ast @textlint/markdown-to-ast
#483 textlint-ast-test @textlint/ast-tester
txt-ast-traverse @textlint/ast-traverse
#482 textlint-fixer-formatter @textlint/fixer-formatter
#474 textlint-formatter @textlint/linter-formatter
textlint-plugin-markdown @textlint/textlint-plugin-markdown
textlint-plugin-text @textlint/textlint-plugin-text

ℹ️ Migration information for user

If you use someone of Migration pacakges, please move to scoped version.

For example, If you use markdown-to-ast, you migrate from markdown-to-ast to @textlint/markdown-to-ast.

npm uninstall markdown-to-ast
npm install @textlint/markdown-to-ast

And, you should change require("markdown-to-ast") to require("@textlint/markdown-to-ast").

CHANGELOGS

@textlint/[email protected]

  • ast-tester: add publishConfig (e7a150b)

@textlint/[email protected]

  • fixer-formatter: add publishConfig (3e89e3c)

@textlint/[email protected]

  • linter-formatter: add publishConfig (9f54a5a)

@textlint/[email protected]

  • markdown-to-ast: add "publishConfig" (929b575)

[email protected]

  • tester: fix "main" and "types" field in package.json (567ba65)
textlint -

Published by azu almost 7 years ago

[email protected] includes following changes.

@textlint/[email protected]

  • kernel: fix return type of SourceCode#getSource (1b55894) #444
  • kernel: pass the file path to preProcess() that is on FixerProcessor (#458) (5b947aa) #458
textlint -

Published by azu almost 7 years ago

@textlint/[email protected]

  • ast-node-types: Make ASTNodeTypes string enum #422

@textlint/[email protected]

  • feature-flag: Update MapLile@2 (5b261f0)

[email protected]

  • fixer-formatter: getFormatterList method is renamed.
textlint -

Published by azu almost 7 years ago

🌟 Highlight

Improve textlint --help #85 by @0x6b

textlint -h show available formatter name list.

textlint [options] file.md [file|dir|glob*]

Options:
  -h, --help                 Show help.
  -c, --config path::String  Use configuration from this file or sharable config.
  --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
  -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, json, stylish
  --no-color                 Disable color in piped output.
  --quiet                    Report errors only. - default: false

Specifying rules and plugins:
  --plugin [String]          Set plugin package name
  --rule [path::String]      Set rule package name
  --preset [path::String]    Set preset package name and load rules from preset package.
  --rulesdir [path::String]  Set rules from this directory and set all default rules to off.

Caching:
  --cache                    Only check changed files - default: false
  --cache-location path::String  Path to the cache file or directory

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.

Imrove error message when not rules in .textlintrc

Return an exit status(code 0) when no rules found (#408) (3dc76e4), closes #406 by @sapegin

🎉 New Collaborator

  • @0x6b join to @textlint/collaborator #418

CHANGELOG

@textlint/[email protected]

  • monorepo: fix TypeScript module resolution in monorepo (d5df499)

@textlint/[email protected]

  • kernel: fix import path (02d98fe)
  • monorepo: fix TypeScript module resolution in monorepo (d5df499)

[email protected]

  • textlint-fixer-formatter: add getFormatterList function (8de3fef)

[email protected]

  • textlint-formatter: define TextLintFormatterOption interface (31146c7)
  • textlint-formatter: run all tests (6d507c2), closes #402
  • textlint-formatter: Update API (8f4901f),- textlint-formatter: add getFormatterList function (25e1113)
  • textlint-formatter: add new option to cli (30351a8),- textlint-formatter: export { createFormatter } instead of { default }

[email protected]

  • textlint: Return an exit status when no rules found (#408) (3dc76e4), closes #406
  • textlint: show available formatter in help (af6b0da), closes #85

[email protected]

  • monorepo: fix TypeScript module resolution in monorepo (d5df499)
  • txt-ast-traverse: fix test scripts (a78f99b)
  • txt-ast-traverse: fix txt-ast-traverse test reference (190723b)
textlint -

Published by azu almost 7 years ago

textlint 10.0.1 (2017-12-19)

Bug Fixes

  • textlint: throw an error if file is not encoded in UTF8 (dfe7e28)

textlint-tester 4.0.1 (2017-12-19)

Bug Fixes

  • textlint-tester: Correct output ${text} (d0ecbab)
textlint - textlint 10.0.0

Published by azu almost 7 years ago

🆕 Features

@textlint/ast-node-types: TxtNode type interface

@textlint/ast-node-types get TxtNode type interface #358
It is useful for TypeScript user.

For more details. see https://github.com/textlint/textlint/blob/master/docs/txtnode.md

textlint: Use with TypeScript #248

@textlint/kernel and textlint export type interfaces.

// Types
import {
    TextlintResult,
    TextlintFixResult,
    TextlintFixCommand,
    TextlintMessage,
    // Kernel rule/filter/plugin format
    TextlintKernelRule,
    TextlintKernelFilterRule,
    TextlintKernelPlugin,
    // Notes: Following interface will be separated module in the future.
    // textlint rule interface
    TextlintRuleCreator,
    TextlintRuleOptions,
    // textlint filter rule interface
    TextlintFilterRuleCreator,
    TextlintFilterRuleOptions,
    // textlint plugin interface
    TextlintPluginCreator,
    TextlintPluginOptions,
    TextlintPluginProcessor,
    TextlintPluginProcessorConstructor
} from "@textlint/kernel";

If you want to improve TypeScript integration, please file issue or track following issue.

textlint-tester: support inputPath option #394

textlint-tester support inputPath options.
It can test path-based rules.

🔥 Breaking Change

A breaking change, but this changes not affect to textlint tool user.
This changes affect to user that user textlint as node modules.

textlint: Export as ES module #337 #344

Before

Export as common js module.

module.exports = {
  textlint,
  TextLintEngine,
}

After

Export as named module.

export { 
  textlint,
  TextLintEngine
}

You can import it as es named import.

import { textlint } from "textlint"

or

You can import it as common js module

const textlint = require("textlint").textlint

Stop to export unused name #344

We have removed following from textlint.

  • TextLintNodeType
  • TextLintMessageSeverityLevel
  • TextLintMessageType
    • Use @textlint/ast-node-types insteadof it

📝 Documentaion

Improve Contributing Guide.

Issues/PR: #380 #379 #355 #352 #353 #341 #387 by @Leko and @0x6b

We have improved Contributing Guide.
This Contributing Guide help you to contribute to textlint.

If you want to contribute to texltlint, let's see issues with the good first issue label.

♻️ Polish

Monorepo #270

Import following modules into this monorepo.

  • textlint-formatter #359
  • textlint-ast-test #357
  • txt-ast-traverse #356
  • textlint-fixer-formatter #347

Thanks to @Leko

🎉 New Contributors

  • @Leko – Refactor modules, fixes bug, and improve stability of textlint
  • @0x6b - improve Contributing Guide
textlint -

Published by azu almost 7 years ago

Bug fixes

[email protected] add shorthand of scoped pacakge support in .textlintrc #326
But it is not working on preset module #327

texlint 9.1.1 just fixes the scoped preset module bug #329

Work following shorthand of preset module.

{
  "rules": {
    "@textlint-rule/preset-google": true
  }
}
textlint -

Published by azu almost 7 years ago

Features

  • textlint: Support shortcut scoped package name #326

You can write @scope/name in .textlintrc.
@scope/name is shortcut name of @scope/textlint-rule-name.

For more details, See Configuration document.

textlint - textlint 9.0.0

Published by azu almost 7 years ago

♻️ Refactor

textlint-kernel: Convert JavaScript to TypeScript #248 #301

Convert @textlint/kernel from JavaScript to Typescript.

If you instersting in TypeScript support, please see #248 .

Currently, Type definition is unstable. It means that break change in minor version.

🆕 Feature

Plugins can be initialized with plugin options #296

Allow to specify following options.

{
  "plugins": {
     "text": { "custom": "value" }
  }
}

For mode details, See document of plugin.

textlint-tester: support "index" expected param #324

Allow to write following index based testing.

const TextLintTester = require("textlint-tester");
const tester = new TextLintTester();
tester.run("rule", rule, {
    invalid: [
        // index
        {
            text: "- [ ] string",
            errors: [
                {
                    message: "Found TODO: '- [ ] string'",
                    index: 2
                }
            ]
        }
    ]
});

🐛 Bug Fixes

textlint: don't use error.code when catch error #323

Fix to use correct exit code. Thanks to @buzztaiki

🔥 BREAKING CHANGE

These breaking change is for plugin/rule author.

Remove context.config #294 #295

You can use context.getConfigBaseDir() instead of context.config.

  • getConfigBaseDir() return config base directory path that is the place of .textlintrc
    • e.g.) /path/to/dir/.textlintrc
    • getConfigBaseDir() return "/path/to/dir/".

Related rules changes:

Drop "rules" and "rulesConfig" from plugin #291 #313

You can use preset feature instead of plugin.
The textlint plugin should focus on processor.

Disallow to use 3rd argument of context.report function #316

It prevent wrong usage of report function:

NG:

report(node,
  new RuleError(`using "please" in a set of instructions is overdoing the politeness.`), {
    index,
    fix: fixer.replaceTextRange(range, result.replace)
  }
)

OK:

report(node,
  new RuleError(`using "please" in a set of instructions is overdoing the politeness.`, {
    index,
    fix: fixer.replaceTextRange(range, result.replace)
  });
)