vuejs/eslint-config-typescript

Cannot selectively disable type checking when using defineConfigWithVueTs

bmulholland opened this issue · 1 comments

I'm trying to enable recommendedTypeChecked, coming from recommended, and eslint is crashing on a typecheck rule that's running on a yml file. So, I'd simply like to disable type checked rules for yml files. I'm following https://typescript-eslint.io/getting-started/typed-linting/#how-can-i-disable-type-aware-linting-for-a-subset-of-files

So I add:

  {
    files: ["**/*.yml"],
    extends: [vueTsConfigs.disableTypeChecked],
  },

Which has two issues:

  1. TS says extends doesn't exist in the type input for defineConfigWithVueTs
  2. An incorrect error is thrown when running eslint: Please wrap the config object with defineConfigWithVueTs(). I am indeed wrapping the config with that.

Oops, I never thought about such scenario.

As a workaround you can add yet another defineConfigWithVueTs:


  {
    files: ["**/*.yml"],
    extends: [defineConfigWithVueTs(vueTsConfigs.disableTypeChecked)],
  },

The error was because all the vueTsConfigs.*presets are meant to be replaced, but it didn’t catch the pattern in your config.
Wrapping it in another defineConfigWithVueTs makes it a plain ESLint config object that can be extended.