babel-plugin-log-deprecated
babel-plugin-log-deprecated copied to clipboard
Add an option to print console.warn only once per function
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:
+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();
};