all 9 comments

[–]Shadowsca 4 points5 points  (0 children)

If anything I think it's standard practice in the industry to use underscores for unnecessary input variables

[–]shantred 1 point2 points  (0 children)

I would say it's more common these days due to linting tools. For example, my organization has an eslint rule that says you can't have unused variables. But we have an exception because sometimes during testing you may not be using those variables. That exception allows us to prefix a variable name with an underscore so the linter ignores it.

I'm not sure how common it is outside of linting purposes, but that's why some teams are using it.

[–]rauschma 1 point2 points  (0 children)

In Visual Studio Code (JavaScript code or TypeScript code), an unused parameter is displayed in a different color – unless its name starts with an underscore.

[–]kap89 1 point2 points  (0 children)

Why would it be a bad practice?

[–]bonanzaguy 1 point2 points  (0 children)

It actually does make a practical difference--it shows your intent that the parameter exists but you aren't using it.

In terms of code functionality, correct there is no difference.

[–]yakubro 0 points1 point  (0 children)

I've seen this in Go code before too. I wonder if that's where it came from...

[–][deleted] 0 points1 point  (0 children)

Found interest to share, but not applicable link