@@ -16,15 +16,20 @@ describe("wrapReportHandler", function () {
1616 "rule-key" : function ( context ) {
1717 const { RuleError } = context ;
1818 return wrapReportHandler ( {
19- ignoreNodeTypes : Object . keys ( ASTNodeTypes )
19+ ignoreNodeTypes : Object . keys ( ASTNodeTypes ) . concat ( "my-type" )
2020 } , context , report => {
2121 return {
2222 ...( Object . keys ( ASTNodeTypes ) . reduce ( ( object , key ) => {
2323 object [ key ] = ( node : AnyTxtNode ) => {
2424 report ( node , new RuleError ( node . type ) ) ;
2525 } ;
2626 return object ;
27- } , { } as any ) )
27+ } , { } as any ) ) ,
28+ ...{
29+ "my-type" ( node ) {
30+ report ( node , new RuleError ( node . type ) ) ;
31+ }
32+ }
2833 } ;
2934 } ) ;
3035 } as TextlintRuleReporter
119124 } ,
120125 ] ;
121126 textlint . setupRules ( {
122- "rule-key" : function ( context : any ) {
127+ "rule-key" : function ( context ) {
123128 const { Syntax, getSource } = context ;
124129 return wrapReportHandler ( {
125130 ignoreNodeTypes : [ context . Syntax . Code ]
136141 }
137142 }
138143 } ) ;
139- }
144+ } as TextlintRuleReporter
140145 } ) ;
141146 const text = "123`456`789" ;
142147 return textlint . lintMarkdown ( text ) . then ( ( result ) => {
154159 const text = "> Line 1\n"
155160 + "> This is `code`." ;
156161 textlint . setupRules ( {
157- "rule-key" : function ( context : any ) {
162+ "rule-key" : function ( context ) {
158163 const { Syntax, RuleError } = context ;
159164 return wrapReportHandler ( {
160165 ignoreNodeTypes : [ context . Syntax . Code ]
175180 }
176181 }
177182 } ) ;
178- }
183+ } as TextlintRuleReporter
179184 } ) ;
180185 return textlint . lintMarkdown ( text ) . then ( ( result ) => {
181186 const messages = result . messages ;
0 commit comments