Rule expansion proposal: Add "allowPattern" option to either `quote-props` or `no-useless-computed-key`
See original GitHub issueCurrently 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:
- Created 7 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top 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 >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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.