function-call-argument-newline
在函数调用的参数之间强制换行
一些该规则报告的问题可以通过 --fix 命令行选项 自动修复
许多样式指南要求或不允许函数调用的参数之间换行。
规则详情
此规则强制在函数调用的参数之间换行。
选项
此规则有一个字符串选项:
- SA8b+r7GMqVC2l0BSHO/wv5x/ywmV77AgWtLISunAMMNsE8+laU/jA6a9KWOw9gCELV+Gn+VqkYeL8BfSs56ixZJxhvfqeqBx/mcgvebO159jxaZz26ipbAxm29WezL3KmyZNJw6l7ENh1jDuwYDLBPNFcc1ewMrh9I2iS+FzxGs61IfgpHIinoRgJ51mLNVtbrjpbWv/UaTPBDYXXKCCpYcjMfl3r3vOH76hHrXuVYS0kxZifzQQlZ4a42N5bw/dMMoFosxJ6ffxxCGpp1BLRrluZ5Wr4EYT+bsBGbVmoA=
always
r6wQ2IZpRtGiw32ZwGb3QCOr4ph08QJPs3Lj+idhMynHKvXoKx3xl5mCOg009ba9+LBhch3RQyk6LlQb/APXNJHUsCIYj8j9P0GZQ5Itx1o=
/*eslint function-call-argument-newline: ["error", "always"]*/
foo("one", "two", "three");
bar("one", "two", {
one: 1,
two: 2
});
baz("one", "two", (x) => {
console.log(x);
});
r6wQ2IZpRtGiw32ZwGb3QCOr4ph08QJPs3Lj+idhMynHKvXoKx3xl5mCOg009ba9XGwPnnVRGR/EwGkRseAN9DKXQDPjip6CXTmdwF23Gv8=
/*eslint function-call-argument-newline: ["error", "always"]*/
foo(
"one",
"two",
"three"
);
bar(
"one",
"two",
{ one: 1, two: 2 }
);
// or
bar(
"one",
"two",
{
one: 1,
two: 2
}
);
baz(
"one",
"two",
(x) => {
console.log(x);
}
);
never
IARWIJPRNEHmnnA0AhcYhps4jvfu7dAw6NekxuFkLpPIhVKvKkSgjz6K0FPGwfbo6wH54g82gB/ODpAubJF27x9NxMuzB3bkTCBL0jSJuDc=
/*eslint function-call-argument-newline: ["error", "never"]*/
foo(
"one",
"two", "three"
);
bar(
"one",
"two", {
one: 1,
two: 2
}
);
baz(
"one",
"two", (x) => {
console.log(x);
}
);
IARWIJPRNEHmnnA0AhcYhps4jvfu7dAw6NekxuFkLpNY+HECC9EtRLgYzEIlpXeXAsX+JZcX5ScO38JID314NNhwOHVYtXcJqAFQC388JnQ=
/*eslint function-call-argument-newline: ["error", "never"]*/
foo("one", "two", "three");
// or
foo(
"one", "two", "three"
);
bar("one", "two", { one: 1, two: 2 });
// or
bar("one", "two", {
one: 1,
two: 2
});
baz("one", "two", (x) => {
console.log(x);
});
consistent
IARWIJPRNEHmnnA0AhcYhv+ccIBxS0tIabmU0tyyiaNOLoK+5W2M6oQDb/Ai03fc5b15YizkJI4oQJxDlvtAWjJk6XFZIwYGFNrbGgkp06w=
/*eslint function-call-argument-newline: ["error", "consistent"]*/
foo("one", "two",
"three");
//or
foo("one",
"two", "three");
bar("one", "two",
{ one: 1, two: 2}
);
baz("one", "two",
(x) => { console.log(x); }
);
IARWIJPRNEHmnnA0AhcYhv+ccIBxS0tIabmU0tyyiaNOLoK+5W2M6oQDb/Ai03fcE0DTfzkkiaau4BiTxWE4Cfvw2T5jqUkuAofFLRXjsAo=
/*eslint function-call-argument-newline: ["error", "consistent"]*/
foo("one", "two", "three");
// or
foo(
"one",
"two",
"three"
);
bar("one", "two", {
one: 1,
two: 2
});
// or
bar(
"one",
"two",
{ one: 1, two: 2 }
);
// or
bar(
"one",
"two",
{
one: 1,
two: 2
}
);
baz("one", "two", (x) => {
console.log(x);
});
// or
baz(
"one",
"two",
(x) => {
console.log(x);
}
);
何时不使用
oZPBJo9FKPz2Uh33ZmId0JILVFqOScpmcMii7BrerlxAGICW+ZnixSss1TKNEPVUBCwT7+J4jIzt/8eE4KZcY3SAUn24Xa+LFyRZBec991E=