eslint icon indicating copy to clipboard operation
eslint copied to clipboard

Error: with `@nuxt/eslint-config` eslint marks composables as "undefined" when used inside another composable

Open stefanobartoletti opened this issue 2 years ago • 2 comments

When using @nuxt/eslint-config, eslint uncorrectly marks composables as undefined when they are used inside another composable.

According to how Nuxt works, composables are auto-imported (and they work when executed), so eslint should not report this error.

A simple test composable that uses internal functions is

export const useComposable = () => {
  const myConst = ref('hello');

  onMounted(() => {
    console.log(myConst.value);
  });
};

And it is available in this minimal demo https://stackblitz.com/edit/github-nxygas?file=package.json,.eslintrc.cjs

(please note that you have to CTRL + C and run npm run lint to see the errors)

stefanobartoletti avatar Nov 09 '23 15:11 stefanobartoletti

Same issue for me

jeannen avatar Nov 10 '23 03:11 jeannen

Still having this issue. Did anyone find a workaround?

m-shum avatar Feb 08 '24 20:02 m-shum