question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule expansion proposal: Add "allowPattern" option to either `quote-props` or `no-useless-computed-key`

See original GitHub issue

Currently the dot-notation rule has an allowPattern option to, for example, allow bracket notation when camel-case is enabled and a property must be in snake_case. It’s the exact same use case for either quote-props or no-useless-computed-key; when building an object for an external api, sometimes you have to use snake_case. Whether that more properly belongs in one or the other, I’m not sure.

Without this change, the only way to put snake case’d params into an object for third party consumption when you have the camel case rule enabled is to just create the object and add properties, which is a bit of a hassle.

Compare:

const obj = {};
obj['foo_bar'] = true;
obj['bar_foo'] = false;
thirdPartyApi(obj);

vs

thirdPartyApi({
  'foo_bar': true,
  'bar_foo': false
});

or

thirdPartyApi({
  ['foo_bar']: true,
  ['bar_foo']: false
});

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sgtpepper43commented, Jan 12, 2017

It’s good, it’s good, thinning out the backlog makes it more likely that if this comes up again it would get noticed (and makes it more likely that more important issues would get noticed), so it’s definitely a good thing.

0reactions
kaicataldocommented, Jan 12, 2017

That’s the goal! Stale issues make it harder both for us as a team to prioritize what we should work on and make it harder for contributors to find issues to work on themselves.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"allow" option for quote-props to allow pattern · Issue #13226 ...
Ref #13053 What rule do you want to change? quote-props Does this change cause the rule to produce more or fewer warnings? fewer...
Read more >
Options - Prettier
Prettier ships with a handful of format options. ... In code styleguides, maximum line length rules are often set to 100 or 120....
Read more >
fluid-eslint | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
griebnitz/node_modules/eslint/CHANGELOG.md - GitLab
c832cd5 Update: add ignoreDestructuring option to id-match rule (#10554) (一名宅。) 54687a8 Fix: prefer-const autofix multiline assignment ( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found