There have been instances where I've made this specific mistake, and I'm curious if there are any ESLint or TSLint rules in place that could detect it.
if (this.isBrowser && this.imageURL) {.....}
private isBrowser(): boolean{
return isPlatformBrowser(this.platformId);
}
By using this.isBrowser
, it will always result in true since it's a function which is truthy. The alternatives would be to utilize either get isBrowser() {}
or this.isBrowser()
Is there a way for ESLint or TSLint to identify and notify when a function call is mistakenly written as a property accessor?