-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
The plugin does not function properly when languageOptions.projectService
is enabled
#2634
Comments
This has nothing to do with |
I need to enable Linting with Type Information for typescript-eslint. According to its documentation, I need to set up the following: {
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
}, I updated my ESLint configuration based on the documentation you provided: // @ts-check
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
import globals from "globals";
export default tseslint.config(
{
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
...pluginVue.configs["flat/recommended"],
],
files: ["**/*.{ts,vue}"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: globals.browser,
parserOptions: {
parser: tseslint.parser,
ecmaFeatures: {
jsx: true,
},
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// your rules
},
}
); However, it resulted in an error:
After configuring
The previous issue still persists. Is there an incorrect configuration somewhere? How should it be set up to work seamlessly with Typed Linting? |
This comment was marked as outdated.
This comment was marked as outdated.
You can see the reproduction link I submitted in the issue, where the tsconfig.json configuration is as follows: {
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"jsxImportSource": "vue",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
Even if I add
|
Oh right. I have a pretty similar setup (but still on ESLint v8 with parserOptions: {
parser: {
js: '@typescript-eslint/parser',
ts: '@typescript-eslint/parser',
'<template>': '@typescript-eslint/parser',
},
projectService: {
allowDefaultProject: ['.eslintrc.js', '*.js'],
},
tsconfigRootDir: __dirname,
extraFileExtensions: ['.vue'],
ecmaVersion: 2021,
sourceType: 'module',
}, Maybe it is the JSX that is throwing either parser off somehow? |
I haven't encountered this issue on ESLint 8; everything works fine, even with JSX. However, after upgrading to ESLint 9, the problem emerged. Here is my ESLint 8 configuration, which didn't encounter any issues: "plugins": ["vue", "@typescript-eslint"],
"parser": "vue-eslint-parser",
"parserOptions": {
"ecmaVersion": 13,
"parser": "@typescript-eslint/parser",
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
}, ESLint 9 works fine if I don't configure TypeScript ESLint's Typed Linting. To be honest, I'm not sure where the issue lies. |
So you don't have typed linting with ESLint 8? Could you try whether that works? |
No, this is the configuration I'm currently using. I'm in the process of migrating from ESLint 8 to ESLint 9, and with ESLint 8, everything was working fine. |
Checklist
Tell us about your environment
Please show your full configuration:
What did you do?
When
languageOptions.projectService
is set totrue
, it reports errors for JSX but does not report errors for Vue.What did you expect to happen?
The errors related to JSX should not be reported, and errors related to Vue should be reported.
What actually happened?
Repository to reproduce this issue
https://codesandbox.io/p/devbox/cvwhrs
The text was updated successfully, but these errors were encountered: