vite-plugin-eslint icon indicating copy to clipboard operation
vite-plugin-eslint copied to clipboard

`vite build` produces duplicate eslint output

Open samcarswell opened this issue 2 years ago • 3 comments

vite build seems to be producing duplicate output for eslint; one for [plugin:vite-plugin-eslint] and one normal:

[plugin:vite-plugin-eslint] 
/Users/user/project/src/utilities/resourceUtils.ts
   1:10  warning  'useState' is defined but never used                @typescript-eslint/no-unused-vars
   1:20  warning  'useEffect' is defined but never used               @typescript-eslint/no-unused-vars
   4:20  warning  Unexpected any. Specify a different type            @typescript-eslint/no-explicit-any
   8:9   error    'base' is never reassigned. Use 'const' instead     prefer-const
  11:9   error    'options' is never reassigned. Use 'const' instead  prefer-const

✖ 5 problems (2 errors, 3 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.


/Users/user/project/src/utilities/resourceUtils.ts
   1:10  warning  'useState' is defined but never used                @typescript-eslint/no-unused-vars
   1:20  warning  'useEffect' is defined but never used               @typescript-eslint/no-unused-vars
   4:20  warning  Unexpected any. Specify a different type            @typescript-eslint/no-explicit-any
   8:9   error    'base' is never reassigned. Use 'const' instead     prefer-const
  11:9   error    'options' is never reassigned. Use 'const' instead  prefer-const

✖ 5 problems (2 errors, 3 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

samcarswell avatar Mar 10 '23 05:03 samcarswell

@samcarswell

I have the same error. Are you using any framework? These are my rules:

"extends": [
    "eslint:recommended",
    "plugin:vue/vue3-essential",
    "plugin:@typescript-eslint/recommended",
    "prettier"
 ]

Found out that when I remove typescript plugin it is working fine.

Also setting emmitError to false removes one of outputs, same for emmitWarning.

Everything is fixed by disabling cache.

MrEraxd avatar Apr 11 '23 19:04 MrEraxd

I have the same issue.

olafszad avatar Apr 11 '23 19:04 olafszad

@samcarswell et al, not sure if you ever got to the bottom of this but I was experiencing a similar issue with vite and it ended up being the solidjs plugin creating duplicate build config entries (running twice). This sounds very similar to your issue. Check out details here: https://github.com/solidjs/vite-plugin-solid/pull/101

GitMurf avatar Aug 31 '23 13:08 GitMurf