curly multi-or-nest incorrect example with a comment
See original GitHub issueTell us about your environment
- ESLint Version: v7.0.0-alpha.1
- Node Version: v12.14.0
- npm Version: v6.13.4
What parser (default, Babel-ESLint, etc.) are you using?
Please show your full configuration:
Configuration
module.exports = {
parserOptions: {
ecmaVersion: 2015,
},
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
Online Demo (v6.8.0)
/*eslint curly: ["error", "multi-or-nest"]*/
if (foo)
// some comment
bar();
eslint index.js
What did you expect to happen?
In curly multi-or-nest documentation this is one of the examples of incorrect code (the last one).
What actually happened? Please include the actual, raw output from ESLint.
no errors.
Are you willing to submit a pull request to fix this bug?
I’m not sure should this be fixed in the rule or in the docs. This may be a bug, but I have concerns about the impact if we change the behavior now.
Relevant issue/PRs: #7538, #7539, #7597.
The intention was to allow this:
/*eslint curly: ["error", "multi-or-nest"]*/
if (foo) {
// some comment
bar();
}
but I can’t tell from the relevant discussions whether the intention was also to disallow the code that was added to the incorrect examples.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
PR #13151 updates the docs to match the actual behavior.
I’d vote to leave the rule as is. This could be unintended behavior, but fixing it looks like a big change for users now.
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.