File tree 3 files changed +27
-6
lines changed
3 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 7
7
8
8
const getTokenBeforeClosingBracket = require ( '../util/getTokenBeforeClosingBracket' ) ;
9
9
const docsUrl = require ( '../util/docsUrl' ) ;
10
+ const log = require ( '../util/log' ) ;
10
11
11
12
let isWarnedForDeprecation = false ;
12
13
@@ -75,15 +76,13 @@ module.exports = {
75
76
} ,
76
77
77
78
Program : function ( ) {
78
- if ( isWarnedForDeprecation || / \= - ( f | - f o r m a t ) = / . test ( process . argv . join ( '=' ) ) ) {
79
+ if ( isWarnedForDeprecation ) {
79
80
return ;
80
81
}
81
82
82
- /* eslint-disable no-console */
83
- console . log ( 'The react/jsx-space-before-closing rule is deprecated. ' +
84
- 'Please use the react/jsx-tag-spacing rule with the ' +
85
- '"beforeSelfClosing" option instead.' ) ;
86
- /* eslint-enable no-console */
83
+ log ( 'The react/jsx-space-before-closing rule is deprecated. ' +
84
+ 'Please use the react/jsx-tag-spacing rule with the ' +
85
+ '"beforeSelfClosing" option instead.' ) ;
87
86
isWarnedForDeprecation = true ;
88
87
}
89
88
} ;
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /**
4
+ * Logs out a message if there is no format option set.
5
+ * @param {String } message - Message to log.
6
+ */
7
+ function log ( message ) {
8
+ if ( ! / \= - ( f | - f o r m a t ) = / . test ( process . argv . join ( '=' ) ) ) {
9
+ // eslint-disable-next-line no-console
10
+ console . log ( message ) ;
11
+ }
12
+ }
13
+
14
+ module . exports = log ;
Original file line number Diff line number Diff line change 4
4
*/
5
5
'use strict' ;
6
6
7
+ const log = require ( './log' ) ;
8
+
9
+ let warnedForMissingVersion = false ;
10
+
7
11
function getReactVersionFromContext ( context ) {
8
12
let confVer = '999.999.999' ;
9
13
// .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
10
14
if ( context . settings . react && context . settings . react . version ) {
11
15
confVer = context . settings . react . version ;
16
+ } else if ( ! warnedForMissingVersion ) {
17
+ log ( 'Warning: React version not specified in eslint-plugin-react settings. ' +
18
+ 'See https://github.com/yannickcr/eslint-plugin-react#configuration.' ) ;
19
+ warnedForMissingVersion = true ;
12
20
}
13
21
confVer = / ^ [ 0 - 9 ] + \. [ 0 - 9 ] + $ / . test ( confVer ) ? `${ confVer } .0` : confVer ;
14
22
return confVer . split ( '.' ) . map ( part => Number ( part ) ) ;
You can’t perform that action at this time.
0 commit comments