-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Rule: No raw objects or arrays on class prototypes #2
Comments
For whitelisting, it is not clear to me if any of these properties can be set inside of init or if they must be set on the prototype:
|
@mitchlloyd that list seems fine. It just raises that most of those things, like I believe only mutable primitives should be flagged invalid by this rule. Immutable values (numbers, strings, etc) can sometimes be better set on |
Recently, we got trolled pretty hard by acceptance tests that weren't cleaned up due to someone putting mutable models with timers, observers, etc. onto the prototype. So, I went looking for this rule. Would love to reopen the dialog on this rule if y'all think it's viable. Whitelisting seems like a maintenance headache at best and error prone at worst. But, I'm not sure if there's a smarter way to figure out what's acceptable to be on the prototype. Happy to help if needed. |
@justinaray This repo predates eslint-plugin-ember which is now the best spot for Ember-related ESLint rules. You'll find what you're looking for there! |
FWIW, I just released eslint-plugin-ember which adds exactly the rule that is proposed here. This can probably be closed... |
Donezo. Thanks @rwjblue! |
Thanks @mitchlloyd and @rwjblue!! Much appreciated. Heading over to eslint-plugin-ember. |
In general, prevent users from putting objects raw objects and arrays on class prototypes:
Bad
Good
Should we also prevent raw values (non-functions) as well?
Some Emberisms will need to be whitespaced:
classNameBindings
,classNames
,actions
The text was updated successfully, but these errors were encountered: