11import fs from 'node:fs/promises' ;
22import path from 'node:path' ;
33import plugin from '../src' ;
4- import { RxjsXRuleDocs } from '../src/utils' ;
54
65function isSourceFile ( value : string ) : boolean {
76 const ext = path . extname ( value ) ;
@@ -52,7 +51,7 @@ describe('package', () => {
5251 const namespace = 'rxjs-x' ;
5352 const fullRuleName = `${ namespace } /${ ruleName } ` ;
5453
55- const ruleRec = ( rule . meta . docs as RxjsXRuleDocs < unknown [ ] , string > ) ?. recommended ;
54+ const ruleRec = rule . meta . docs ?. recommended ;
5655
5756 if ( ! ruleRec ) {
5857 // Rule is not included in any configuration.
@@ -70,9 +69,12 @@ describe('package', () => {
7069 // Strict configuration always includes all recommended rules.
7170 // Not allowed to specify non-default options since rule only specifies a configuration name.
7271 expect ( plugin . configs . strict . rules ) . toHaveProperty ( fullRuleName , expect . any ( String ) ) ;
72+ } else if ( typeof ruleRec !== 'object' || ! ( 'strict' in ruleRec && Array . isArray ( ruleRec . strict ) ) ) {
73+ // Rule has invalid recommended configuration.
74+ expect . fail ( `Unexpected type for 'rule.meta.docs.recommended': '${ typeof ruleRec } '.` ) ;
7375 } else {
7476 // Rule specifies non-default options for strict.
75- if ( ruleRec . recommended ) {
77+ if ( ' recommended' in ruleRec ) {
7678 expect ( plugin . configs . recommended . rules ) . toHaveProperty ( fullRuleName ) ;
7779 } else {
7880 expect ( plugin . configs . recommended . rules ) . not . toHaveProperty ( fullRuleName ) ;
0 commit comments