Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full example for flat config with object #2448

Open
Narretz opened this issue Apr 14, 2024 · 0 comments
Open

Full example for flat config with object #2448

Narretz opened this issue Apr 14, 2024 · 0 comments

Comments

@Narretz
Copy link

Narretz commented Apr 14, 2024

Tell us about your environment

  • ESLint version: 9
  • eslint-plugin-vue version: 9
  • Vue version: 2
  • Node version: 20

The problem you want to solve.
I converted my eslint config to flat config. I used a lot of overrides, and tried to recreated that with specific objects that contain plugins etc.

So for eample previously my vue config looked like this:

overrides: [
    {
      files: ['packages/client/src/components/**/*.vue', 'stories/**/*.vue'],
      extends: ['plugin:vue/strongly-recommended'],
      parser: 'vue-eslint-parser',
      parserOptions: {
        parser: '@typescript-eslint/parser',
      },
      rules: {
        'max-lines': ['error', { max: 900 }],
      }
    }
]

The only way I managed to recreate this is by exactly spreading the arrays in the flat vue config. This involved looking at the plugin to see how many arrays it includes. Is there no easier way? I don't even know if I have included everything.

  {
    files: ['packages/client/src/components/**/*.vue', 'stories/**/*.vue'],
    languageOptions: {
      ...vue.configs['flat/vue2-strongly-recommended'][1].languageOptions,
      parserOptions: {
        parser: '@typescript-eslint/parser',
      },
    },
    plugins: {
      vue,
    },
    rules: {
      ...vue.configs['flat/vue2-strongly-recommended'][2].rules,
      ...vue.configs['flat/vue2-strongly-recommended'][3].rules,
      'max-lines': ['error', { max: 900 }],
    },
  },

Your take on the correct solution to problem.

I don't have a good idea, but it would definitely help if the rules and the language options were accessible in a merged object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant