@@ -23,10 +23,11 @@ const deprecatedRules = Object.entries(eslintPluginUnicorn.rules)
23
23
. filter ( ( [ , { meta : { deprecated} } ] ) => deprecated )
24
24
. map ( ( [ ruleId ] ) => ruleId ) ;
25
25
26
- const RULES_WITHOUT_PASS_FAIL_SECTIONS = new Set ( [
26
+ const RULES_WITHOUT_EXAMPLES_SECTION = new Set ( [
27
27
// Doesn't show code samples since it's just focused on filenames.
28
28
'filename-case' ,
29
- // Intended to not use `pass`/`fail` section in this rule.
29
+
30
+ // Intended to not use `Examples` section in this rule.
30
31
'prefer-modern-math-apis' ,
31
32
'prefer-math-min-max' ,
32
33
'consistent-existence-index-check' ,
@@ -133,14 +134,18 @@ test('Every rule file has the appropriate contents', t => {
133
134
test ( 'Every rule has a doc with the appropriate content' , t => {
134
135
for ( const ruleFile of ruleFiles ) {
135
136
const ruleName = path . basename ( ruleFile , '.js' ) ;
136
- const documentPath = path . join ( 'docs/rules' , `${ ruleName } .md` ) ;
137
- const documentContents = fs . readFileSync ( documentPath , 'utf8' ) ;
138
137
139
- // Check for examples.
140
- if ( ! RULES_WITHOUT_PASS_FAIL_SECTIONS . has ( ruleName ) ) {
141
- t . true ( documentContents . includes ( '## Pass' ) , `${ ruleName } includes '## Pass' examples section` ) ;
142
- t . true ( documentContents . includes ( '## Fail' ) , `${ ruleName } includes '## Fail' examples section` ) ;
138
+ if ( RULES_WITHOUT_EXAMPLES_SECTION . has ( ruleName ) ) {
139
+ continue ;
143
140
}
141
+
142
+ /// const documentPath = path.join('docs/rules', `${ruleName}.md`);
143
+ /// const documentContents = fs.readFileSync(documentPath, 'utf8');
144
+
145
+ // TODO: Disabled until https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2530 is done.
146
+ // Check for examples.
147
+ // t.true(documentContents.includes('## Examples'), `${ruleName} includes '## Examples' examples section`);
148
+ t . pass ( ) ;
144
149
}
145
150
} ) ;
146
151
0 commit comments