New Rule Request: Enforce strings in front of logged variables (string-with-logs)
See original GitHub issuePlease describe what the rule should do: The rule would force us to provide a string in front of a logged variable.
What category of rule is this? (place an “X” next to just one item)
[ ] Enforces code style [ ] Warns about a potential error [ ] Suggests an alternate way of doing something [x] Other (suggests good practice)
Provide 2-3 code examples that this rule will warn about:
//breaks rule
console.log(aVariable)
//consistent with rule
console.log("a variable", aVariable)
Why should this rule be included in ESLint (instead of a plugin)? This rule is not library specific and it is relevant for all javascript development. Logs are only useful when we know what’s being logged and where it’s coming from. Languages like Elm enforce this behavior out-of-the-box as their console.log equivalent requires a string as the first argument.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Interpreting Log Transformations in a Linear Model
Rules for interpretation. OK, you ran a regression/fit a linear model and some of your variables are log-transformed.
Read more >Why Logging doesn't use string interpolation - Stack Overflow
In this case an interpolated string does lose important information. The call. Log.Information("Logged in {UserId}", loggedInUserId);. Won't ...
Read more >Interpreting Regression Coefficients for Log-Transformed ...
This newsletter focuses on how to obtain estimated parameters of interest and how to interpret the coefficients in a regression model involving log-transformed ......
Read more >String Literal Types in TypeScript - Marius Schulz
TypeScript 1.8 introduced string literal types, which allow for describing a set of possible string values for a given variable.
Read more >Log Transformation: Purpose and Interpretation - Medium
Log transformation is a data transformation method in which it replaces each variable x with a log(x). The choice of the logarithm base...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cotterjd ESLint allows for custom rules through plugins - you don’t have to maintain a fork for this if you don’t want to!
Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.
Thanks for contributing to ESLint and we appreciate your understanding.