Parsing error: was not found by the project service, but I’ve ignored these files

My project structure

  • dist (compiled code by ts)
    • lib
      • lib.d.ts
      • lib.js
    • index.d.ts
    • index.js
  • src (source code)
    • lib
      • lib.ts
    • index.ts
  • eslint.config.mjs
  • packages.json
  • tsconfig.json
  • yarn.lock

My tsconfig.json

{
    "compilerOptions": {
        "target": "ES2022",
        "module": "commonjs",
        "outDir": "./dist",
        "rootDir": "./",
        "strict": true,
        "esModuleInterop": true,
        "resolveJsonModule": true,
        "skipLibCheck": true,
        "forceConsistentCasingInFileNames": true,
        "baseUrl": "./src",
        "declaration": true,
        "allowJs": true
    },
    "include": [
        "src/**/*.ts",
    ],
    "exclude": [
        "eslint.config.mjs",
        "dist/**"
    ]
}

My eslint.config.mjs:

// @ts-check

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import tsParser from '@typescript-eslint/parser'

import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
    
const __dirname = dirname(fileURLToPath(import.meta.url));

export default tseslint.config(
  {
    files: [
      "src/**/*.ts"
    ],
    ignores: [
      'dist/**/*.ts',
      'dist/**',
      "**/*.mjs",
      "eslint.config.mjs",
      "**/*.js"
    ],
    rules: {
      "@typescript-eslint/no-unnecessary-condition": "error",
      "@typescript-eslint/no-unnecessary-type-assertion": "error",
    },
  },
  ...tseslint.configs.strictTypeChecked,
  ...tseslint.configs.recommendedTypeChecked,
  {
    languageOptions: {
      parserOptions: {
        project: "./tsconfig.json",
        projectService: true,
        tsconfigRootDir: __dirname,
        projectFolderIgnoreList: [
          "**dist**",
        ],
      },
    },
  },
);

I want tsc to put compiled outputs fo dist folder (I’m new to TypeScript so I don’t know if this is the right way to a TS project).

I’ve ignored files under dist folder but I still got these errors:

/Users/kainzhong/VSCode/eslintTmp/dist/src/index.d.ts
  0:0  error  Parsing error: /Users/kainzhong/VSCode/eslintTmp/dist/src/index.d.ts was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject

/Users/kainzhong/VSCode/eslintTmp/dist/src/index.js
  0:0  error  Parsing error: /Users/kainzhong/VSCode/eslintTmp/dist/src/index.js was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject

/Users/kainzhong/VSCode/eslintTmp/dist/src/lib/lib.d.ts
  0:0  error  Parsing error: /Users/kainzhong/VSCode/eslintTmp/dist/src/lib/lib.d.ts was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject

/Users/kainzhong/VSCode/eslintTmp/dist/src/lib/lib.js
  0:0  error  Parsing error: /Users/kainzhong/VSCode/eslintTmp/dist/src/lib/lib.js was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject

/Users/kainzhong/VSCode/eslintTmp/eslint.config.mjs
  0:0  error  Parsing error: /Users/kainzhong/VSCode/eslintTmp/eslint.config.mjs was not found by the project service. Consider either including it in the tsconfig.json or including it in allowDefaultProject

Haven’t I already ignored these files? Why does eslint still complain about them?