Skip to main content

js/useFunctionDeclarations

MISSING DOCUMENTATION

Examples

Invalid

const foo = function () {};

 file.ts:1:12 lint/js/useFunctionDeclarations  FIXABLE  ━━━━━━━━━━━━━━━━━━━

  Use a function declaration instead of a const function.

    const foo = function () {};
                ^^^^^^^^^^^^^^


const foo = () => {};

 file.ts:1:12 lint/js/useFunctionDeclarations  FIXABLE  ━━━━━━━━━━━━━━━━━━━

  Use a function declaration instead of a const function.

    const foo = () => {};
                ^^^^^^^^


const foo = () => {function bar() {this;}};

 file.ts:1:12 lint/js/useFunctionDeclarations  FIXABLE  ━━━━━━━━━━━━━━━━━━━

  Use a function declaration instead of a const function.

    const foo = () => {function bar() {this;}};
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Valid

const foo = () => {this;};
const foo: string = function () {};