@@ -66,6 +66,17 @@ tester.run('require-meta-docs-url', rule, {
66
66
pattern : 'path/to/{{name}}.md' ,
67
67
} ] ,
68
68
} ,
69
+ {
70
+ // CJS file extension
71
+ filename : 'test-rule.cjs' ,
72
+ code : `
73
+ module.exports = {
74
+ meta: {docs: {url: "path/to/test-rule.md"}},
75
+ create() {}
76
+ }
77
+ ` ,
78
+ options : [ { pattern : 'path/to/{{name}}.md' } ] ,
79
+ } ,
69
80
{
70
81
// ESM
71
82
filename : 'test-rule' ,
@@ -80,6 +91,18 @@ tester.run('require-meta-docs-url', rule, {
80
91
} ] ,
81
92
parserOptions : { sourceType : 'module' } ,
82
93
} ,
94
+ {
95
+ // TypeScript
96
+ filename : 'rules/test-rule.ts' ,
97
+ code : `
98
+ export default {
99
+ meta: {docs: {url: "path/to/test-rule.md"}},
100
+ create() {}
101
+ }
102
+ ` ,
103
+ options : [ { pattern : 'path/to/{{name}}.md' } ] ,
104
+ parserOptions : { sourceType : 'module' } ,
105
+ } ,
83
106
{
84
107
// `url` in variable.
85
108
filename : 'test-rule' ,
@@ -542,6 +565,30 @@ tester.run('require-meta-docs-url', rule, {
542
565
docs: {
543
566
url: "plugin-name/test.md"
544
567
}
568
+ },
569
+ create() {}
570
+ }
571
+ ` ,
572
+ options : [ {
573
+ pattern : 'plugin-name/{{ name }}.md' ,
574
+ } ] ,
575
+ errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
576
+ } ,
577
+ {
578
+ // CJS file extension
579
+ filename : 'test.cjs' ,
580
+ code : `
581
+ module.exports = {
582
+ meta: {},
583
+ create() {}
584
+ }
585
+ ` ,
586
+ output : `
587
+ module.exports = {
588
+ meta: {
589
+ docs: {
590
+ url: "plugin-name/test.md"
591
+ }
545
592
},
546
593
create() {}
547
594
}
@@ -576,6 +623,29 @@ url: "plugin-name/test.md"
576
623
parserOptions : { sourceType : 'module' } ,
577
624
errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
578
625
} ,
626
+ {
627
+ // TypeScript
628
+ filename : 'test.ts' ,
629
+ code : `
630
+ export default {
631
+ meta: {},
632
+ create() {}
633
+ }
634
+ ` ,
635
+ output : `
636
+ export default {
637
+ meta: {
638
+ docs: {
639
+ url: "plugin-name/test.md"
640
+ }
641
+ },
642
+ create() {}
643
+ }
644
+ ` ,
645
+ options : [ { pattern : 'plugin-name/{{ name }}.md' } ] ,
646
+ parserOptions : { sourceType : 'module' } ,
647
+ errors : [ { messageId : 'missing' , type : 'ObjectExpression' } ] ,
648
+ } ,
579
649
{
580
650
filename : 'test.js' ,
581
651
code : `
0 commit comments