eslint-plugin-ember
eslint-plugin-ember copied to clipboard
Nested Brace Expanded Properties
I get errors from ember/use-brace-expansion with something like this:
sampleProperty: computed(
'foo.bar.{name,place}',
'foo.baz.{thing,@each.stuff}',
'foo.qux.[]',
function() {
It doesn't pass until I nest them all like this:
sampleProperty: computed(
'foo.{bar.{name,place},baz.{thing,@each.stuff},qux.[]}',
function() {
This does not work. Ember does not support nested brace expansion, per this comment/code.
I confirmed it and it's definitely something we should take into consideration. Thanks for posting this issue @scottosmith
I'm still seeing this issue occurring with a CP I'm defining like so:
rawAdFormData: computed(
'draftAdForm.form.{name,headline,description,privacyPolicy,legalDisclaimer,thankYouMessage,landingPage}',
'draftAdForm.form.hiddenFields.@each.{name,value}',
'draftAdForm.form.customQuestions.@each.{question,multipleChoiceValues}',
'[email protected]',
function() {
return this._getRawAdFormData();
}
),
Am I missing something or is this not fixed?
I think this is not fixed. Just spoke to @rwjblue about it and we agreed we should fix the linter here. Can we reopen this issue?
Whats about this guys?
Hi ;), I was checking this rule because the linter did not warn me about closing braces. Same thing for nested brace expanded properties. I can fix these issues if we agree that the linter should be checking for them. What do you think?
Other than this, it seems to be ok for the other corner cases I checked. Are there any identified cases that fail?
Thx
I was checking this rule because the linter did not warn me about closing braces. Same thing for nested brace expanded properties.
@TheMBTH - I'm not 100% sure what case you are referring to, but a PR is always welcome 😸
Duly noted :smile_cat: ... I was talking about the absence of a check that all open braces have a matching closing braces. I was thinking about adding a rule for this or a sort of a pre-check for specific rules. I will PR by the end of this week and let you tell me what you think. Cheers
@TheMBTH any luck on that PR? 😁
Thank you @rwjblue for reminding me. Sorry for the delay.
Here it is https://github.com/ember-cli/eslint-plugin-ember/pull/709
To be clear this bug is yet to be fixed as of today. Correct?
To make this focused…
Given
@computed('foo', '{bar,baz}.[]') // [1]
@computed('{foo,{bar,baz}.[]}') // [2]
@computed('foo', 'bar.[]', 'baz.[]') // [3]
@computed('{foo,bar.[],baz.[]}') // [4]
Expected
- PASSED No warning/error ✔︎
- FAILED Invalid brace syntax ✔︎
- FAILED Prefer brace expansion syntax ✔︎
- PASSED No warning/error ✔︎ (Though this version is just silly)
Actual
- FAILED Prefer brace expansion syntax ✘
- FAILED Invalid brace syntax ✔︎
- FAILED Prefer brace expansion syntax ✔︎
- PASSED No warning/error ✔︎ (Though this version is just silly)