File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
src/converters/lintConfigs/rules Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,7 @@ import { convertPreferTemplate } from "./ruleConverters/prefer-template";
244
244
import { convertPromiseFunctionAsync } from "./ruleConverters/promise-function-async" ;
245
245
import { convertQuotemark } from "./ruleConverters/quotemark" ;
246
246
import { convertRadix } from "./ruleConverters/radix" ;
247
+ import { convertReactA11yAnchors } from "./ruleConverters/react-a11y-anchors" ;
247
248
import { convertRestrictPlusOperands } from "./ruleConverters/restrict-plus-operands" ;
248
249
import { convertSemicolon } from "./ruleConverters/semicolon" ;
249
250
import { convertSpaceBeforeFunctionParen } from "./ruleConverters/space-before-function-paren" ;
@@ -469,6 +470,7 @@ export const ruleConverters = new Map([
469
470
[ "quotemark" , convertQuotemark ] ,
470
471
[ "radix" , convertRadix ] ,
471
472
[ "relative-url-prefix" , convertRelativeUrlPrefix ] ,
473
+ [ "react-a11y-anchors" , convertReactA11yAnchors ] ,
472
474
[ "restrict-plus-operands" , convertRestrictPlusOperands ] ,
473
475
[ "rxjs-no-async-subscribe" , convertNoAsyncSubscribe ] ,
474
476
[ "rxjs-no-create" , convertNoCreate ] ,
Original file line number Diff line number Diff line change
1
+ import { RuleConverter } from "../ruleConverter" ;
2
+
3
+ export const convertReactA11yAnchors : RuleConverter = ( tslintRule ) => {
4
+ return {
5
+ ...( tslintRule . ruleArguments . length > 0 && ( {
6
+ notices : Object . keys ( tslintRule . ruleArguments [ 0 ] as Record < string , unknown > ) . map ( key => `jsx-a11y/anchor-is-valid does not support the '${ key } ' option.` )
7
+ } ) ) ,
8
+ plugins : [ "jsx-a11y" ] ,
9
+ rules : [
10
+ {
11
+ ruleName : "jsx-a11y/anchor-is-valid" ,
12
+ } ,
13
+ ] ,
14
+ } ;
15
+ } ;
Original file line number Diff line number Diff line change
1
+ import { convertReactA11yAnchors } from "../react-a11y-anchors" ;
2
+
3
+ describe ( convertReactA11yAnchors , ( ) => {
4
+ test ( "conversion without arguments" , ( ) => {
5
+ const result = convertReactA11yAnchors ( {
6
+ ruleArguments : [ ] ,
7
+ } ) ;
8
+
9
+ expect ( result ) . toEqual ( {
10
+ plugins : [ "jsx-a11y" ] ,
11
+ rules : [
12
+ {
13
+ ruleName : "jsx-a11y/anchor-is-valid" ,
14
+ } ,
15
+ ] ,
16
+ } ) ;
17
+ } ) ;
18
+
19
+ test ( "conversion with arguments" , ( ) => {
20
+ const result = convertReactA11yAnchors ( {
21
+ ruleArguments : [ {
22
+ 'ignore-case' : true ,
23
+ 'ignore-whitespace' : 'trim'
24
+ } ] ,
25
+ } ) ;
26
+
27
+ expect ( result ) . toEqual ( {
28
+ notices : [
29
+ `jsx-a11y/anchor-is-valid does not support the 'ignore-case' option.` ,
30
+ `jsx-a11y/anchor-is-valid does not support the 'ignore-whitespace' option.`
31
+ ] ,
32
+ plugins : [ "jsx-a11y" ] ,
33
+ rules : [
34
+ {
35
+ ruleName : "jsx-a11y/anchor-is-valid" ,
36
+ } ,
37
+ ] ,
38
+ } ) ;
39
+ } ) ;
40
+ } ) ;
You can’t perform that action at this time.
0 commit comments