Skip to content

Commit

Permalink
Update 'print-warnings' script to include 'lowPriorityWarning' output
Browse files Browse the repository at this point in the history
**what is the change?:**
We print the logs from 'lowPriorityWarning' as well as 'warning' from the 'print-warnings' script.

NOTE: This PR is branching off of facebook#9754

**why make this change?:**
We want to use the same process of white/blacklisting warnings with 'lowPriorityWarning' that we do with 'warning'.

**test plan:**
This is not super easy to test unless we are doing a sync with FB afaik. I plan on running a sync in the next few days, or next week at latest, for the sake of not landing big things on a Friday. That will be the actual test of this.

**issue:**
facebook#9398
  • Loading branch information
flarnie committed May 24, 2017
1 parent 466bf97 commit 9e54672
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion scripts/print-warnings/print-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ function transform(file, enc, cb) {
traverse(ast, {
CallExpression: {
exit: function(astPath) {
if (astPath.get('callee').isIdentifier({name: 'warning'})) {
const callee = astPath.get('callee');
if (
callee.isIdentifier({name: 'warning'}) ||
callee.isIdentifier({name: 'lowPriorityWarning'})
) {
const node = astPath.node;

// warning messages can be concatenated (`+`) at runtime, so here's
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/lowPriorityWarning.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
var lowPriorityWarning = function() {};

if (__DEV__) {
const printWarning = function (format, ...args) {
const printWarning = function(format, ...args) {
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, () => args[argIndex++]);
if (typeof console !== 'undefined') {
Expand Down

0 comments on commit 9e54672

Please sign in to comment.