Skip to content

Releases: textlint/textlint-rule-helper

2.1.0

03 Jan 05:57
@azu azu

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

Choose a tag to compare

Bug Fixes

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

2.0.0

16 Jun 03:41
@azu azu

Choose a tag to compare

Featues from 1.x

  • add IgnoreNodeManager class that it is useful for linting Paragraph node.

Breaking Change

  • Fix typo: IgnoreNodeManger -> IgnoreNodeManager #5

You can upgrade and fix require like following

-var IgnoreNodeManger = require("textlint-rule-helper").IgnoreNodeManger;
+var IgnoreNodeManager = require("textlint-rule-helper").IgnoreNodeManager;

1.2.0

15 Jun 01:37
@azu azu

Choose a tag to compare

Features

  • src: add IgnoreNodeManager (5159710)