nuxt / eslint

Collection of ESLint-related packages for Nuxt
https://eslint.nuxt.com
MIT License
515 stars 65 forks source link

Stylistic rules do not apply #412

Closed zecar closed 1 month ago

zecar commented 2 months ago

Environment

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

antfu commented 2 months ago

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

719media commented 1 month ago

@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

719media commented 1 month ago

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.

zecar commented 1 month ago

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

antfu commented 1 month ago

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,