textlint

The pluggable natural language linter for text and markdown.

MIT License

Downloads
7.4M
Stars
2.8K
Committers
83

Bot releases are hidden (Show)

textlint - v12.5.1

Published by azu almost 2 years ago

12.5.1 (2023-01-04)

Bug Fixes

Full Changelog: https://github.com/textlint/textlint/compare/v12.5.0...v12.5.1

textlint - v12.5.0

Published by azu almost 2 years ago

12.5.0 (2023-01-04)

Features

Example:

$ cat README.md | npx textlint --stdin --stdin-filename README.md --fix --format fixed-result --output-file NEW.md

For more details, see https://textlint.github.io/docs/cli.html#pipe-to-textlint

New Contributors

Full Changelog: https://github.com/textlint/textlint/compare/v12.4.0...v12.5.0

textlint - v12.4.0

Published by azu almost 2 years ago

12.4.0 (2023-01-02)

Features

  • textlint: add --print-config flag (9aa400f)

What's Changed

Full Changelog: https://github.com/textlint/textlint/compare/v12.3.1...v12.4.0

textlint - v12.3.1

Published by azu almost 2 years ago

12.3.1 (2022-12-30)

Bug Fixes

  • deps: update babel monorepo to ^7.20.7 (30a1386)
  • textlint: fix ESM loading issue on Windows (#972) (a6b9bf5)
textlint - v12.3.0

Published by azu almost 2 years ago

12.3.0 (2022-12-29)

Features

  • monorepo: upgrade to lerna@6 and use NX (#964) (e372795)
  • textlint: add new APIs and new CLI for ESM (#965) (3be8e39)

Overview

  • Support Rules/Filter/Pluugins that are written in ECMAScript Modules
  • Add new CLI
  • Add new APIs: createLinter/loadTextlintrc/loadLinterFormatter/loadFixerFormatter
    • It will replace TextLintCore/TextFixEngine/TextLintEngine

๐Ÿ“ ESM Rules/Filter/Pluugins only works in createLinter API.
This is because TextLintCore/TextFixEngine/TextLintEngine were assumed to be synchronous processes.
createLinter API does loading as async.

Breaking Changes

No changes in existing CLI.

Difference between Old-CLI and New-CLI

  • New CLI support ESM
  • New CLI must require --stdin-filename with --stdin
    • --stdin-filename may be optional in Old-CLI
  • Correct exit status

Exit Status on new CLI

0: No Error

  • Not found lint error
  • --fix: found errors but fix all errors, so exit with 0
  • --output-file: Found lint error but --output-file is specified
  • --dryRun: Found lint error but --dryRun is specified

1: Lint Error

  • found lint error
  • --fix: found errors and could not fix all errors, so exit with 1

2: Fatal Error

  • Crash textlint process
  • Fail to load config/rule/plugin etc...

New APIs

Ww introduce new API like createLinter for supporting Async APIs.
v13 continue to support current TextLintEngine and TextFixEngine for backward compatible.

  • #902

New createLinter and loadTextlintrc support ESM rules/plugins.
In other hands, TextLintEngine and TextFixEngine can not support ESM rules/plugins.

https://github.com/textlint/textlint/blob/60cea514f7eaefbff4411087d16a51daf68f12a4/packages/textlint/src/index.ts

API Description Behavior Target Platform Prev Status Next Status
cli Command LIne Interface Async Node.js โœ… โœ…ย (Use createTextlint internally)
textlint TextLintCore alias Async Node.js/CommonJS โŒ Deprecated โŒ Deprecated
TextLintCore Old API. It is Procedural API. Lint Only Single File. Recommended to use @texltint/kernel module instead of It. Async Node.js/CommonJS โŒ Deprecated โŒ Deprecated
TextLintEngine Lint Engine API. It load .textlintrc automaticaly โ—‰ Loading is Sync โ—‰ Linting is Async Node.js/CommonJS โœ… Recommended โŒ Deprecated
TextFixEngine Fix Engine API. It load .textlintrc automaticaly โ—‰ Loading is Sync โ—‰ Fixing is Async Node.js/CommonJS โœ… Recommended โŒ Deprecated
createLinter/loadTextlintrc Support Async APIs. โ—‰ Loading is Asyncโ—‰ Linting/Fixing is Async Node.js/CommonJS and ESM None โœ… Recommended
  • createLinter: create linter instance
    • lintFiles(files): lint files and return linter messages
    • lintText(text, filePath) lint text with virtual filePath and return linter messages
    • fixFiles(files lint text and return fixer messages
    • fixText(text, filePath) lint text with virtual filePath and return fixer messages
      • fixFiles and fixText does not modify files
  • loadTextlintrc: load .textlintrc config file and return a descriptor object
  • loadLinerFormatter and loadFixerFormatter: load formatter

Lint files and output to console.

import { createLinter, loadTextlintrc, loadLinterFormatter } from "textlint";
// descriptor is a structure object for linter
// It includes rules, plugins, and options
const descriptor = await loadTextlintrc();
const linter = createLinter({
    descriptor
});
const results = await linter.lintFiles(["*.md"]);
// textlint has two types formatter sets for linter and fixer
const formatter = await loadLinterFormatter({ formatterName: "stylish" })
const output = formatter.format(results);
console.log(output);

For more details, see https://textlint.github.io/docs/use-as-modules.html

How to use New CLI

New CLI is opt-in for avoiding Breaking Changes.
It will be default in next major version.

You can try new textlint CLI via textlint-esm command.

- $ textlint "**/*.md"
+ $ textlint-esm "**/*.md"

Or, when TEXTLINT_USE_NEW_CLI=1 is set, textlint use new CLI

$ TEXTLINT_USE_NEW_CLI=1 textlint "**/*.md"

๐Ÿ”ฅ Welcome to feedback on Discussion: https://github.com/textlint/textlint/discussions/968

fix #868
fix https://github.com/textlint/textlint/issues/744 - new CLI fix this
fix https://github.com/textlint/textlint/issues/103 - new CLI fix this
fix #797 - extends descriptor instead of Config
fix #293 - TextlintCore will be removed in the future

textlint - v12.2.4

Published by azu almost 2 years ago

12.2.4 (2022-12-04)

Bug Fixes

  • deps: update babel monorepo to ^7.20.2 (4f0364a)
  • deps: update dependency @babel/cli to ^7.19.3 (c7124c6)
  • textlint: support linting dot files (#947) (8811922) by @kellyselden

This release allow to lint dot file when setting dot file name for extensions.

{
  plugins: {
    '@textlint/text': {
      extensions: ['.lint-todo'],
    },
  }
  rules: {
    'eol-last': true,
  }
};

This version can lint .lint-todo file.

npx textlint .lint-todo
textlint - v12.2.3

Published by azu almost 2 years ago

12.2.3 (2022-11-10)

Bug Fixes

  • deps: update babel monorepo to ^7.19.1 (6a0dbb8)
  • deps: update babel monorepo to ^7.19.3 (e5c80eb)
  • deps: update dependency @babel/core to ^7.19.6 (3ba99ea)
  • deps: update dependency @babel/preset-env to ^7.19.4 (d1049bd)
  • deps: update dependency table to ^6.8.1 (abcb864)
  • deps: update dependency traverse to ^0.6.7 (fc0ea91)
  • linter-formatter: added lodash to dependencies (#934) (e97efb8)
  • types: expose TextlintPluginPreProcessResult/TextlintPluginPostProcessResult type #920 (49d990a)
textlint - v12.2.2

Published by azu about 2 years ago

12.2.2 (2022-09-20)

Bug Fixes

  • markdown-to-ast: add mdast-util-gfm-autolink-literal to explicit deps (#904) (d2888a5)

This will fix pnpm issue #903

Dependencies Updates

  • deps: update babel monorepo to ^7.18.10 (dc0c555)
  • deps: update babel monorepo to ^7.18.6 (d8e30ae)
  • deps: update babel monorepo to ^7.18.6 (0f1b0fb)
  • deps: update babel monorepo to ^7.18.9 (558b4ee)
  • deps: update dependency @babel/core to ^7.18.13 (5c3ac1b)
  • deps: update dependency @babel/core to ^7.18.5 (17ab0d4)
textlint - v12.2.1

Published by azu over 2 years ago

12.2.1 (2022-06-25)

What's Changed

Full Changelog: https://github.com/textlint/textlint/compare/v12.1.0...v12.2.1

textlint - v12.2.0

Published by azu over 2 years ago

12.2.0 (2022-06-25)

Features

Implement Improve error location RFC #835
It will make the error location more details.

This change is for rule developer.

  • Add loc and range property to TextlintMessage(result)
  • Add padding prorperty to RuleError(message, details).
  • Add locator object to rule's context
    • lcoator.at(index), locator.range([startIndex, endIndex]), and locator.loc({ start: { line, column }, end: { line, column }}).
  • textlint-tester's valid and invalid support range property
  • Deprecate index, line and column property on TextlintMessage and report function
    • Preserve current behavior for backward compatible
  • Update filterMessages to use new range property on TextlintMessage
  • Use readonly [number, number] as range in all packages
  • Fix filterMessages bug https://github.com/textlint/textlint/pull/836/commits/c8a670f9b4fd7ce628a940dc4c8faabd5e62d396
  • Refactor tests
  • Update rule.md documentation
    • Add padding and locator object
    • Add peerDependencies note

textlint v12.2.0 will introduce padding and locator.
If your will use it, please add peerDependencies to package.json on your rule package.

  • Edit: No more peerDependencies. It is complex and there are less advantages.
  "peerDependencies": {
    "textlint": ">= 12.2.0"
  },
  "peerDependenciesMeta": {
    "textlint": {
      "optional": true
    }
  }

For textlint rule creator

Before:

const { Syntax, report, RuleError } = context;
// .....
report(node, new RuleError(message, {
  index: 1
}));

After:

const { Syntax, report, RuleError, locator } = context;
// .....
report(node, new RuleError(message, {
  padding: locator.at(1)
}));

If you want to get more correct location, please use locator.range or locator.loc

const { Syntax, report, RuleError, locator } = context;
// .....
report(node, new RuleError(message, {
  padding: locator.range([1, 5]) // The error related to 1 - 5 index.
}));

For more details, see https://textlint.github.io/docs/rule.html#ruleerror

  • #835

Changelogs

Bug Fixes

  • deps: update babel monorepo (89b2395)
  • deps: update babel monorepo (6a3e841)
  • deps: update babel monorepo (a91e594)
  • deps: update babel monorepo (c9f1957)
  • deps: update babel monorepo to ^7.16.5 (#834) (dcbc196)
  • deps: update babel monorepo to ^7.16.7 (e8c10aa)
  • deps: update babel monorepo to ^7.17.10 (1539f0a)
  • deps: Update chalk (#842) (56ba52c)
  • deps: update dependency @babel/core to ^7.17.12 (add5313)
  • deps: update dependency @babel/core to ^7.17.9 (db74d3a)
  • deps: update dependency @babel/core to ^7.18.2 (73c2047)
  • deps: update dependency table to ^6.7.5 (fdfcce6)
  • deps: update dependency table to ^6.8.0 (5e1aa18)
  • deps: Update packages that depend on ansi-regex (#841) (17c03cd)
  • deps: Update string-width (#844) (675bc93)
  • textlint: remove log-symbols (#845) (000d07a)

Features

  • textlint: add padding property and locator (#836) (f94d5f8)
textlint - v12.1.1

Published by azu over 2 years ago

12.1.1 (2022-02-23)

Bug Fixes

  • deps: Update string-width by @massongit
  • deps: Update ansi-regex by @massongit

It will resolve the following audit alert.

ansi-regex 2.1.1 ~ 5.0.0 is vulnerable to Inefficient Regular Expression Complexity: https://github.com/advisories/GHSA-93q8-gq69-wqmw

Thanks to @massongit

Commits

  • deps: update babel monorepo (c9f1957)
  • deps: update babel monorepo to ^7.16.5 (#834) (dcbc196)
  • deps: update babel monorepo to ^7.16.7 (e8c10aa)
  • deps: Update chalk (#842) (56ba52c)
  • deps: update dependency table to ^6.7.5 (fdfcce6)
  • deps: update dependency table to ^6.8.0 (5e1aa18)
  • deps: Update packages that depend on ansi-regex (#841) (17c03cd)
  • deps: Update string-width (#844) (675bc93)
  • textlint: remove log-symbols (#845) (000d07a)
textlint - v12.1.0

Published by azu almost 3 years ago

12.1.0 (2021-12-02)

Features

  • kernel: allow textlint plugin to return Promise on pre/postProcess (#832) (ae89004)

See also: https://textlint.github.io/docs/plugin.html#preprocesstext-filepath-txtparentnode---text-string-ast-txtparentnode-

  • loadFromDir: load js and ts by default (3a12798)

Bug Fixes

  • deps: update babel monorepo to ^7.14.8 (ea3e897)
  • deps: update babel monorepo to ^7.15.0 (8801bc3)
  • deps: update babel monorepo to ^7.15.4 (1e2ae37)
  • deps: update babel monorepo to ^7.15.8 (d85a9b4)
  • deps: update babel monorepo to ^7.16.0 (ab38637)
  • deps: update dependency @babel/cli to ^7.15.4 (2d20865)
  • deps: update dependency @babel/cli to ^7.15.7 (604de3a)
  • deps: update dependency @babel/core to ^7.15.5 (94376ab)
  • deps: update dependency @babel/preset-env to ^7.14.9 (e362719)
  • deps: update dependency @babel/preset-env to ^7.15.6 (352270a)
  • deps: update dependency @babel/preset-env to ^7.16.4 (d065661)
  • deps: update dependency @babel/register to ^7.15.3 (8709aad)
  • deps: update dependency glob to ^7.2.0 (b4af236)
  • deps: update dependency strip-ansi to ^6.0.1 (129af22)
  • deps: update dependency table to ^6.7.3 (ba82895)
  • deps: update dependency unified to ^9.2.2 (1ca5596)
  • TextLintModuleMapper: broaden types for rules mappers (1f33ae3)
textlint - v12.0.2

Published by azu over 3 years ago

12.0.2 (2021-07-09)

The npm dependency [email protected] depends on [email protected] which is vulnerable #801

12.0.2 fixes this dependendies

Bug Fixes

  • deps: update npm dependency table from 3.8.3 to 6.7.1 #801
  • deps: update babel monorepo to ^7.14.5 (360fa5a)
  • deps: update babel monorepo to ^7.14.5 (f51ef8d)
  • deps: update dependency @babel/core to ^7.14.6 (f457b2b)
  • deps: update dependency @babel/preset-env to ^7.14.4 (5e16dbf)
  • deps: update dependency @babel/preset-env to ^7.14.7 (c0054fd)
  • deps: update dependency debug to ^4.3.2 (8cb5498)
textlint - v12.0.1

Published by azu over 3 years ago

12.0.1 (2021-05-24)

This release is addtional fixes for v12.0.0.

textlint-scirpts

Accidentally, 12.0.0 does not include textlint-scirpts's dependencies.
12.0.1 fix to updatetextlint-scripts dependencies.

Bug Fixes

  • textlint-scripts: Update textlint-tester in textlint-scripts #790
  • textlint-scripts: fix example code (90a564f)
textlint - v12.0.0

Published by azu over 3 years ago

Blog: https://textlint.github.io/blog/2021/05/24/textlint-12.html

Summary

For textlint user

textlint improves markdown parsing, so it may found newer errors.

You can upgrade textlint via following commands:

npm install textlint@12
# or
yarn install textlint@12

textlint 12.0.0 requires Node.js 12+.
If you are using Node.js 10.x, please upgrade your Node.js env.

For textlint rule creator

textlint-tester and textlint-scripts are updated.

npm install textlint-scripts@12 --save-dev
# or
yarn install textlint-scripts@12 --dev

textlint-tester@12 use export default instead of modules.exports = .
So, you need to use import TextLintTester from "textlint-tester" instead of const TextLintTester = require("textlint-tester").

- const TextLintTester = require("textlint-tester");
+ import TextLintTester from "textlint-tester";

Breaking Changes

  • All @textlint/* internal modules use same version
    • All modules are released as 12.0.0.
  • Drop Node.js 10.x support #600
    • update engines filels to "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
  • Modules require ES2015 supported environments #777 #774
    • Now, all module target is ES2015
    • It means that textlint does not support IE
    • ๐Ÿ“ Node.js 12+ support ES2018+
  • Built-in markdown parser is updated

Package Versions

Breaking Changes Package Previous version Current version
โœ” textlint 11.9.1 12.0.0
โœ” textlint-tester 5.3.5 12.0.0
โœ” textlint-scripts 3.0.0 12.0.0
ใ€€ @textlint/ast-node-types 4.4.3 12.0.0
ใ€€ @textlint/ast-traverse 2.3.5 12.0.0
ใ€€ @textlint/ast-tester 2.3.5 12.0.0
ใ€€ @textlint/feature-flag 3.3.5 12.0.0
ใ€€ @textlint/fixer-formatter 3.3.5 12.0.0
@textlint/kernel 3.4.5 12.0.0
ใ€€ @textlint/linter-formatter 3.3.5 12.0.0
ใ€€ @textlint/module-interop 1.2.5 12.0.0
โœ” @textlint/textlint-plugin-markdown 5.3.5 12.0.0
ใ€€ @textlint/textlint-plugin-text 4.3.5 12.0.0
โœ” @textlint/types 1.5.5 12.0.0
@textlint/utils 1.2.5 12.0.0

Now, This monorepo includes textlint-scripts package. #779
Move https://github.com/textlint/textlint-scripts to https://github.com/textlint/textlint/tree/master/packages/textlint-scripts

@textlint/markdown-to-ast

It is a markdown parser in textlint.
We have updated to [email protected] #717 and it has many changes related to Markdown AST

You can see the changes at feat(markdown-to-ast): update to remark-parse@9 #767

It also updates trim package that is CVE-2020-7753.

Features

Add FootnoteReference node

The NATO phonetic alphabet[^wiki].

[^wiki]: Read more about it on wikipedia: <http://en.wikipedia.org/wiki/NATO_phonetic_alphabet>.

Previously, It is called LinkReference, textlint@12 treat it as FootnoteReference.
Some rules may report new errors on FootnoteReference.

Known bugs

textlint-tester

  • use export default instead of export = #775 #689

The textlint-tester user should use import instead of require.

- const TextLintTester = require("textlint-tester");
+ import TextLintTester from "textlint-tester";

Or, pick default property.

- const TextLintTester = require("textlint-tester");
+ const TextLintTester = require("textlint-tester").default;

textlint-scripts

  • Update to mocha@8

@textlint/types

  • Fix getSource argument type #770

@textlint/ast-tester

  • Improve error message #783

Discussion: https://github.com/textlint/textlint/discussions/789

textlint -

Published by azu over 3 years ago

textlint user

npm install textlint@beta

textlint rule creator

npm install textlint-scripts@beta

See details in #738

textlint -

Published by azu over 3 years ago

12.0.0 beta release

See details in #738.

Please try it and report bugs

npm install textlint@beta
textlint - @textlint/[email protected]

Published by azu over 3 years ago

3.3.5 (2021-05-08)

Bug Fixes

  • text-to-ast: correct to parse CRLF empty line (#763) (a3288e0)
textlint - @textlint/[email protected]

Published by azu over 3 years ago

3.4.5 (2021-05-08)

Note: Version bump only for package @textlint/kernel

textlint - [email protected]

Published by azu over 3 years ago

5.2.13 (2021-05-08)

Note: Version bump only for package gulp-textlint