standard / ts-standard

Typescript style guide, linter, and formatter using StandardJS
https://www.npmjs.com/package/ts-standard
MIT License
473 stars 36 forks source link

Parsing error: The file must be included in at least one of the projects provided #124

Closed edorgeville closed 3 years ago

edorgeville commented 3 years ago

What version of this package are you using?

$ ts-standard --version
10.0.0

What operating system, Node.js, and npm version?

$ node --version && npm --version
v15.8.0
7.5.1

Windows 10 Pro - 1903 - build 18362.267

What happened? When using ts-standard with a new Vue3 Typescript app, I get the following error for each file:

<file>:0:0: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: <file>.
The file must be included in at least one of the projects provided. ()

Here are the steps to reproduce:

npm init @vitejs/app -- my-vue-app --template vue-ts
cd my-vue-app
npm i
npx ts-standard

This uses the following template: https://github.com/vitejs/vite/tree/main/packages/create-app/template-vue-ts Here is the content of tsconfig.json:

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "moduleResolution": "node",
    "strict": true,
    "jsx": "preserve",
    "sourceMap": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "lib": ["esnext", "dom"],
    "types": ["vite/client"]
  },
  "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}

What did you expect to happen? Not to get the error

Are you willing to submit a pull request to fix this bug? Yes, if someone else or I manage to find the issue 😅

David-Neuhaus commented 3 years ago

Are you using the VS Code extension for standardjs? If yes: I had the same error message today, for me standard/vscode-standard#156 was the reason. If you update to the latest version, the error should disappear (I think it is not yet shipped, but you can package it manually following this guide).

edorgeville commented 3 years ago

@David-Neuhaus I am not using the VSCode extension, and the steps to reproduce from the first post still produce the same results outside of VSCode. But I am glad you could resolve your issue 😄

Since then we have moved to ESLint, extending Standard's ruleset. Here is our .eslintrc if this is of interest to anyone:

{
  "extends": [
    "plugin:@typescript-eslint/recommended",
    "plugin:vue/vue3-recommended",
    "standard-with-typescript"
  ],
  "parser": "vue-eslint-parser",
  "parserOptions": {
    "extraFileExtensions": [".vue"],
    "parser": "@typescript-eslint/parser",
    "project": "./tsconfig.json",
    "sourceType": "module"
  }
}
shicholas commented 3 years ago

it looks like no new version of ts-standard has been shipped since this update. @standard can you please help us out?

theoludwig commented 3 years ago

We don't officially support .vue files with TypeScript, it is a eslint-config-standard-with-typescript issue (https://github.com/standard/eslint-config-standard-with-typescript/issues/552) that will be not be fixed because if we want to support .vue files, it makes more sense to create a new eslint config package as we did for react with jsx: eslint-config-standard-react. Please open a new issue on standard if you want that happening.

Concerning the VSCode error, it is again not related to ts-standard, please open a new issue on vscode-standard if it's still not working. Please note that in a project with multiple folders containing tsconfig.json files, you need to correctly set "standard.workingDirectories": ["myFolder", "myFolder2"] in .vscode/settings.json.

it looks like no new version of ts-standard has been shipped since this update. @standard can you please help us out?

What update are you talking about? Would love to help, but that is not related to ts-standard, so I'm closing the issue. If you still have problems, don't hesitate to open issues on the appropriate repos or ask for help on our Discord server.

Thanks for your report! :smile: