nuxt-modules / eslint

ESLint module for Nuxt.js
MIT License
160 stars 15 forks source link

Errors are repeated #111

Open tflx opened 1 year ago

tflx commented 1 year ago

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.

robertpatrick commented 1 year ago

@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?

djixadin commented 11 months ago

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

swunderlich commented 11 months ago

Same problem here.

    "nuxt": "3.8.0",
    "@nuxtjs/eslint-module": "4.1.0",
andrejp6k commented 11 months ago

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 }],
  ],
robertpatrick commented 11 months ago

@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 commented 11 months ago

@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',
    ]
  },
andrejp6k commented 11 months ago

@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.

hs-wolf commented 8 months ago

@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}']