quick-lint-js
quick-lint-js copied to clipboard
#265 Warn on redundant semicolon after else
Summary
Warn when a semicolon is found after else.
After this change a warning is reported for the semicolons at 7:7
12:15
and 16:2
let x = 0;
function f() {}
function g() {}
if (x) {
f();
} else; {
g();
}
if (x) {} else;
{ }
if (x) {} else
;{ }
Output in VIM plugin format is:
{"qflist": [{"col": 7, "lnum": 7, "end_col": 7, "end_lnum": 7, "type": "W", "nr": "E202", "vcol": 0, "text": "redundant semicolon after else", "filename": "invalid.js"},
{"col": 15, "lnum": 12, "end_col": 15, "end_lnum": 12, "type": "W", "nr": "E202", "vcol": 0, "text": "redundant semicolon after else", "filename": "invalid.js"},
{"col": 1, "lnum": 16, "end_col": 1, "end_lnum": 16, "type": "W", "nr": "E202", "vcol": 0, "text": "redundant semicolon after else", "filename": "invalid.js"}]}
else;;; {}
is also valid code but was left out for simplicity. (loop of peek and skip required).
CLA Assistant Lite bot Thank you for your contribution! Like many free software projects, you must sign our Contributor License Agreement before we can accept your contribution.
EDIT: All contributors have signed quick-lint-js' Contributor License Agreement (CLA-v1.md).
I have read and hereby agree to quick-lint-js' Contributor License Agreement (CLA-v1.md).
Did you want me to review your latest changes, or are you still hacking?