@@ -38,16 +38,18 @@ describe('deprecated rules', () => {
3838
3939describe ( 'configurations' , ( ) => {
4040 it ( 'should export a ‘recommended’ configuration' , ( ) => {
41- assert ( plugin . configs . recommended ) ;
42- Object . keys ( plugin . configs . recommended . rules ) . forEach ( ( configName ) => {
43- assert . equal ( configName . indexOf ( 'react/' ) , 0 ) ;
44- const ruleName = configName . slice ( 'react/' . length ) ;
45- assert ( plugin . rules [ ruleName ] ) ;
41+ const configName = 'recommended' ;
42+ assert ( plugin . configs [ configName ] ) ;
43+
44+ Object . keys ( plugin . configs [ configName ] . rules ) . forEach ( ( ruleName ) => {
45+ assert . ok ( ruleName . startsWith ( 'react/' ) ) ;
46+ const subRuleName = ruleName . slice ( 'react/' . length ) ;
47+ assert ( plugin . rules [ subRuleName ] ) ;
4648 } ) ;
4749
4850 ruleFiles . forEach ( ( ruleName ) => {
49- const inRecommendedConfig = ! ! plugin . configs . recommended . rules [ `react/${ ruleName } ` ] ;
50- const isRecommended = plugin . rules [ ruleName ] . meta . docs . recommended ;
51+ const inRecommendedConfig = ! ! plugin . configs [ configName ] . rules [ `react/${ ruleName } ` ] ;
52+ const isRecommended = plugin . rules [ ruleName ] . meta . docs [ configName ] ;
5153 if ( inRecommendedConfig ) {
5254 assert ( isRecommended , `${ ruleName } metadata should mark it as recommended` ) ;
5355 } else {
@@ -57,17 +59,32 @@ describe('configurations', () => {
5759 } ) ;
5860
5961 it ( 'should export an ‘all’ configuration' , ( ) => {
60- assert ( plugin . configs . all ) ;
62+ const configName = 'all' ;
63+ assert ( plugin . configs [ configName ] ) ;
6164
62- Object . keys ( plugin . configs . all . rules ) . forEach ( ( configName ) => {
63- assert . equal ( configName . indexOf ( 'react/' ) , 0 ) ;
64- assert . equal ( plugin . configs . all . rules [ configName ] , 2 ) ;
65+ Object . keys ( plugin . configs [ configName ] . rules ) . forEach ( ( ruleName ) => {
66+ assert . ok ( ruleName . startsWith ( 'react/' ) ) ;
67+ assert . equal ( plugin . configs [ configName ] . rules [ ruleName ] , 2 ) ;
6568 } ) ;
6669
6770 ruleFiles . forEach ( ( ruleName ) => {
6871 const inDeprecatedRules = Boolean ( plugin . deprecatedRules [ ruleName ] ) ;
69- const inAllConfig = Boolean ( plugin . configs . all . rules [ `react/${ ruleName } ` ] ) ;
70- assert ( inDeprecatedRules ^ inAllConfig ) ; // eslint-disable-line no-bitwise
72+ const inConfig = typeof plugin . configs [ configName ] . rules [ `react/${ ruleName } ` ] !== 'undefined' ;
73+ assert ( inDeprecatedRules ^ inConfig ) ; // eslint-disable-line no-bitwise
74+ } ) ;
75+ } ) ;
76+
77+ it ( 'should export a \'jsx-runtime\' configuration' , ( ) => {
78+ const configName = 'jsx-runtime' ;
79+ assert ( plugin . configs [ configName ] ) ;
80+
81+ Object . keys ( plugin . configs [ configName ] . rules ) . forEach ( ( ruleName ) => {
82+ assert . ok ( ruleName . startsWith ( 'react/' ) ) ;
83+ assert . equal ( plugin . configs [ configName ] . rules [ ruleName ] , 0 ) ;
84+
85+ const inDeprecatedRules = Boolean ( plugin . deprecatedRules [ ruleName ] ) ;
86+ const inConfig = typeof plugin . configs [ configName ] . rules [ ruleName ] !== 'undefined' ;
87+ assert ( inDeprecatedRules ^ inConfig ) ; // eslint-disable-line no-bitwise
7188 } ) ;
7289 } ) ;
7390} ) ;
0 commit comments