eslint-config-metarhia
Advanced tools
Changelog
[8.2.1][] - 2023-07-20
Changelog
[8.1.0][] - 2022-06-21
Changelog
[8.0.0][] - 2022-06-04
All notable changes to this project will be documented in this file. See standard-version for commit guidelines.
<a name="7.0.0"></a>
Changelog
7.0.0 (2019-02-01)
Before:
const a = async() => {};
After:
const a = async () => {};
This is an error:
async function foo() {
return await bar();
}
These are not:
async function foo() {
await bar();
return;
}
async function foo() {
try {
return await bar();
} catch (e) {}
}
<a name="6.1.0"></a>
Changelog
6.0.0 (2018-10-22)
Before:
a = (b * c);
typeof (a);
const fn = () => (
doSomething()
);
After:
a = b * c;
typeof a;
const fn = () => doSomething();
Before:
function doSomething() {
return foo = bar + 2;
}
After:
function doSomething() {
return foo === bar + 2;
}
// or
function doSomething() {
return (foo = bar + 2);
}
<a name="5.0.0"></a>
Changelog
5.0.0 (2018-09-28)
return
statement with a value only in some of its
execution paths. This rule enforces function to explicitly return a
value in every execution path if at least one execution path returns a
value.Before:
function doSomething(condition) {
if (condition) {
return true;
} else {
return;
}
}
After:
function doSomething(condition) {
if (condition) {
return true;
} else {
return false;
}
}
// or
function doSomething(condition) {
if (condition) {
return true;
}
return false;
}
if
, else
, for
, while
, and
do
, when there is only one statement in the block. After this change,
omitting the curly braces is only allowed when the statement is on the
same line as if
, else if
, else
, for
, while
, or do
. Also,
this change enforces consistency in the usage of curly braces for if
,
else if
and else
chains.Before:
if (foo)
bar();
if (x) a();
else {
b();
c();
}
After:
if (foo) bar();
// or
if (foo) {
bar();
}
if (x) {
a();
} else {
b();
c();
}
Some of the problems reported by this rule can be fixed via
eslint --fix
.
<a name="4.0.0"></a>