Pad nested callbacks with newlines
See original GitHub issuePlease describe what the rule should do: Pad large callbacks with new lines.
What new ECMAScript feature does this rule relate to? Not applicable - general formatting.
What category of rule is this? (place an “X” next to just one item) [ ] Warns about a potential error (problem) [x] Suggests an alternate way of doing something (suggestion) [ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
const assert = require('assert');
const pg = require('pg');
const DBManager = require('../../src/database/DBManager.js');
describe('DBManager', () => {
// pad with new line here
describe('#get', () => {
// pad with new line here
it('should return an instance of pg.Pool', done => {
assert.equal(true, DBManager.get() instanceof pg.Pool);
done();
});
// pad with new line here
});
// pad with new line here
});
Why should this rule be included in ESLint (instead of a plugin)? It helps break up large function callback nesting as seen in mocha tests.
Are you willing to submit a pull request to implement this rule? I’m juggling a handful of projects currently, so unfortunately no.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Dealing with nested callbacks - Zell Liew
It's mind-boggling to see nested callbacks, but I don't think it's a “hell”. The “hell” can be manageable if you know what to...
Read more >String — Elixir v1.13.4 - HexDocs
Divides a string into substrings at each Unicode whitespace occurrence with leading and trailing whitespace ignored. Groups of whitespace are treated as a ......
Read more >EditText - Android Developers
Returns if the text is constrained to a single horizontally scrolling line ignoring new line characters instead of letting it wrap onto multiple...
Read more >strip_tags - Manual - PHP
This function tries to return a string with all NULL bytes, HTML and PHP tags stripped from a given string . It uses...
Read more >Helpers - Laravel - The PHP Framework For Web Artisans
... lower ltrim markdown mask match matchAll newLine padBoth padLeft padRight ... The Arr::get method retrieves a value from a deeply nested array...
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 Free
Top 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
@brenr thanks for the rule proposal!
Given the changes to our rules policy, I’d suggest making a custom rule, which could be based on the
padded-blocks
rule.Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.
Thanks for contributing to ESLint and we appreciate your understanding.