I am trying to upgrade to eslint 9 on an existing project. I use vue3 and typescript 5 as well as prettier.
The issue lies with the new flat config which I haven't used before. I have figured it out that I should be using a different plugin, specifically this one https://eslint.vuejs.org/user-guide/, but it only seems to serve javascript .vue files and not typescript ones.
How can I write eslint.config.js in order to work with vue3, typescript and eslint 9 ?
This is what I have tried:
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
import eslintConfigPrettier from "eslint-config-prettier";
export default tseslint.config(
{
ignores: ["dist/**", "node_modules/**", "**/cypress/**", "html/", "coverage/"],
files: ["**/*.vue", "**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
languageOptions: {
ecmaVersion: 2020,
},
},
eslint.configs.recommended,
{
plugins: {
"@typescript-eslint": tseslint.plugin,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: true,
},
},
},
...pluginVue.configs["flat/recommended"],
...pluginVue.configs["flat/strongly-recommended"],
...pluginVue.configs["flat/essential"],
{
rules: {
"vue/match-component-import-name": "warn",
"vue/match-component-file-name": [
"error",
{
extensions: ["vue"],
shouldMatchCase: true,
},
],
"vue/component-definition-name-casing": ["error", "PascalCase"],
"vue/block-tag-newline": [
"warn",
{
singleline: "always",
multiline: "always",
maxEmptyLines: 0,
},
],
"vue/html-self-closing": [
"error",
{
html: {
void: "always",
normal: "never",
component: "always",
},
svg: "always",
math: "always",
},
],
"vue/require-default-prop": "off",
},
},
eslintConfigPrettier
);
prettier-eslintstill didn't work because of github.com/prettier/prettier-eslint/issues/947.