AirBnB Linter 在同一行中多次套用使其太长
AirBnB Linter multiple currying in same line making it too long
我似乎 运行 陷入了爱彼迎 linting 悖论。
我有以下行:
const pagePromiseGenerator = (graphql, createPage) => (gqlNodeName, pageComponent) => new Promise((resolve, reject) => {
长度超过 100 个字符。所以我可以将其转换为:
const pagePromiseGenerator = (graphql, createPage) => {
return (gqlNodeName, pageComponent) => new Promise((resolve, reject) => {
但这违反了 AirBnB 箭头主体样式规则。我应该只禁用此行的 linting,还是有更好的方法?
const pagePromiseGenerator = (graphql, createPage) =>
(gqlNodeName, pageComponent) => new Promise((resolve, reject) => {
你可以同时满足这两条规则。您会在 implicit-arrow-linebreak docs 中看到可以将隐式 return 括在括号中:
const pagePromiseGenerator = (graphql, createPage) => (
(gqlNodeName, pageComponent) => new Promise((resolve, reject) => {
// some code here
})
);
我似乎 运行 陷入了爱彼迎 linting 悖论。
我有以下行:
const pagePromiseGenerator = (graphql, createPage) => (gqlNodeName, pageComponent) => new Promise((resolve, reject) => {
长度超过 100 个字符。所以我可以将其转换为:
const pagePromiseGenerator = (graphql, createPage) => {
return (gqlNodeName, pageComponent) => new Promise((resolve, reject) => {
但这违反了 AirBnB 箭头主体样式规则。我应该只禁用此行的 linting,还是有更好的方法?
const pagePromiseGenerator = (graphql, createPage) =>
(gqlNodeName, pageComponent) => new Promise((resolve, reject) => {
你可以同时满足这两条规则。您会在 implicit-arrow-linebreak docs 中看到可以将隐式 return 括在括号中:
const pagePromiseGenerator = (graphql, createPage) => (
(gqlNodeName, pageComponent) => new Promise((resolve, reject) => {
// some code here
})
);