You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer, I expect that my reformatter won't change the runtime behavior of my code. Unfortunately under some conditions clang-format injects non-cosmetic whitespace. See this section of code in nodejs-common:
return(// All ServiceObjects need `request`.// clang-format off!/^request/.test(methodName)&&// clang-format on// The ServiceObject didn't redefine the method.this[methodName]===ServiceObject.prototype[methodName]&&// This method isn't wanted.!config.methods![methodName]);
If I remove the off/on comments,clang-format produces the following output:
return(// All ServiceObjects need `request`.!/^request/.test(methodName)&&// The ServiceObject didn't redefine the method.this[methodName]===ServiceObject.prototype[methodName]&&// This method isn't wanted.!config.methods![methodName]);
The spaces inserted into the regex change it's runtime behavior.
Note: I'm filing this mostly to help make my case for a switch to Prettier in googleapis/google-cloud-node#2842 . I'll be adding a comment there soon that references this issue. If we switch to tslint + prettier (via tslint-plugin-prettier and tslint-config-prettier), this issue will be fixed "for free".
The text was updated successfully, but these errors were encountered:
As a developer, I expect that my reformatter won't change the runtime behavior of my code. Unfortunately under some conditions
clang-format
injects non-cosmetic whitespace. See this section of code in nodejs-common:If I remove the off/on comments,
clang-format
produces the following output:The spaces inserted into the regex change it's runtime behavior.
Note: I'm filing this mostly to help make my case for a switch to Prettier in googleapis/google-cloud-node#2842 . I'll be adding a comment there soon that references this issue. If we switch to tslint + prettier (via tslint-plugin-prettier and tslint-config-prettier), this issue will be fixed "for free".
The text was updated successfully, but these errors were encountered: