Next.js Discord

Discord Forum

ESLint rules for Function Declaration in Components and Function Expression otherwise

Unanswered
Tomistoma posted this in #help-forum
Open in Discord
TomistomaOP
Hi, I would like to have the following eslint config in my project:

- Components must always be function declarations (e.g.:)
export default async function foo() { 
  /*... */
}

- All other functions must always be function expressions (e.g.:)
const foo = () => "whatever"
const foo = function () { /*...*/ }
const foo = () => { /*...*/ }


I am asking incase anyone has something similar setup in their project.
Thanks i

0 Replies