Recently, I integrated tslint into my TypeScript project to ensure adherence to code styling rules. While the process has been relatively smooth, there is one particular aspect that still raises questions for me.
Within my codebase, I have instances where I utilize a singleton-like object encapsulating properties and functions. For instance:
function open(x) {...};
function close(x) {...};
let isOpen = false;
export const MainMenu {
open,
close,
isOpen
};
The predicament arises when tslint flags the naming of 'MainMenu' due to enforcing camelCase variable conventions. In most cases, adhering to this convention is logical; however, in scenarios similar to this, where uppercase names are customary (Math
, Reflect
, etc.), the necessity becomes ambiguous.
So, what approach should be taken here? Should I disable the rule selectively or consider utilizing the concept of 'namespace'? Nonetheless, employing external modules complicates matters, potentially hindering the seamless addition of property members.
I would greatly appreciate any insights or advice on how best to proceed with this issue.