arrow-parens
eslint
Safe autofix
eslint.config.js
export default [
{
rules: {
"arrow-parens": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
a => {};
a => a;
a => {'\n'};
a.then(foo => {});
a.then(foo => a);
a(foo => { if (true) {} });var a = 1;
var b = 2;
// ...
if (a => b) {
console.log('bigger');
} else {
console.log('smaller');
}
// outputs 'bigger', not smaller as expectedvar a = 1;
var b = 0;
// ...
if ((a) => b) {
console.log('truthy value returned');
} else {
console.log('falsy value returned');
}
// outputs 'truthy value returned'() => {};
(a) => {};
(a) => a;
(a) => {'\n'}
a.then((foo) => {});
a.then((foo) => { if (true) {} });() => {};
a => {};
a => a;
a => {'\n'};
a.then(foo => {});
a.then(foo => { if (true) {} });
(a, b, c) => a;
(a = 10) => a;
([a, b]) => a;
({a, b}) => a;
const f = (/** @type {number} */a) => a + a;
const g = (/* comment */ a) => a + a;
const h = (a /* comment */) => a + a;(a) => {};
(a) => {'\n'};
a => ({});
() => {};
a => a;
a.then((foo) => {});
a.then((foo) => { if (true) {} });
a((foo) => { if (true) {} });
(a, b, c) => a;
(a = 10) => a;
([a, b]) => a;
({a, b}) => a;Examples from the ESLint documentation.
arrow-parens
eslint
export default [
{
rules: {
"arrow-parens": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Disallow dangling underscores in identifiers
Require return statements to either always or never specify values
Disallow variable declarations from shadowing variables declared in the outer scope