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

chore(eslint): no-console error rule #2018

Merged
merged 6 commits into from
Mar 22, 2021

Conversation

skjindal93
Copy link
Contributor

Which problem is this PR solving?

Adds ESLint rule for avoiding any console log statements in the codebase
Fixes #2007 and #1861

@codecov
Copy link

codecov bot commented Mar 14, 2021

Codecov Report

Merging #2018 (03a96af) into main (6025749) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 03a96af differs from pull request most recent head 36eff7b. Consider uploading reports for the commit 36eff7b to get more accurate results

@@           Coverage Diff           @@
##             main    #2018   +/-   ##
=======================================
  Coverage   92.97%   92.98%           
=======================================
  Files         152      152           
  Lines        5925     5926    +1     
  Branches     1245     1245           
=======================================
+ Hits         5509     5510    +1     
  Misses        416      416           
Impacted Files Coverage Δ
...emetry-metrics/src/export/ConsoleMetricExporter.ts 62.50% <ø> (ø)
...elemetry-tracing/src/export/ConsoleSpanExporter.ts 78.57% <ø> (ø)
...ackages/opentelemetry-web/src/WebTracerProvider.ts 100.00% <100.00%> (ø)

@Flarna
Copy link
Member

Flarna commented Mar 15, 2021

I think the console exporters should actually export to console.

@skjindal93
Copy link
Contributor Author

I think the console exporters should actually export to console.

I had the same dilemma. How about we add the following in the constructor of console exporters?

diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);

@Flarna
Copy link
Member

Flarna commented Mar 15, 2021

This will redirect all logs not just the exports.

I would disable the rule for the few places in the exporter where console is used. But maybe wait a little before you adapt the PR as there could be other options :o).

@skjindal93 skjindal93 requested a review from vmarchaud March 20, 2021 06:05
@skjindal93
Copy link
Contributor Author

@vmarchaud @Flarna @legendecas Can you please merge the PR, since I don't have the write access to the repository?

@Flarna
Copy link
Member

Flarna commented Mar 22, 2021

@skjindal93 Two maintainer approvals are required in this repo but there is only one till now.

@obecny
Copy link
Member

obecny commented Mar 22, 2021

@skjindal93 did you sign the CLA ?

@dyladan
Copy link
Member

dyladan commented Mar 22, 2021

Close and reopen to retrigger CLA

@dyladan dyladan closed this Mar 22, 2021
@dyladan dyladan reopened this Mar 22, 2021
@dyladan dyladan merged commit f045eef into open-telemetry:main Mar 22, 2021
@skjindal93 skjindal93 deleted the add-no-console-error branch March 22, 2021 13:17
rauno56 pushed a commit to rauno56/opentelemetry-js that referenced this pull request Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add "no-console": "error" to eslint config
6 participants