
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
eslint-plugin-no-empty-statement
Advanced tools
disallow empty statement as the body of `if`, `for`, etc.
It's possible that developers write these forms of code:
if (falseCondition);
{
console.log("It's not true.");
}
for (let i = 0; i < 3; i++);
{
doSomethingInLoop();
}
In the first example, the developer wants the if
body to be executed only if falseCondition
is met, but because he mistakenly typed a semicolon next to the parenthesis, the { ... }
block isn't treated as if
body, so it always gets executed.
In the second example, the developer wants doSomethingInLoop()
to be executed 3 times, but because he mistakenly typed a semicolon next to the parenthesis, the { ... }
block isn't treated as for
body, so it gets executed only once.
If the if
or for
body is simply a semicolon, this semicolon is an "empty statement". Note that this is not "empty block", which is {}
.
This rule disallows this form of semicolons.
In your eslint config file:
{
"plugins": ["no-empty-statement"],
"rules": {
"no-empty-statement/no-empty-statement": "error"
}
}
This rule has a string option:
"ignore-statement-list-item"
(default) allows "empty statement semicolons" in a container that can have multiple statements, for example an extra semicolon in the block { doSomething(); ; }
"all"
disallows all "empty statement semicolons".FAQs
disallow empty statement as the body of `if`, `for`, etc.
The npm package eslint-plugin-no-empty-statement receives a total of 0 weekly downloads. As such, eslint-plugin-no-empty-statement popularity was classified as not popular.
We found that eslint-plugin-no-empty-statement demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.