vuejs/eslint-config-typescript

[14.0.0-rc.1] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './recommended' is not defined by "exports" in @vue/eslint-config-typescript

gustawdaniel-statscore opened this issue · 1 comments

How to migrate fro 13 to 14?

In v13 there was @vue/eslint-config-typescript/recommended but in 14 there is problem.

My eslint.config.mjs

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
  baseDirectory: __dirname,
  recommendedConfig: js.configs.recommended,
  allConfig: js.configs.all,
});

export default [
  {
    ignores: ['**/assets/', '**/dist/', '**/libs/', '**/styles/'],
  },
  ...compat.extends('eslint:recommended', '@vue/eslint-config-typescript/recommended'),
  {
    rules: {
      'vue/multi-word-component-names': 0,
      'no-implicit-coercion': 1,
      '@typescript-eslint/no-unused-vars': [
        'warn', // or "error"
        {
          argsIgnorePattern: '^_',
          varsIgnorePattern: '^_',
          caughtErrorsIgnorePattern: '^_',
        },
      ],
      '@typescript-eslint/no-unused-expressions': 0,
    },
  },
];

I solved by

import vueEslintConfig from "@vue/eslint-config-typescript";

and then

  ...vueEslintConfig(),

My current eslint.config.mjs

import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import vueEslintConfig from "@vue/eslint-config-typescript";
import globals from "globals";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
  baseDirectory: __dirname,
  recommendedConfig: js.configs.recommended,
  allConfig: js.configs.all
});

export default [
  {
    languageOptions: {
      globals: {
        ...globals.node
      }
    }
  },
  {
    ignores: ["**/assets/", "**/dist/", "**/libs/", "**/styles/"]
  },
  ...compat.extends("eslint:recommended"),
  ...vueEslintConfig(),
  {
    rules: {
      "vue/multi-word-component-names": 0,
      "no-implicit-coercion": 1,
      "@typescript-eslint/no-unused-vars": [
        "warn", // or "error"
        {
          argsIgnorePattern: "^_",
          varsIgnorePattern: "^_",
          caughtErrorsIgnorePattern: "^_"
        }
      ]
    }
  }
];