eslint-plugin-ember icon indicating copy to clipboard operation
eslint-plugin-ember copied to clipboard

Nested Brace Expanded Properties

Open scottosmith opened this issue 8 years ago • 11 comments

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.

scottosmith avatar Jul 21 '17 18:07 scottosmith

I confirmed it and it's definitely something we should take into consideration. Thanks for posting this issue @scottosmith

michalsnik avatar Jul 23 '17 14:07 michalsnik

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?

johngibbons avatar Dec 18 '18 23:12 johngibbons

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?

RobbieTheWagner avatar Apr 16 '19 16:04 RobbieTheWagner

Whats about this guys?

AlexAndBear avatar Jul 01 '19 08:07 AlexAndBear

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

TheMBTH avatar Jan 05 '20 18:01 TheMBTH

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 😸

rwjblue avatar Feb 11 '20 15:02 rwjblue

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 avatar Mar 04 '20 08:03 TheMBTH

@TheMBTH any luck on that PR? 😁

scottosmith avatar Mar 15 '20 01:03 scottosmith

Thank you @rwjblue for reminding me. Sorry for the delay.

Here it is https://github.com/ember-cli/eslint-plugin-ember/pull/709

TheMBTH avatar Mar 15 '20 13:03 TheMBTH

To be clear this bug is yet to be fixed as of today. Correct?

sukima avatar Sep 23 '20 20:09 sukima

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

  1. PASSED No warning/error ✔︎
  2. FAILED Invalid brace syntax ✔︎
  3. FAILED Prefer brace expansion syntax ✔︎
  4. PASSED No warning/error ✔︎ (Though this version is just silly)

Actual

  1. FAILED Prefer brace expansion syntax
  2. FAILED Invalid brace syntax ✔︎
  3. FAILED Prefer brace expansion syntax ✔︎
  4. PASSED No warning/error ✔︎ (Though this version is just silly)

sukima avatar Sep 23 '20 20:09 sukima