gajus / gajus/babel-plugin-log-deprecated

Add an option to wrap console.warn in process.env.NODE_ENV governed conditional

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
102
Forks
8
PR merge metrics
No merged PRs in 30d

Description

```js
function foo () {
if (process.env.NODE_ENV === 'development') {
console.warn("Deprecated: Function \"foo\" is deprecated in /fixtures/preset-options/adds-console-warn-to-function-declaration/actual.js on line 4", {
functionName: "foo",
message: "Deprecated in favour of quux.",
packageName: "bar",
packageVersion: "1.0.0",
scriptColumn: 0,
scriptLine: 4,
scriptPath: "fixtures/preset-options/adds-console-warn-to-function-declaration/actual.js"
});
}

bar();
};

```

The use case is to allow this being used by libraries, where dependents on the library might want to disable the warnings in production.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with fixtures/preset-options/adds-console-warn-to-function-declaration/actual.js and trace how the plugin produces the shown console.warn output. Identify the option-handling and fixture path involved, then verify that the option controls the NODE_ENV conditional while the existing warning behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.