implicit-arrow-linebreak

强制箭头函数体的位置

一些该规则报告的问题可以通过 --fix 命令行选项 自动修复

箭头函数体可以包含作为表达式而不是块体的隐式返回。为隐式返回的表达式强制执行一致的位置可能很有用。

规则详情

此规则旨在为包含隐式返回的箭头函数强制执行一致的位置。

选项

此规则接受字符串选项:

    jbrwUYUR9A8t5AbOzDvqo0fmVHanjjFREWNUIOsfMRxxbf3J1cbz3yn+cJhI0AJe/5eMwZqV+cU//gb2y+NbJtrILPFy6BDDYHtvpoJj98b58TZTc4ZGvucGe8C8FIWSXM411Sh0mnTEBckoeCV78V7pM3mb3fNsICYIvhcK22LbDmenmuIv6/Pyf2jAsXvWGf7Xu2eD0lrk7VMH1JcwKyPK73B8fzuM4tvp9FtzbUU=

CEHxsB1TjBaKZMpVoTBEZBIK6FxGXzVpbIEjCaYwVXex0R01apgNqfrctkHrKUmiMJKKF+eXvGGzDUdauiwgUssEaI2gfMLKVThdAXpcxeg=

/* eslint implicit-arrow-linebreak: ["error", "beside"] */

(foo) =>
  bar;

(foo) =>
  (bar);

(foo) =>
  bar =>
    baz;

(foo) =>
(
  bar()
);

CEHxsB1TjBaKZMpVoTBEZBIK6FxGXzVpbIEjCaYwVXex0R01apgNqfrctkHrKUmi1N1usztLFMkc6D5dHz7qkWKjbvBXbP3SLLcc6PubatM=

/* eslint implicit-arrow-linebreak: ["error", "beside"] */

(foo) => bar;

(foo) => (bar);

(foo) => bar => baz;

(foo) => (
  bar()
);

// functions with block bodies allowed with this rule using any style
// to enforce a consistent location for this case, see the rule: `brace-style`
(foo) => {
  return bar();
}

(foo) =>
{
  return bar();
}

7eMqNA6LZNNQz9WpSYg/f4E6r3Cr1IIXPUw3Ae1fkfHw+Favlj7VOxx7HsN9m2IVo+KWl1su+d1D3d8uQjMvbgagbJYLLitq2fSUEEABCIk=

/* eslint implicit-arrow-linebreak: ["error", "below"] */

(foo) => bar;

(foo) => (bar);

(foo) => bar => baz;

7eMqNA6LZNNQz9WpSYg/f4E6r3Cr1IIXPUw3Ae1fkfGwwO0I4k4tHki/iShgxHy0cSoSRG3b29Ec9Sb9Hq/F8+DpuHSB3TY93luLqD8WqDE=

/* eslint implicit-arrow-linebreak: ["error", "below"] */

(foo) =>
  bar;

(foo) =>
  (bar);

(foo) =>
  bar =>
    baz;

何时不使用

FiKZ8bxNbaXBfnvSjGDq1tRD78dL7KS30tdu7ZVqzonoX+TMllLSxcx1o69JdwauagGq6AepxYnzFAiXhfpKfdAF33yCN+1iOaMDYdMFG3DERm1ruCznW9PhKiSWpnH5yDoj2CDZaD3jk8tPfhR6Mw==

YLy91omTn89qYz+saJHFXga9bAT9OtS/iliPsqZqi93i/UxrLbUrmhqyaMWRrgdrZaumMkNkkHMVi5MXLE4M8ddGkLjK+6d+xbpUS8dp6RkhrvDwMvEnnY26WNHY0RrSWPZhODFRbLFDleHUTNXmjT6KhyglUjX81G29CxYWnEHHsrB4SL5DYXPtmmzFoFVZIvI3uPire+bvUp4p94Vo7/1NUowL/kuchXMXIPSU34tBS/u6zxdJhvYFjuvnW3YTY+fKbpPzWf3U+HSuYeC2NAhvxJINQs8EH5eX1Opyb4o=