Arrow Functions Rules

Arrow function body style, implicit returns, and curried functions

4 rules4 auto-isFixable

arrow-function-block-body

auto-isFixable

Arrow functions with multiline expressions should use block body or wrap in parentheses

Why: Clear boundaries with braces make the function body obvious
Correct
javascript
const Button = () => (    <button className="primary">        Click me    </button>);
Incorrect
javascript
const Button = () => <button className="primary">    Click me</button>;
eslint.config.js
javascript
"code-style/arrow-function-block-body": "error"

arrow-function-simple-jsx

auto-isFixable

Collapse arrow functions returning simple single-element JSX to one line

Why: Simple component wrappers don't need multi-line formatting
Correct
javascript
export const Layout = ({ children }) => <Container>{children}</Container>;
Incorrect
javascript
export const Layout = ({ children }) => (    <Container>{children}</Container>);
eslint.config.js
javascript
"code-style/arrow-function-simple-jsx": "error"

arrow-function-simplify

auto-isFixable

Convert block body with single return to implicit return

Why: Implicit returns are more concise and idiomatic JavaScript
Correct
javascript
const double = (x) => x * 2;
Incorrect
javascript
const double = (x) => { return x * 2; };
eslint.config.js
javascript
"code-style/arrow-function-simplify": "error"

curried-arrow-same-line

auto-isFixable

Curried arrow functions start on same line as =>, not on new line

Why: Curried functions are easier to read when the chain is visible
Correct
javascript
const createAction = (type) => (payload) => ({ type, payload });
Incorrect
javascript
const createAction = (type) =>    (payload) => ({ type, payload });
eslint.config.js
javascript
"code-style/curried-arrow-same-line": "error"