-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
false negative of semi
rule with never
option
#9521
Comments
I think some users might prefer to always have a semicolon before cc @feross |
I see. In that case, I'd like to add an option to control (require/disallow) the semicolons before For example: /*eslint semi: [error, never, { beforeUnreliableLineButSafe: "any" }] */
import f from "f" //← OK either way. This is the current behavior. This is default.
[1,2,3].forEach(f) /*eslint semi: [error, never, { beforeUnreliableLineButSafe: "always" }] */
import f from "f" //← Error: require semi. (note: `semi-style` rule will move the semicolon to the beginning of the next line in auto-fixing.)
[1,2,3].forEach(f) /*eslint semi: [error, never, { beforeUnreliableLineButSafe: "never" }] */
import f from "f"; //← Error: disallow semi.
[1,2,3].forEach(f) But I'm not sure better option name. A side note, /*eslint indent: error */
import f from "f"
;[1,2,3].forEach(f) //← Error: expected indentation of 4 spaces but found 0. (indent) |
I'd like to champion this new option. I think the option is helpful for consistency of semicolons.
I'll implement this if this is accepted. @eslint/eslint-team What do you think? |
hmm..always have a semi before |
Yeah, the 08b654c is a reference implementation. |
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
Please show your full configuration:
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
What did you expect to happen?
I expected
semi
rule to warn those semicolons because I'm using"never"
option.If a semicolon exists the end of the following statements, I can remove semicolons safely even if the next line starts with
(
or[
:DoWhileStatement
ReturnStatement[argument=null]
BreakStatement
ContinueStatement
DebuggerStatement
ImportDeclaration
ExportNamedDeclaration[declaration=null]
ExportAllDeclaration
What actually happened? Please include the actual, raw output from ESLint.
The
semi
rule does not warn those semicolons.EDIT: After discussion, I changed this bug report to an enhancement proposal: #9521 (comment) and #9521 (comment)
The text was updated successfully, but these errors were encountered: