func-call-spacing
要求或不允许函数标识符及其调用之间有间距
一些该规则报告的问题可以通过 --fix 命令行选项 自动修复
调用函数时,开发人员可以在函数名称和调用它的括号之间插入可选的空格。以下成对的函数调用是等价的:
alert('Hello');
alert ('Hello');
console.log(42);
console.log (42);
new Date();
new Date ();
规则详情
此规则要求或不允许函数名和调用它的左括号之间有空格。
选项
此规则有一个字符串选项:
- vsK8gBGQXMet3c8w/qLubutTBRZKa+07D2s7hGQl7XRP03cYeBcD9NnT8yy4OIqTgowUS/2doVNCSsU+nAL8/Fg9pyNpLl70f5MG8vtUGBJZ+O13Hj7zCNZPwOwP4EYPnBlPIUY64Tbde+QMQCSupUw0aJR/ZjTZOMK47SiZNxhSCie0QMlN4gkDHQ8AVqLm0V//8uxvQ+kKrhyZ90AipFJgmuwFX6sJdAgtZab1DyA=
auU2y7n5p+UMM4Ev8FjgR090olqk4mmiNuhht/yRJ0jXSmEZflQtfNKJVJl0cit0qlJbWOgtMu/oR7M1/Ib/PcssOtyIIQfF9BLWgwfi/kxYh1iK6WqDvZI29USkjUGTb4e2D5rR8A4sIxsIsQd98j4o19mGG304qAuz/464drFgsztAcPR3U7epyU6gWWDk
never
qwlXDFeOGAub+EzAJFeRQSlZSvSnzZWorZEGjnED1suiH3+xmlvSuv/Apb3xSCZZoV+H80m0VDNN3cIdedLj2uCY0X/LA92MOdGT5ILQfPs=
/*eslint func-call-spacing: ["error", "never"]*/
fn ();
fn
();
qwlXDFeOGAub+EzAJFeRQSlZSvSnzZWorZEGjnED1suiH3+xmlvSuv/Apb3xSCZZhp3Fx4XVWlQ/VYlYzazEcZYAo2G+H6zeVFz9vw3tPyE=
/*eslint func-call-spacing: ["error", "never"]*/
fn();
always
yqV+SV60QvsOsYXkYvZsZSN35u2BEfk7UzqdB7xGwBXAxMLq9tHsIQE7501GmDQVOKLwOEc6SBB1Q7CuPjXRTvRf6BwRkCRaFSPkKC/ITPA=
/*eslint func-call-spacing: ["error", "always"]*/
fn();
fn
();
yqV+SV60QvsOsYXkYvZsZSN35u2BEfk7UzqdB7xGwBVZSC+x4VbKrC6dmOngM9JtEZ9HS3DKi+EIk962kYJOsv7sY7JBZk+4gKi/h2XVZbw=
/*eslint func-call-spacing: ["error", "always"]*/
fn ();
allowNewlines
c2gFciP9YPVZ5YHHVWv+GkoXj++qHjXrnNNNr0Ql7zbxa8zM1p/EkKhndbUxXouz4/5b+h1Qz8R8fsfevGfkESyv7cbq6w3BMHy2z25HXB9w+yoHRKDL/4coCSz5k+rt8qhetmTW4nL0pb07IGModkEquRcMIhdi+7b7/iBy0thsJmw/lV535u9KMzuBeVlK3DQw2yPWHbSVYeFl96NjINpJyboR6zC0o23kCoLbzak9Y8aBo9so/Qzb4O1GKqJAZ5quQ5QPe/NaGLeH833wdCW2ywnVPNHGwJFfcTxolOM=
H7ZT4r5vH4vL8O9sReFNgBn6cBGKnV43O9b2rHTwAopOdApeh2BFicuxaNMmnUxAceJ+ao1Z5hS5m/RDW3PuE5TFTnR1kb00O3w8LTW/EVY=
/*eslint func-call-spacing: ["error", "always", { "allowNewlines": true }]*/
fn();
H7ZT4r5vH4vL8O9sReFNgBn6cBGKnV43O9b2rHTwAopOdApeh2BFicuxaNMmnUxAD3ohEzvQKbyxWxqnYLXERF8vPN4l7xG484lYUsJ0QCk=
/*eslint func-call-spacing: ["error", "always", { "allowNewlines": true }]*/
fn (); // Newlines are never required.
fn
();
何时不使用
HqqKX5CD+luD2bn2nlomJM3yKljp2t9Slu60210iRXff4QA6OcoKUVfNt5UNqNsGzr7OAcNlha9z9PHbLDVhxQ8ISQni4eRnDZdHboDMgTDm7oVwYFZ7Hsz61COrdxA7tjbcyJUFzeirjILCMVHbVvm/rJGTkV4x7oAfg4w9HFI=
兼容性
- A2arLA16BaFzoOfXvkJXZFrw4NcT3SGVL3d8aXz3etEkKKrg7pnfwNqg3v/t5LFXfWHtTMFSqwRqWYzPONijn+S3yiC1gRLuev1tdXMWIgK1Ts4nOgK30cLw6+XjldRm26CMztmV0Nb6GzCPyi6J3kOOIjnsycreWPggcIFGVZhnxoVY97tMVb/aQ9M8CeH7Z9mbaXh4eLTPcASVF6/88cd/tJf9bke0flkIAlNAiDqfySet4bDtGckI47aMH4PiqM0kBLm+83H+2iVQyhFiVK1qOccvH24w8Gz1PaVS4Q1IbCvCkZ5ViH6Sxr7508xL