- Update space-before-function-paren
- Added more global idenifiers for node and browser environment
- Add node.js 23 to CI
- Merge rules from all style guides
- Add more global classes
- Add more global classes
- Fix github template
- Add much more node.js and frontend globals
- Move globals to separate submodule
- Add more frontend globals
- Add node.js backend globals
- Mode devDependencies to dependencies
- Resolve formatting conflict between ESLint and Prettier
- Update npm scripts and remove /scripts folder from package
- Update eslint to 9.x: Rewrite rules to plain format
- Drop node.js 18.x support and add node.js 22 support
- Update repository structure, CI, and badges
- Update dependencies and package file structure
- Update dependencies and package file structure
- Updated: consistent-return
- Updated: arrow-parens, handle-callback-err, operator-linebreak
- Dependencies updated to latest versions
- ECMAScript 13 (2022) features support
All notable changes to this project will be documented in this file. See standard-version for commit guidelines.
7.0.0 (2019-02-01)
- rules: change space-before-function-paren for async functions (#26) (c5922b2)
- rules: disallow unnecessary return await (#27) (d49c1ac)
- rules: with this change it is an error to not have a space before function parentheses in an async function declaration.
Before:
const a = async() => {};
After:
const a = async () => {};
- rules: with this it is an error to use return await in an async function where it doesn't bring any benefits. Note that separate await and then return or return await inside of the try-catch block are still allowed.
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) {}
}
6.1.0 (2018-12-07)
- rules: add parserOptions and set ecmaVersion to 2018 (#24) (18d8cd5)
- rules: enable allowTemplateLiterals option for quotes rule (#23) (00e3ac2)
6.0.0 (2018-10-22)
- rules: add no-extra-parens rule (#21) (226fc9c)
- rules: add no-return-assign rule (#19) (e8838ed)
- rules: remove implicit-arrow-linebreak rule (#20) (d4f68d9)
- rules: with this change it is allowed to use parentheses only where they are necessary, except for arrow conditionals (to avoid conflicts with no-confusing-arrow rule), return assignments (to avoid conflicts with no-return-assign rule) and nested binary expressions (where parentheses can be used for clarity).
Before:
a = (b * c);
typeof (a);
const fn = () => (
doSomething()
);
After:
a = b * c;
typeof a;
const fn = () => doSomething();
- rules: before, it was possible to use assignment operators in a return statement without using parentheses, which could lead to some mistakes, where assignment operators are used in place of the comparison operators.
Before:
function doSomething() {
return foo = bar + 2;
}
After:
function doSomething() {
return foo === bar + 2;
}
// or
function doSomething() {
return (foo = bar + 2);
}
5.0.0 (2018-09-28)
- rules: add consistent-return rule (#15) (e91c939)
- rules: enforce curly braces on multiline blocks (#16) (3132fdc)
- rules: before this change, it was possible to have a function
that used the
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;
}
- rules: before this change, it was allowed to avoid the use of
block statements (curly braces) with
if
,else
,for
,while
, anddo
, 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 asif
,else if
,else
,for
,while
, ordo
. Also, this change enforces consistency in the usage of curly braces forif
,else if
andelse
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
.
4.0.0 (2018-08-22)
- rules: previously, only arrow functions consisting of a single expression were allowed to omit parentheses around the parameter list (and required to, if there's only one parameter in the list). After this change, the parens are only allowed when they are required syntactically.
Before:
const f = x => x;
const g = (x, y) => x + y;
const h = (x) => {
console.log(x);
};
const i = (x, f) => {
f(x);
};
After:
// Not affected
const f = x => x;
// Not affected
const g = (x, y) => x + y;
// AFFECTED
const h = x => {
console.log(x);
};
// Not affected
const i = (x, f) => {
f(x);
};
This rule is fixable via eslint --fix
.
Refs: metarhia/Metarhia#22
3.0.0 (2018-07-19)
- eslint: upgrade to ESLint 5 (a4ee615)
- eslint: drop support for ESLint 4 and move to ESLint 5 being the peerDependency, consequently enabling two new rules by default (see https://eslint.org/docs/user-guide/migrating-to-5.0.0#eslint-recommended-changes for details).
2.0.0 (2017-11-26)
- rules: add implicit-arrow-linebreak rule (75748ff)
-
rules: before this change, if
doSomething()
in the following snippet of codeconst fn = () => doSomething();
could not fit on one line, both
const fn = () => ( doSomething() );
and
const fn = () => doSomething();
would be valid from the point of view of ESLint.
After this change, only
const fn = () => ( doSomething() );
is valid.
Also, it is required to update ESLint.