function-paren-newline

在函数括号内强制执行一致的换行符

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

许多样式指南要求或禁止函数括号内的换行符。

规则详情

此规则在函数参数或参数的括号内强制执行一致的换行符。

选项

此规则有一个选项,可以是字符串或对象。

    HKgO6/Uqu8X1Ai9AmJmX43us32O1wSiJf3m6LRaJDUJf/xdZAg6ZfyA+dTkV85BVHXk/lPv0D6ZKq509yzHiHj8uc4lvfOqObo29QP4EsHyRxEBOk5Ai9hZRLE75Or+DY5RZ1II30XtoHz6nVN4hGbEpuVrjkC4mElrMgq+NDUn/D9b7u8g6//RBNnosKIi7NlZFM+ieDB4THZaOMuGyKtxGvic10qcgQG03OiVMCrfcJHQ/nFBdmM8ySG0S721H1dLf093pDdpM7EhfbF6zmXKX0lKaVJ/z4W1se82bMyygswuWfZvbBwtUY+OHQ2YzC7ngJM/Zz8b9k9FsLz/5om1MT/LgbrlHm9h4uR1HyIeALL3iC3Ji9fFMRvywusp+JSAtpCjShSGygoe6j1Nrcebss4n1JYlg1bixGmfgmEQnDw096tV7R05KsStS+7l+g0KSIVQT2Ljv6zSL2VvHuDESoyO5fWeks4jbqfypCRyggJUnI9FBEtMVQo47lL5fX6pss07CwPLvt/andqhswvaqYyCYPEzhZjPZaMjJ5ZpUTo4opIDeKOmzQfxxBJfvFJpWFMy8M/hfOKpNZdMglJ7chSOz1J5MvyFNHygCVjHl869N21ev6FvZAnkzd5OUiU/nt1MqQemnCEvnz2o+obOdJi104Fu3zo/I27jcjpCdDeVLcyErgZn/pVAuOp42VjmSW5rln8u5u/qVT0YNRZffwPvfKEVzQ7cl6JdwKn97Q0mESSXMpk/MN0D94xS1R0dZxJoGo50fMRg+LX7Y0quU40Dc2Q0fzgl/lisCpdUXTgRfii55cO36CqW1RSuyaDjGQxuEcdG9L90YviQaorFftHJO70u0VSMMyVHrBp4H5dGxkoFapSLo38uDedxeQimmG7aaA5Bl6W4UsxjTdZlZXby5aSIIbrBhgS8N+DfNzapq4VAwAfwWhSRrZnBN2igafhHSKBK6326m81fOq9me+qoRcGVxUx7lIWU7cP9RcdKZtJLICjlz3zgd7YkG+YMwRGRmfYBUKq7wWjg3J8L3miHMDayha9BSG+wIeATbBq0/NJJ1+cLJnFB8DHZAN6AR3YiclWcJcQb6Qx7HXA==

kFcacMTXXoJh2ICWwi9sOg==

{
  "rules": {
    "function-paren-newline": ["error", "never"]
  }
}
{
  "rules": {
    "function-paren-newline": ["error", { "minItems": 3 }]
  }
}

5nEv4RCYCaBiSjFxJ4F/mKpeHlEIrnzbcqjXOckHJ1AJ0xAHd//XhiviWDbH1IuAqaAyJgfXNGoYxXmr3KHkzg8n3n6+Byg3bZng9pMLAqY=

/* eslint function-paren-newline: ["error", "always"] */

function foo(bar, baz) {}

var foo = function(bar, baz) {};

var foo = (bar, baz) => {};

foo(bar, baz);

5nEv4RCYCaBiSjFxJ4F/mKpeHlEIrnzbcqjXOckHJ1BfWqE5nzuNHhp5glzX4UAfCadSKulj2RmmZJMOk1cyb5bLx+vIqzR6ie39IF3MWi8=

/* eslint function-paren-newline: ["error", "always"] */

function foo(
  bar,
  baz
) {}

var foo = function(
  bar, baz
) {};

var foo = (
  bar,
  baz
) => {};

foo(
  bar,
  baz
);

5nEv4RCYCaBiSjFxJ4F/mCwtS62WYVf8Z3bTN0V8XnhtvTkeQjr06WS/jwr4MFgTlY/4wZUvk/MeZS6zp4z3JTWT0aSYW+CzBIMGIVe5Dm4=

/* eslint function-paren-newline: ["error", "never"] */

function foo(
  bar,
  baz
) {}

var foo = function(
  bar, baz
) {};

var foo = (
  bar,
  baz
) => {};

foo(
  bar,
  baz
);

5nEv4RCYCaBiSjFxJ4F/mCwtS62WYVf8Z3bTN0V8Xng2VcIX0zXLVJuKLwV+9IjYF/o37BrrvFCp16+0aw4kI1UXI6hM+nKNGuj36GsSlgM=

/* eslint function-paren-newline: ["error", "never"] */

function foo(bar, baz) {}

