eslint icon indicating copy to clipboard operation
eslint copied to clipboard

Request for support on failOnError Overlay when applying nuxt/eslint

Open kim1124 opened this issue 1 year ago • 2 comments

Describe the feature

I would like to apply nuxt/eslint so that if there are any issues with the code, the compilation does not proceed and an error is displayed in the browser. I have configured it as defined in the nuxt/eslint documentation, but despite the IDE and devServer detecting errors, the compilation proceeds normally and no error screen is displayed in the browser.

The code I have configured is as follows.

// eslint.config.mjs

import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
  // Your custom configs here
  {
    rules: {
      'no-unused-vars': 'error'
    },
    files: ['**/*.js', '**/*.vue'] 
  }
)
// nuxt.config.ts

export default defineNuxtConfig({
  devtools: { enabled: true },
  modules: ['@nuxt/eslint'],
  eslint: {
    checker: true
  }
})

If I intentionally cause an error as shown below, the IDE and devServer detect it properly.

image

However, despite this, the compilation does not stop, and no error screen is displayed in the browser.

스크린샷 2024-06-27 오전 11 18 24

I would like the eslint errors to be reflected in the screenshot below.

스크린샷 2024-06-27 오전 11 20 56

Additional information

  • [X] Would you be willing to help implement this feature?
  • [X] Could this feature be implemented as a module?

Final checks

kim1124 avatar Jun 27 '24 02:06 kim1124

have you installed vite-plugin-eslint2 as mentioned in thedocs?

dsvgl avatar Jun 27 '24 07:06 dsvgl

have you installed vite-plugin-eslint2 as mentioned in thedocs?

Yes, I installed vite-plugin-eslint2 as mentioned in the documentation.

// package.json
{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "lint": "eslint .",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "@nuxt/eslint": "^0.3.13",
    "nuxt": "^3.12.2"
  },
  "devDependencies": {
    "eslint": "^8.57.0",
    "vite-plugin-checker": "^0.6.4",
    **"vite-plugin-eslint2": "^4.4.0"**
  }
}

kim1124 avatar Jun 30 '24 13:06 kim1124

This feature is delegated to vite-plugin-eslint2 - if it doesn't work that way already, I'd suggest you open a request to their repo instead. Thanks!

antfu avatar Jul 27 '24 21:07 antfu