eslint icon indicating copy to clipboard operation
eslint copied to clipboard

Errors are repeated

Open tflx opened this issue 1 year ago • 8 comments

I'm getting a huge output from eslint with every error repeated a number of times. It shows fx. ✖ 61 problems (61 errors, 0 warnings) (repeated 42 times) It's not always the same amount of repeats though.

I can reproduce it here with a very simple nuxt starter: https://stackblitz.com/edit/nuxt-starter-aepdun?file=package.json,nuxt.config.ts,.eslintrc,app.vue

Notice the line 3:5 error Component name "NuxtWelcome" is not kebab-case vue/component-name-in-template-casing is output twice. Now imagine that in a big project with hundreds of files.

tflx avatar Sep 20 '23 10:09 tflx

@ricardogobbosouza We are seeing the same issue. While this also happens in earlier versions of Nuxt (e.g., 3.7.1), it is less noticable due to the way output is being written to the terminal (i.e., the multiple errors do not cause the text in the terminal to scroll) than it is in 3.7.2 and newer. Is it possible to get a fix for this issue?

robertpatrick avatar Sep 27 '23 19:09 robertpatrick

a big problem. especially with big projects. i tried to set lintOnStart to false to reduce the amount of repeating errors but it didn't do anything

djixadin avatar Oct 11 '23 13:10 djixadin

Same problem here.

    "nuxt": "3.8.0",
    "@nuxtjs/eslint-module": "4.1.0",

swunderlich avatar Nov 01 '23 08:11 swunderlich

I was able to disable it directly in the module section but not in a dedicated section for eslint.

My current config:

  modules: [
    // https://nuxt.com/modules/eslint
    ['@nuxtjs/eslint-module', { cache: false, lintOnStart: false }],
  ],

andrejp6k avatar Nov 03 '23 13:11 andrejp6k

@andrejp6k That's sort of beside the point. Yes, it is possible to prevent lint from running at startup but the point of this issue is that we want to run lint on startup but only have it print each error once at the end of the scan versus printing the errors multiple times.

robertpatrick avatar Nov 03 '23 13:11 robertpatrick

@andrejp6k Sorry, seeing your config made me focus on the lintOnStartup: false when in fact, setting cache: false does seem to eliminate this behavior. It works in a dedicated eslint section as well:

  modules:  [
    '@nuxt/devtools',
    '@nuxtjs/eslint-module',
    '@nuxtjs/i18n',
    '@pinia/nuxt',
    '@vueuse/nuxt',
    'dayjs-nuxt',
  ],
  ...
  eslint: {
    cache:   false,
    exclude: [
      '.nuxt',
      '.output',
    ]
  },

robertpatrick avatar Nov 03 '23 14:11 robertpatrick

@robertpatrick I've noticed a comment that setting lintOnStartup: false does not help. So I shared my temporal solution. It was not meant to be a solution for this issue.

andrejp6k avatar Nov 03 '23 17:11 andrejp6k

@andrejp6k Sorry, seeing your config made me focus on the lintOnStartup: false when in fact, setting cache: false does seem to eliminate this behavior. It works in a dedicated eslint section as well:

  modules:  [
    '@nuxt/devtools',
    '@nuxtjs/eslint-module',
    '@nuxtjs/i18n',
    '@pinia/nuxt',
    '@vueuse/nuxt',
    'dayjs-nuxt',
  ],
  ...
  eslint: {
    cache:   false,
    exclude: [
      '.nuxt',
      '.output',
    ]
  },

Unrelated to the problem at hand, I noticed your exclude property excluding .nuxt and .output, is there a reason for that?

By the documentation It seems that the default including glob goes like this [nuxt.options.srcDir.'/**/*.{js,jsx,ts,tsx,vue}']

hs-wolf avatar Jan 10 '24 02:01 hs-wolf