From e8ef06783ad85491bd833c6bfc54c6395250f6db Mon Sep 17 00:00:00 2001 From: Kevin Old Date: Sun, 25 Jan 2015 23:38:38 -0600 Subject: [PATCH] Update warning calls to use %s #2870 --- src/browser/ui/dom/CSSPropertyOperations.js | 10 ++++++---- src/browser/ui/dom/DOMPropertyOperations.js | 4 +++- src/classic/element/ReactElement.js | 5 +++-- src/classic/element/ReactElementValidator.js | 9 ++++++--- src/utils/deprecated.js | 8 ++++++-- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/browser/ui/dom/CSSPropertyOperations.js b/src/browser/ui/dom/CSSPropertyOperations.js index 83b42e0596..7aab26d4cb 100644 --- a/src/browser/ui/dom/CSSPropertyOperations.js +++ b/src/browser/ui/dom/CSSPropertyOperations.js @@ -51,8 +51,9 @@ if (__DEV__) { warnedStyleNames[name] = true; warning( false, - 'Unsupported style property ' + name + '. Did you mean ' + - camelizeStyleName(name) + '?' + 'Unsupported style property %s. Did you mean %s?', + name, + camelizeStyleName(name) ); }; @@ -64,8 +65,9 @@ if (__DEV__) { warnedStyleNames[name] = true; warning( false, - 'Unsupported vendor-prefixed style property ' + name + '. Did you mean ' + - name.charAt(0).toUpperCase() + name.slice(1) + '?' + 'Unsupported vendor-prefixed style property %s. Did you mean %s?', + name, + name.charAt(0).toUpperCase() + name.slice(1) ); }; diff --git a/src/browser/ui/dom/DOMPropertyOperations.js b/src/browser/ui/dom/DOMPropertyOperations.js index 364c70644b..1c02577465 100644 --- a/src/browser/ui/dom/DOMPropertyOperations.js +++ b/src/browser/ui/dom/DOMPropertyOperations.js @@ -61,7 +61,9 @@ if (__DEV__) { // logging too much when using transferPropsTo. warning( standardName == null, - 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?' + 'Unknown DOM property %s. Did you mean %s?', + name, + standardName ); }; diff --git a/src/classic/element/ReactElement.js b/src/classic/element/ReactElement.js index 32975f4198..c7828685bf 100644 --- a/src/classic/element/ReactElement.js +++ b/src/classic/element/ReactElement.js @@ -45,8 +45,9 @@ function defineWarningProperty(object, key) { set: function(value) { warning( false, - 'Don\'t set the ' + key + ' property of the React element. Instead, ' + - 'specify the correct value when initially creating the element.' + 'Don\'t set the %s property of the React element. Instead, ' + + 'specify the correct value when initially creating the element.', + key ); this._store[key] = value; } diff --git a/src/classic/element/ReactElementValidator.js b/src/classic/element/ReactElementValidator.js index 06c6739cf7..f264318fa1 100644 --- a/src/classic/element/ReactElementValidator.js +++ b/src/classic/element/ReactElementValidator.js @@ -306,9 +306,12 @@ function warnForPropsMutation(propName, element) { warning( false, - 'Don\'t set .props.' + propName + ' of the React component' + - elementInfo + '. Instead, specify the correct value when ' + - 'initially creating the element.' + ownerInfo + 'Don\'t set .props.%s of the React component%s. ' + + 'Instead, specify the correct value when ' + + 'initially creating the element.%s', + propName, + elementInfo, + ownerInfo ); } diff --git a/src/utils/deprecated.js b/src/utils/deprecated.js index f976789f36..60f32a572a 100644 --- a/src/utils/deprecated.js +++ b/src/utils/deprecated.js @@ -31,8 +31,12 @@ function deprecated(namespace, oldName, newName, ctx, fn) { var newFn = function() { warning( warned, - `${namespace}.${oldName} will be deprecated in a future version. ` + - `Use ${namespace}.${newName} instead.` + '%s.%s will be deprecated in a future version. ' + + 'Use %s.%s instead.', + namespace, + oldName, + namespace, + newName ); warned = true; return fn.apply(ctx, arguments);