Skip to content

Releases: textlint/textlint-rule-helper

v2.3.1

25 Nov 05:20
@azu azu
f790eda
Compare
Choose a tag to compare

What's Changed

Bug Fixes

  • fix: fix isIgnored work by @azu in #23

Full Changelog: v2.3.0...v2.3.1

v2.3.0

28 Jan 04:48
@azu azu
b02853d
Compare
Choose a tag to compare

Bug Fixes

v2.2.4

08 Jan 11:34
@azu azu
85c7888
Compare
Choose a tag to compare

What's Changed

Refactoring

  • refactor: update structured-source and use @textlint/kernel by @azu in #20

Full Changelog: v2.2.3...v2.2.4

v2.2.3

04 Nov 09:51
@azu azu
c695466
Compare
Choose a tag to compare

Bug Fixes

If you met Cannot find module '@textlint/ast-node-types' error, please upgrade textlint-rule-helper. #18

npm update textlint-rule-helper

or

yarn upgrade textlint-rule-helper

v2.2.2

29 Oct 21:21
@azu azu
fd21147
Compare
Choose a tag to compare

Bug Fixes

  • deps: add peerDependenciesMeta optional (ecc4111)

v2.2.1

27 Dec 09:25
@azu azu
Compare
Choose a tag to compare

Bug Fixes

  • move textlint type packages to peerDependencies (bac5be7)

v2.2.0

16 May 06:27
@azu azu
Compare
Choose a tag to compare

Features

  • helper: add isPlainStrNode(node): boolean #17 #16

isPlainStrNode() return true if the node is Str node and fill following conditions:

  • the node is Str node
  • the node is under the Paragraph node
  • the node is not under the BlockQuote

This function is useful for the common use case.
If you want to lint Str node, but you do not want to lint styled node, this function is useful.
The styled node is Link, Strong, BlockQuote, Header, and it may be written by other people.
For example, you have added a link to your document, the link's title is written by other people.

Opposite of it, The plain Str node is just under the Paragraph node, and it was written by you.

Examples

Return true

str str str
- list text

Return false

# Header
![alt text](https://example.com)
[link title](https://example.com)
> BlockQuote text
**Strong text**
[linkReference][]
[^footnote text]

For more details, see https://github.com/textlint/textlint-rule-helper#rulehelperisplainstrnodenode-boolean

2.1.1

03 Jan 06:22
@azu azu
Compare
Choose a tag to compare

Bug Fixes

  • wrap: fix arguments order (f1219db)

2.1.0

03 Jan 05:57
@azu azu
Compare
Choose a tag to compare

Bug Fixes

Features

  • wrap: add wrapReportHandler(context, options, handler): TextlintRuleReportHandler function (c8fb78b)

wrapReportHandler is high-level and declarative API for ignore nodes.
We have designed that wrapReportHandler is easy to use.

If you want to ignore some Node's type, we recommended to use wrapReportHandler.

import { wrapReportHandler } from "textlint-rule-helper";
const reporter = function (context) {
   const { Syntax, getSource } = context;
   return wrapReportHandler(context, {
       ignoreNodeTypes: [Syntax.BlockQuote, Syntax.Code]
   },report => { // <= wrap version of context.report
       // handler should return a rule handler object
       return {
           [Syntax.Paragraph](node) {
               const text = getSource(node);
               const index = text.search("code");
               /*
                * Following text is matched, but it will not reported.
                * ----
                * This is `code`.
                * > code
                * ----
                */
                if(index === -1){
                    return;
                }
                report(node, new context.RuleError(item.name, {
                   index
                }));
           }
       }
   });
};
module.exports = reporter;

2.0.1

20 Oct 14:59
@azu azu
Compare
Choose a tag to compare

Bug Fixes

  • ignoreNodeManger: igIgnoredIndex did ignored over range (c73703a)
  • README: Fix syntax error in the example, prettify (#6) (5e7dc95)