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 = {
6666 hasSuggestions : '💡 *This rule provides [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).*' ,
6767} ;
6868
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+
6973test ( 'Every rule is defined in index file in alphabetical order' , t => {
7074 for ( const file of ruleFiles ) {
7175 const name = path . basename ( file , '.js' ) ;
@@ -195,6 +199,12 @@ test('Every rule has a doc with the appropriate content', t => {
195199 const expectedTitle = `# ${ ruleDescriptionToDocumentTitle ( rule . meta . docs . description ) } ` ;
196200 t . is ( documentLines [ 0 ] , expectedTitle , `${ ruleName } includes the rule description in title` ) ;
197201
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+
198208 // Check if the rule has configuration options.
199209 if (
200210 ( Array . isArray ( rule . meta . schema ) && rule . meta . schema . length > 0 )
You can’t perform that action at this time.
0 commit comments