← Back

space-before-function-paren warning

Require a space before function parenthesis

Examples

❌  Incorrect

function foo () {
    // ...
}

let bar = function () {
    // ...
};

class Foo {
    constructor () {
        // ...
    }
}

let foo2 = {
    bar () {
        // ...
    }
};

let foo3 = async() => 1

✅  Correct

function myFunction() {
    // ...
}

let doSomething = function() {
    // ...
};

class MyClass {
    constructor() {
        // ...
    }
}

let MyObject = {
    bar() {
        // ...
    }
};

const doSomethingAsync = async () => 1;