ember-decorators / argument

Decorators for Component and Object arguments in Ember
MIT License
30 stars 18 forks source link

feature: Allow user to expand attribute whitelist #91

Closed alexlafroscia closed 5 years ago

alexlafroscia commented 5 years ago

As suggested by #89, since many addons expect users to define properties on their components, we should allow the user to expand the whitelist that we use internally to keep track of expected attributes that are not defined arguments.

I originally just wanted to support an array of Regular Expressions, but that doesn't work with ember-get-config and I couldn't come up with an alternate means for configuring this that I was comfortable with.

Thus, the API ended up being separate arrays of patterns to start/end/include, plus a simplified version for exact values to match against.

One downside here is that we now have some configuration in config/environment and some in ember-cli-build. I don't think this is too big of a deal, though, as one is for the run-time behavior and the other is for the build-time behavior.

Closes #89

alexlafroscia commented 5 years ago

@lifeart made a great suggestion for an alternate API here:

https://github.com/ember-decorators/argument/issues/89#issuecomment-450095261

But I have concerns about it leading to people using real regular expressions, which would break

https://github.com/ember-decorators/argument/issues/89#issuecomment-450177130

Would love feedback on either approach.