quick-lint-js icon indicating copy to clipboard operation
quick-lint-js copied to clipboard

10$: Suggest computed property on template literal as object key

Open strager opened this issue 1 year ago • 3 comments

The following is invalid:

let bar = 'bar';
let baz = 'baz';
let o = { 
  `foo`: true,
  `x${bar}`: true,
  `${baz}`: true,
};

We should diagnose the template keys and suggest using a computed property instead:

let bar = 'bar';
let o = { 
  [`foo`]: true,
  [`x${bar}`]: true,
  [baz]: true,
};

strager avatar Sep 14 '23 20:09 strager

Extra credit: image image image

kyle-wannacott avatar Sep 15 '23 06:09 kyle-wannacott

i would like to work on it , @strager can you please assign it to me ?

qayyum22 avatar Sep 29 '23 13:09 qayyum22

can you please assign it to me ?

Sure!

If you want payment, make sure you follow the instructions on https://quick-lint-js.com/hiring/.

strager avatar Oct 11 '23 01:10 strager