function foo(bar,
             baz) {}

var foo = function(bar, baz) {};

var foo = (bar, baz) => {};

foo(bar, baz);

foo(bar,
  baz);

0ntIbJ0OAORZP5+MP+H+w+Z9bxiMpw71i+jXrF9O/+1w11YjED6+wEOpB7WemG/TOQ6hWLRBqfFUdZzugtPCbuhee/YmJVcJW1NE91IQUpo=

/* eslint function-paren-newline: ["error", "multiline"] */

function foo(bar,
  baz
) {}

var foo = function(
  bar, baz
) {};

var foo = (
  bar,
  baz) => {};

foo(bar,
  baz);

foo(
  function() {
    return baz;
  }
);

0ntIbJ0OAORZP5+MP+H+w+Z9bxiMpw71i+jXrF9O/+1w11YjED6+wEOpB7WemG/Tf1Q4aAXjuP4vU8jBS1cjL13BNhgIX6w4S3PnNa15wG4=

/* eslint function-paren-newline: ["error", "multiline"] */

function foo(bar, baz) {}

var foo = function(
  bar,
  baz
) {};

var foo = (bar, baz) => {};

foo(bar, baz, qux);

foo(
  bar,
  baz,
  qux
);

foo(function() {
  return baz;
});

5nEv4RCYCaBiSjFxJ4F/mLxiUWvHUvaa71rQ3LgMQLhoIL7wKCq8EHhaXzPNNmEeLGHfP1o1K9wGyvhrmbxwd3tG6rN8FTs2Sl5cFqQlepY=

/* eslint function-paren-newline: ["error", "consistent"] */

function foo(bar,
  baz
) {}

var foo = function(bar,
  baz
) {};

var foo = (
  bar,
  baz) => {};

foo(
  bar,
  baz);

foo(
  function() {
    return baz;
  });

5nEv4RCYCaBiSjFxJ4F/mLxiUWvHUvaa71rQ3LgMQLhoIL7wKCq8EHhaXzPNNmEeBVlDvzOtc3OkvUVJKPkRvWNAhGQZ5lACHcIhENkr35o=

/* eslint function-paren-newline: ["error", "consistent"] */

function foo(bar,
  baz) {}

var foo = function(bar, baz) {};

var foo = (
  bar,
  baz
) => {};

foo(
  bar, baz
);

foo(
  function() {
    return baz;
  }
);

5nEv4RCYCaBiSjFxJ4F/mA66zOQt5qPgE7YnZ+irYKhqngENyUHjTqtBHy8I/Jhk1wCLzJ9nyih5lptU046D+/ivZ290d7QIlmpoj7n+8AeM78HxJc/hfFsvVvh/nBGa

/* eslint function-paren-newline: ["error", "multiline-arguments"] */

function foo(bar,
  baz
) {}

var foo = function(bar,
  baz
) {};

var foo = (
  bar,
  baz) => {};

foo(
  bar,
  baz);

foo(
  bar, qux,
  baz
);

G3FIqkOqAFrtCVn6SUEHJcnOjpaCenIwwxcUJ9eqX4UXIo/2jgq5yxDjmQrDPOxwVyC7imxCOUWM/jMsl1zhMS3/deBRFOBk8cEHAPzPyf9CXcIcWrt6+aK85pWG1Kpf

/* eslint function-paren-newline: ["error", "multiline-arguments"] */

function foo(
  bar,
  baz
) {}

var foo = function(bar, baz) {};

var foo = (
  bar
) => {};

foo(
  function() {
    return baz;
  }
);

5nEv4RCYCaBiSjFxJ4F/mDb+WLkO+1sJ2RbEWTU3xSjAh/49eE/5iV0jM8RUGE3BsIv8aPnKZNS8jxXHWp/vUQBuhYf3lc0R7ZwkPP2/NVU=

/* eslint function-paren-newline: ["error", { "minItems": 3 }] */

function foo(
  bar,
  baz
) {}

function foo(bar, baz, qux) {}

var foo = function(
  bar, baz
) {};

var foo = (bar,
  baz) => {};

foo(bar,
  baz);

5nEv4RCYCaBiSjFxJ4F/mDb+WLkO+1sJ2RbEWTU3xSjAh/49eE/5iV0jM8RUGE3BWEUFBwcx5HqawqgCeFt0XuVqWQujWvkLeiepu3ZYf20=

/* eslint function-paren-newline: ["error", { "minItems": 3 }] */

function foo(bar, baz) {}

var foo = function(
  bar,
  baz,
  qux
) {};

var foo = (
  bar, baz, qux
) => {};

foo(bar, baz);

foo(
  bar, baz, qux
);

何时不使用

yGPiz1dWxKX3Km/sQXNzfLh/pfU11M2Aur4SgtHYT7aowIORsHRGnUBh+GQx+Rt7MiTiYz7R04L+sQaLWcaVzGirKYsywUkSEYxaUFeveHyDWzZtGbKA1PD+G9MWgzAU