Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable no-console eslint rule for project #4802

Merged
merged 4 commits into from
Mar 10, 2020

Conversation

jsnellbaker
Copy link
Collaborator

@jsnellbaker jsnellbaker commented Jan 30, 2020

Type of change

  • Code style update (formatting, local variables)
  • Other

Description of change

There have been a number of PRs in the past where the unit tests included some rogue console.log statements and they were accidentally missed by the reviewers.

While not a big deal, it does end up polluting the console messages when we run the tests (especially the browserstack tests, since they get displayed for each browser), and it becomes somewhat tedious to track them down later and create another PR just to remove them.

I made this PR to enable the no-console rule for the eslint rules in our test directory to hopefully help us better catch these instances during the review process.

I also updated the various files in the test directory using console.log; either removing them or disabling the rule.

Update
Per feedback, I have extended this lint logic to the project rather than just the tests directory.

@@ -81,7 +81,7 @@ describe('onetag', function () {
}
});
} catch (e) {
console.log('Error while parsing');
console.log('onetagBidAdapter tests: Error while parsing'); // eslint-disable-line
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason to keep these these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought at first they would be good to keep for the adapter's tests, but in retrospect they're not too helpful. I pushed an update to remove them.

Copy link
Collaborator

@snapwich snapwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this idea, but I feel like this should apply to the whole codebase, not just the tests. It's almost more important that console.logs don't end up in src and modules files than in the tests.

Do you think it would be doable to enable this for the project and then add exceptions for the usages in utils.js?

@jsnellbaker
Copy link
Collaborator Author

Hi @snapwich

Expanding the scope does make sense, I'll try to make the necessary updates soon.

@jsnellbaker
Copy link
Collaborator Author

I pushed in the requested updates. Please take another look when you get the chance.

Thanks!

@jsnellbaker jsnellbaker changed the title enable no-console eslint rule for tests directory enable no-console eslint rule for project Feb 25, 2020
@jsnellbaker
Copy link
Collaborator Author

Hey @snapwich @mkendall07 , can you please take another look and approve (if it looks good now)? Thanks!

@snapwich snapwich self-requested a review March 3, 2020 22:33
Copy link
Collaborator

@snapwich snapwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jsnellbaker jsnellbaker requested a review from harpere March 6, 2020 19:03
@jsnellbaker jsnellbaker added needs 2nd review Core module updates require two approvals from the core team and removed needs review labels Mar 6, 2020
Copy link
Collaborator

@harpere harpere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jsnellbaker jsnellbaker merged commit 60f66c9 into master Mar 10, 2020
redaguermas added a commit to redaguermas/Prebid.js that referenced this pull request Mar 13, 2020
* 'master' of https://github.com/prebid/Prebid.js: (49 commits)
  Submitting Clicktripz bid adapter (prebid#4929)
  add UNICORN bid adapter (prebid#4917)
  3.12.0-pre
  3.11.0 release
  Eids liveintent ext fix (prebid#4944)
  add mediaforce bid adapter (prebid#4933)
  update logic in adpod module for playersize (prebid#4953)
  Module - Size Mapping V2 (prebid#4690)
  Lifestreet adapter 3.0 (prebid#4927)
  IX Adapter - Increase banner TTL to 300s (prebid#4957)
  assert string returned not that we break things (prebid#4962)
  added option to url parser to ignore decoding entire url (prebid#4938)
  adding user-id support in medianet adapter (prebid#4925)
  removing the log (prebid#4960)
  add import extensions (prebid#4959)
  Add 7xbid adapter to compatible with prebid 3.0 (prebid#4908)
  Fix failing code-coverage command (prebid#4892)
  enable no-console eslint rule for project (prebid#4802)
  update audigent tests to fix larger test suite issue (prebid#4952)
  use bidId or bidIds in the payload (prebid#4903)
  ...
redaguermas added a commit to redaguermas/Prebid.js that referenced this pull request Mar 13, 2020
* master: (49 commits)
  Submitting Clicktripz bid adapter (prebid#4929)
  add UNICORN bid adapter (prebid#4917)
  3.12.0-pre
  3.11.0 release
  Eids liveintent ext fix (prebid#4944)
  add mediaforce bid adapter (prebid#4933)
  update logic in adpod module for playersize (prebid#4953)
  Module - Size Mapping V2 (prebid#4690)
  Lifestreet adapter 3.0 (prebid#4927)
  IX Adapter - Increase banner TTL to 300s (prebid#4957)
  assert string returned not that we break things (prebid#4962)
  added option to url parser to ignore decoding entire url (prebid#4938)
  adding user-id support in medianet adapter (prebid#4925)
  removing the log (prebid#4960)
  add import extensions (prebid#4959)
  Add 7xbid adapter to compatible with prebid 3.0 (prebid#4908)
  Fix failing code-coverage command (prebid#4892)
  enable no-console eslint rule for project (prebid#4802)
  update audigent tests to fix larger test suite issue (prebid#4952)
  use bidId or bidIds in the payload (prebid#4903)
  ...
bmwcmw pushed a commit to criteo-forks/Prebid.js that referenced this pull request Mar 31, 2020
* add no-console eslint rule for tests directory

* remove console logs from onetag tests

* update scope of rule to include src files
rjvelicaria pushed a commit to openx/Prebid.js that referenced this pull request Apr 9, 2020
* add no-console eslint rule for tests directory

* remove console logs from onetag tests

* update scope of rule to include src files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs 2nd review Core module updates require two approvals from the core team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants