File tree Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Expand file tree Collapse file tree 3 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 77
88const getTokenBeforeClosingBracket = require ( '../util/getTokenBeforeClosingBracket' ) ;
99const docsUrl = require ( '../util/docsUrl' ) ;
10+ const log = require ( '../util/log' ) ;
1011
1112let isWarnedForDeprecation = false ;
1213
@@ -75,15 +76,13 @@ module.exports = {
7576 } ,
7677
7778 Program : function ( ) {
78- if ( isWarnedForDeprecation || / \= - ( f | - f o r m a t ) = / . test ( process . argv . join ( '=' ) ) ) {
79+ if ( isWarnedForDeprecation ) {
7980 return ;
8081 }
8182
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.' ) ;
8786 isWarnedForDeprecation = true ;
8887 }
8988 } ;
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 44 */
55'use strict' ;
66
7+ const log = require ( './log' ) ;
8+
9+ let warnedForMissingVersion = false ;
10+
711function getReactVersionFromContext ( context ) {
812 let confVer = '999.999.999' ;
913 // .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
1014 if ( context . settings . react && context . settings . react . version ) {
1115 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 ;
1220 }
1321 confVer = / ^ [ 0 - 9 ] + \. [ 0 - 9 ] + $ / . test ( confVer ) ? `${ confVer } .0` : confVer ;
1422 return confVer . split ( '.' ) . map ( part => Number ( part ) ) ;
You can’t perform that action at this time.
0 commit comments