@@ -38,16 +38,18 @@ describe('deprecated rules', () => {
38
38
39
39
describe ( 'configurations' , ( ) => {
40
40
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 ] ) ;
46
48
} ) ;
47
49
48
50
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 ] ;
51
53
if ( inRecommendedConfig ) {
52
54
assert ( isRecommended , `${ ruleName } metadata should mark it as recommended` ) ;
53
55
} else {
@@ -57,17 +59,32 @@ describe('configurations', () => {
57
59
} ) ;
58
60
59
61
it ( 'should export an ‘all’ configuration' , ( ) => {
60
- assert ( plugin . configs . all ) ;
62
+ const configName = 'all' ;
63
+ assert ( plugin . configs [ configName ] ) ;
61
64
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 ) ;
65
68
} ) ;
66
69
67
70
ruleFiles . forEach ( ( ruleName ) => {
68
71
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
71
88
} ) ;
72
89
} ) ;
73
90
} ) ;
0 commit comments