Skip to content

MakeSelectable should be new-able or renamed #5022

Description

@jacksonrayhamilton

MakeSelectable has a name with a capital letter. Typically, functions with a capital letter should be called with new, so I expect to be able to call the function in that manner. But the function is defined as an arrow function, and arrow functions cannot be called with new.

Even if it makes no difference for a particular function to be called with or without new, our linters might warn us against calling capitalized functions without new. Some linters allow whitelisting "safe names," but it's nicer not to have to manage that. And, ignoring arrow functions, it is always safe to call a function with new, whereas it is not always safe to call a function without new. Therefore, it's better for us to always have the option to call functions with new, even redundantly.

For the sake of backwards compatibility, it would probably be better to keep the capitalized name, and make the function new-able (i.e., create it with function, rather than () => {}). Otherwise, it should be renamed to makeSelectable, so we have a clearer expectation about its calling convention.

Metadata

Metadata

Labels

scope: listChanges related to the list

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions