Skip to content

Parsing error: ESLint was configured to run on X However, that TSConfig does not include this file (when project opened from symlinked folder) #1972

Open
@fohrloop

Description

@fohrloop

I'm in the process of setting up my very first JS/TS project. I was getting and error like this in VSCode from the eslint plugin:

Parsing error: ESLint was configured to run on `/testproj/repo/frontend/app/foo.ts` using `parserOptions.project`: <tsconfigRootDir>/tsconfig.node.json
However, that TSConfig does not include this file. Either:
- Change ESLint's list of included files to not include this file
- Change that TSConfig to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
See the typescript-eslint docs for more info: https://typescript-eslint.io/troubleshooting/typed-linting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-fileeslint

I was trying to reproduce the issue with minimal example, and this is what I got. The reason seems to be somehow related to the fact that the project was opened from a location that is a symlink to another folder.

Steps to reproduce

1 Create the repo

Create a project folder with a "repo" folder (that would contain your git repo) somewhere. In this example, I'm using

/home/USERNAME/projects/testproj/repo

Create a /frontend directory to the repo, and add the following files:

eslint.config.js
import eslint from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';

export default tseslint.config({
  files: ['**/*.{ts,tsx}'],

  extends: [
    eslint.configs.recommended,
    ...tseslint.configs.strictTypeChecked,
    ...tseslint.configs.stylisticTypeChecked,
  ],

  languageOptions: {
    ecmaVersion: 'latest',
    globals: globals.browser,
    parserOptions: {
      project: ['./tsconfig.node.json'],
      tsconfigRootDir: import.meta.dirname,
    },
  },

});
tsconfig.node.json
{
  "include": [
    "app/**/*",
  ],
  "compilerOptions": {
    "composite": true,
    "lib": ["DOM", "DOM.Iterable", "ES2022"],
    "types": ["vite/client"],
    "target": "ES2022",
    "module": "ES2022",
    "moduleResolution": "bundler",
    "jsx": "react-jsx",
    "isolatedModules": true,
    "moduleDetection": "force",
    "noEmit": true,
    "baseUrl": ".",
    "rootDirs": [".", "./.react-router/types"],
    "paths": {
      "~/*": ["./app/*"]
    },
  }
}
package.json
{
  "name": "testproj",
  "version": "1.0.0",
  "author": "",
  "type": "module",
  "license": "MIT",
  "description": "",
  "devDependencies": {
    "@eslint/js": "^9.18.0",
    "@types/eslint__js": "^8.42.3",
    "eslint": "^9.18.0",
    "globals": "^15.14.0",
    "typescript": "^5.7.3",
    "typescript-eslint": "^8.20.0"
  }
}
app/foo.ts
import { something } from 'somewhere';

Install the package. The repo folder should have following contents:

📁 repo/
└─📁 frontend/
  ├─📄 pnpm-lock.yaml
  ├─📄 eslint.config.js
  ├─📄 package.json
  ├─📁 app/
  │ └─📄 foo.ts
  ├─📁 node_modules/
  └─📄 tsconfig.node.json

2 Create a symbolic link to the repo folder

❯ cd /
❯ sudo mkdir testproj
❯ sudo chown USERNAME /testproj
❯ cd testproj/
❯ ln -s /home/USERNAME/projects/testproj/repo/ repo

3 Open the project with VS Code with original and symlinked locations

When opening original folder (/home/USERNAME/projects/testproj/repo) in VS Code:

  • You'll see some as expected but no ESLint Parsing error

Image

When opening symlinked folder (/testproj/repo ) in VS Code:

  • You'll see the unexpected Parsing error: ESLint was configured to run on X However, that TSConfig does not include this file . (this is the problem)
  • If you have a larger project, the same error will be visible on the first word of every .ts/.tsx file in the project.

Image

Version info

  • VsCode extension Identifier: dbaeumer.vscode-eslint
  • VsCode extension Version: 3.0.10

from ESList Output:

[Info  - 2:49:42 PM] ESLint server is starting.
[Info  - 2:49:42 PM] ESLint server running in node v20.18.1
[Info  - 2:49:42 PM] ESLint server is running.
[Info  - 2:49:43 PM] Server process exited successfully
[Info  - 2:49:43 PM] ESLint library loaded from: /home/USERNAME/projects/testproj/repo/frontend/node_modules/.pnpm/eslint@9.18.0/node_modules/eslint/lib/api.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunities

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions