space-after-function-name: enforce consistent spacing after name in function definitions

This rule was removed in ESLint v1.0 and replaced by the space-before-function-paren rule.

Whitespace between a function name and its parameter list is optional.

function withoutSpace(x) {
    // ...
}

function withSpace (x) {
    // ...
}

Some style guides may require a consistent spacing for function names.

Rule Details

This rule aims to enforce a consistent spacing after function names. It takes one argument. If it is "always" then all function names must be followed by at least one space. If "never" then there should be no spaces between the name and the parameter list. The default is "never".

Examples of incorrect code for this rule:

function foo (x) {
    // ...
}

var x = function named (x) {};

// When ["error", "always"]
function bar(x) {
    // ...
}

Examples of correct code for this rule:

function foo(x) {
    // ...
}

var x = function named(x) {};

// When ["error", "always"]
function bar (x) {
    // ...
}

Version

This rule was introduced in ESLint 0.11.0 and removed in 1.0.0-rc-1.

Resources

Js中文网,专注分享前端最新技术、大厂面试题、聊点程序员轶事、职场感悟,做前端技术的传播者.

加入前端布道师交流群

扫描二维码回复 加群 学习,与大厂大佬讨论技术.

BAT面试题大全