no-lone-blocks
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"no-lone-blocks": "error",
},
},
];{}
if (foo) {
bar();
{
baz();
}
}
function bar() {
{
baz();
}
}
{
function foo() {}
}
{
aLabel: {
}
}
class C {
static {
{
foo();
}
}
}"use strict";
{
function foo() {}
}Examples from the ESLint documentation.
no-lone-blocks
eslint
export default [
{
rules: {
"no-lone-blocks": "error",
},
},
];no-lone-blocks
eslint plugin · style
{
"rules": {
"no-lone-blocks": "error"
}
}complexity/noUselessLoneBlockStatements
complexity · since 1.3.3
{
"linter": {
"rules": {
"complexity": {
"noUselessLoneBlockStatements": "error"
}
}
}
}Enforce return statements in callbacks of array methods
Disallow the use of eval()-like methods
Disallow template literal placeholder syntax in regular strings
Disallow octal escape sequences in string literals