File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ const MESSAGES = {
66
66
hasSuggestions : '💡 *This rule provides [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).*' ,
67
67
} ;
68
68
69
+ const RULES_WITHOUT_PASS_FAIL_SECTIONS = new Set ( [
70
+ 'filename-case' , // Doesn't show code samples since it's just focused on filenames.
71
+ ] ) ;
72
+
69
73
test ( 'Every rule is defined in index file in alphabetical order' , t => {
70
74
for ( const file of ruleFiles ) {
71
75
const name = path . basename ( file , '.js' ) ;
@@ -195,6 +199,12 @@ test('Every rule has a doc with the appropriate content', t => {
195
199
const expectedTitle = `# ${ ruleDescriptionToDocumentTitle ( rule . meta . docs . description ) } ` ;
196
200
t . is ( documentLines [ 0 ] , expectedTitle , `${ ruleName } includes the rule description in title` ) ;
197
201
202
+ // Check for examples.
203
+ if ( ! RULES_WITHOUT_PASS_FAIL_SECTIONS . has ( ruleName ) ) {
204
+ t . true ( documentContents . includes ( '## Pass' ) , `${ ruleName } includes '## Pass' examples section` ) ;
205
+ t . true ( documentContents . includes ( '## Fail' ) , `${ ruleName } includes '## Fail' examples section` ) ;
206
+ }
207
+
198
208
// Check if the rule has configuration options.
199
209
if (
200
210
( Array . isArray ( rule . meta . schema ) && rule . meta . schema . length > 0 )
You can’t perform that action at this time.
0 commit comments