Skip to content

The plugin does not function properly when languageOptions.projectService is enabled #2634

Open
@A-kirami

Description

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 9.16.0
  • eslint-plugin-vue version: 9.32.0
  • Vue version: 3.5.13
  • Node version: 22.11.0
  • Operating System: Windows11

Please show your full configuration:

// @ts-check

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";

export default tseslint.config(
  eslint.configs.recommended,
  tseslint.configs.recommended,
  ...pluginVue.configs["flat/recommended"],
  {
    files: ["*.vue", "**/*.vue"],
    languageOptions: {
      parserOptions: {
        parser: tseslint.parser,
        ecmaFeatures: {
          jsx: true,
        },
        extraFileExtensions: [".vue"],
        projectService: true, // If you comment out this line, it will work.
        tsconfigRootDir: import.meta.dirname,
      },
    },
  }
);

What did you do?

When languageOptions.projectService is set to true, it reports errors for JSX but does not report errors for Vue.

<script setup lang="tsx">
const jsxComponent = <div>This is a jsx component</div>
</script>

<template>
  <jsxComponent></jsxComponent>
  <div></div>
</template>

What did you expect to happen?

The errors related to JSX should not be reported, and errors related to Vue should be reported.

/project/workspace/src/App.vue
  6:3  warning  Require self-closing on Vue.js custom components (<jsxComponent>)  vue/html-self-closing
  7:3  warning  Require self-closing on HTML elements (<div>)                      vue/html-self-closing

✖ 2 problems (0 errors, 2 warnings)
  0 errors and 2 warnings potentially fixable with the `--fix` option.

What actually happened?

/project/workspace/src/App.vue
  2:31  error  Parsing error: ',' expected

✖ 1 problem (1 error, 0 warnings)

Repository to reproduce this issue

https://codesandbox.io/p/devbox/cvwhrs

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions