Title: Ability to suppress warnings by type (or just experimental warnings) · Issue #30810 · nodejs/node · GitHub
Open Graph Title: Ability to suppress warnings by type (or just experimental warnings) · Issue #30810 · nodejs/node
X Title: Ability to suppress warnings by type (or just experimental warnings) · Issue #30810 · nodejs/node
Description: Is your feature request related to a problem? Please describe. I'd like to suppress experimental warnings while still seeing any other errors. In particular when I am using native ES modules I do not want the experimental warning printed...
Open Graph Description: Is your feature request related to a problem? Please describe. I'd like to suppress experimental warnings while still seeing any other errors. In particular when I am using native ES modules I do n...
X Description: Is your feature request related to a problem? Please describe. I'd like to suppress experimental warnings while still seeing any other errors. In particular when I am using native ES modules I ...
Opengraph URL: https://github.com/nodejs/node/issues/30810
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Ability to suppress warnings by type (or just experimental warnings)","articleBody":"**Is your feature request related to a problem? Please describe.**\r\nI'd like to suppress experimental warnings while still seeing any other errors. In particular when I am using native ES modules I do not want the experimental warning printed for every process, but I do want unrelated warnings to still be printed.\r\n\r\n**Describe the solution you'd like**\r\nAllow `--no-warnings` to optionally accept an option string such as `--no-warnings=type1,type2`. Using `--no-warnings` without any option would continue to disable all warnings. This would allow `--no-warnings=ExperimentalWarning` to suppress ExperimentalWarning only.\r\n\r\n**Describe alternatives you've considered**\r\n`--no-experimental-warnings` or a similarly named new flag could be created. This has the drawback that `node --no-experimental-warnings` on node.js 13.3.0 exit with an error where `--no-warnings=ExperimentalWarnings` will not currently error (it causes all warnings to be ignored).\r\n\r\nIn my own repo which uses ES modules I've created `suppress-experimental.cjs` which gets loaded with `NODE_OPTIONS='--require=./suppress-experimental.cjs'`:\r\n```js\r\n'use strict';\r\n\r\nconst {emitWarning} = process;\r\n\r\nprocess.emitWarning = (warning, ...args) =\u003e {\r\n\tif (args[0] === 'ExperimentalWarning') {\r\n\t\treturn;\r\n\t}\r\n\r\n\tif (args[0] \u0026\u0026 typeof args[0] === 'object' \u0026\u0026 args[0].type === 'ExperimentalWarning') {\r\n\t\treturn;\r\n\t}\r\n\r\n\treturn emitWarning(warning, ...args);\r\n};\r\n```\r\n\r\nObviously patching node.js internals like this is undesirable but it accomplishes my goal.","author":{"url":"https://github.com/coreyfarrell","@type":"Person","name":"coreyfarrell"},"datePublished":"2019-12-05T18:00:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":36},"url":"https://github.com/30810/node/issues/30810"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d4767988-dc40-6669-cc7a-daafa0678b51 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CBF8:2635C7:294F12:36F27B:6969C133 |
| html-safe-nonce | b2138ad89337e402eac7501939274f1f5b93bfb9c645b5317ebc750ab3d68cd9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkY4OjI2MzVDNzoyOTRGMTI6MzZGMjdCOjY5NjlDMTMzIiwidmlzaXRvcl9pZCI6IjIyMzUwOTIzMDI0NzgwMzMyMDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 60f8461680cc4537582f192910b54a1b5d8e02f7e70ca19c90a9d94247c1af31 |
| hovercard-subject-tag | issue:533506790 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/30810/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f13741473d02385149e33566ea9c55116c6c48f49ae5d0305e183f39f22c895/nodejs/node/issues/30810 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f13741473d02385149e33566ea9c55116c6c48f49ae5d0305e183f39f22c895/nodejs/node/issues/30810 |
| og:image:alt | Is your feature request related to a problem? Please describe. I'd like to suppress experimental warnings while still seeing any other errors. In particular when I am using native ES modules I do n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | coreyfarrell |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width