In JavaScript, I like the PascalCase naming convention for constructor functions and camelCase for other functions. It seems that ReSharper is configured for these settings. However, for code like this:
function Thing(a, b) { return { prop1: a, prop2: b }; } var thing = new Thing(2, 6);
... I get this warning:
The name "Thing" does not match the "Local Function" rule. The recommended name is "thing."
It doesnβt matter if I change Thing to this:
function Thing(a, b) { this.prop1 = a; this.prop2 = b; }
I suspect that only "public" functions are considered constructors. Do any of you know how ReSharper distinguishes between "Local" and "Constructor"? Better yet, do you know how to reverse this behavior?
javascript naming-conventions resharper
Jacob
source share