eslint-plugin-ember
eslint-plugin-ember copied to clipboard
Bug: require-computed-property-dependencies incorrectly flags a key w/ nesting after brace expansion
What
Ember.computed('article.{comments,title}.innerProperty', function() {
return this.article.title.innerProperty + someFunction(this.article.comments.innerProperty);
});
throws from require-computed-property-dependencies
.
the auto-fixer will expand the keys, which causes use-brace-expansion
to throw:
Ember.computed('article.comments.innerProperty', 'article.title.innerProperty', function () {
return this.article.title.innerProperty + someFunction(this.article.comments.innerProperty);
}),
Not sure whether one or both rules should be adjusted here, or maybe the auto-fixer.
Thanks for the bug report!
The logic for handling braces in these two rules (require-computed-property-dependencies and use-brace-expansion) is unfortunately very complex and not entirely consistent. I would love to extract and improve a set of utility functions that both rules could use to expand and collapse the braces. This would also allow us to add autofixing to the use-brace-expansion
rule which doesn't have an autofixer currently.
However, this would be a sizable revamp, and the two rules currently work well for the vast majority of use cases, so I don't have immediate plans to work on this myself.
yeah, I just did an inline ignore and moved on. it's a pretty edge case