nuxt/eslint

Stylistic rules do not apply

zecar opened this issue · 6 comments

Environment

  • Operating System: Darwin
  • Node Version: v20.12.2
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: pnpm@8.15.6
  • Builder: -
  • User Config: srcDir, devtools, components, modules, eslint, ignore, appConfig, css, extensions, ssr, routeRules, vue, nitro, runtimeConfig, auth, colorMode, router, csurf, content
  • Runtime Modules: @nuxt/eslint@0.3.10, @nuxt/test-utils/module@3.12.1, @unocss/nuxt@0.59.4, @sidebase/nuxt-auth@0.7.2, @nuxt/ui@2.15.2, @pinia/nuxt@0.5.1, @nuxt/content@2.12.1, nuxt-csurf@1.5.2
  • Build Modules: -

Package

@nuxt/eslint

Reproduction

{
eslint: {
    config: {
      stylistic: {
        indent: 2,
        quotes: 'single',
        semi: false,
        commaDangle: 'never',
      },
    },
  },
}

Describe the bug

i've just installed the @nuxt/eslint module and put this config in nuxt.config.ts

when I run eslint nuxt.config.ts nothing changes.. commaDongle is still present, semi-colon is still there

Additional context

eslint.config.mjs

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

export default withNuxt({
  "rules": {
    "vue/multi-word-component-names": "off",
    "no-case-declarations": "warn",
    "no-console": "off",
    "vue/no-multiple-template-root": "off",
    "no-unused-expressions": "off",
    "@typescript-eslint/no-unused-vars": "warn"
  }
})

Logs

No response

We temporarily closed this due to the lack of enough information. We could not identify whether it was a bug or a userland misconfiguration with the given info.
Please provide a minimal reproduction to reopen the issue.
Thanks.

Why reproduction is required

@antfu I'm having the same problem. I tried to make commits according to the "repository installation" steps in this reproduction branch:

  1. npx nuxi@latest init (use npm)
  2. npx nuxi module add eslint
  3. npm install --save-dev vue-tsc@^1 typescript (I probably should have skipped this step to isolate typescript array from the issues...)
  4. Adding simple eslint stylistic rule as indicated on https://eslint.nuxt.com/packages/module#eslint-stylistic
  5. Add an example page with bad linting

At this point, running npm run lint or npm run lint:fix does not have the desired outcome

https://github.com/719media/nuxt_test_lint

I just did this again now to make sure I got any changes from any repositories from the last day or two. And without step 3 (typescript). Same result. However, if I rm -rf package-lock.json and rm -rf node_modules and then npm install, it starts working. The changes at this point to package-lock.json is quite extensive, so not sure it helps to paste it all.

i've bypassed this by putting the stylistic config inside eslint config file instead of nuxt config

I couldn't reproduce this with the given repo - it sounds like a dependencies duplication issue, please try to bump deps rebuild the locks. If you still have this issue, please create a new issue with a minimal reproduction. Thank you,