gajus / gajus/babel-plugin-log-deprecated
Add an option to print console.warn only once per function
- Dominant language
- JavaScript
- Stars
- 102
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Some functions produce a lot of noise in the `console.log` as a result of the added warnings. This can be alleviated using a construct such as:
```diff
+let uniqueIdentifierForFooConsoleWarn = false;
+function foo () {
+ if (!uniqueIdentifierForFooConsoleWarn) {
+ uniqueIdentifierForFooConsoleWarn = true;
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();
};
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the plugin entry point that adds console.warn to functions annotated with @deprecated, using the referenced fixture path as the behavior example. Determine where an option can control repeated warnings and check any existing fixture or test coverage. Done means repeated calls from one function warn only once when enabled, while the current behavior remains available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100