"newline-per-chained-call" doesn't allow first method to start on new line
See original GitHub issueWhat rule do you want to change? I want to change the newline-per-chained-call
rule to allow for ignoreChainWithDepth
to be set to 0
, so every new method chained is on a new line instead of skipping the first method.
Does this change cause the rule to produce more or fewer warnings? The rule will produce fewer warnings by adhering to user’s preference of coding style.
How will the change be implemented? (New option, new default behavior, etc.)? Basically you just need to change the ignoreChainWithDepth
option to allow for 0
instead of only >= 1.
Please provide some example code that this change will affect:
Input:
myPromise.then(() => {
}).catch(() => {
});
myObject.get(documentID).insert({ test: true }).run().then(() => {
}).catch(() => {
});
myObject.myProperty.get(documentID).insert({ test: true }).run().then(() => {
}).catch(() => {
});
Expected output:
myPromise
.then(() => {
})
.catch(() => {
});
myObject
.get(documentID)
.insert({ test: true })
.run()
.then(() => {
})
.catch(() => {
});
myObject.myProperty
.get(documentID)
.insert({ test: true })
.run()
.then(() => {
})
.catch(() => {
});
Actual output:
myPromise.then(() => {
})
.catch(() => {
});
myObject.get(documentID)
.insert({ test: true })
.run()
.then(() => {
})
.catch(() => {
});
myObject.myProperty.get(documentID)
.insert({ test: true })
.run()
.then(() => {
})
.catch(() => {
});
What does the rule currently do for this code? The ignoreChainWithDepth
rule is only allowed to range from 1 to 10. I think this number should be allowed to be set from 0-10, allowing for the first method to be put on a new line instead of being on the same line as the variable/object it’s being called from.
What will the rule do after it’s changed? I’ve included examples above to what it will look like.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top GitHub Comments
@kaicataldo Yeah, I can do that sometime tomorrow. Thanks!
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.