Skip to content

getASTFromProject reports error when linting new files using a long running instance of eslint #959

Closed
@raix

Description

@raix

What code were you trying to parse?

The file is empty and just created in vs code - the eslint extension is working on a newly created file.

// ... in vscode-eslint/server/src/eslintServer.ts
let report: ESLintReport = cli.executeOnText(content, file);
// ...

What did you expect to happen?
There should be no errors (like if setting the parser option "createDefaultProgram": true)

What actually happened?
The VSCode extension returns:

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: /Users/raix/dev/test-eslint/src/test8.tsx.
The file must be included in at least one of the projects provided.eslint

(Running eslint from the terminal works as expected - it might be a caching issue)

Versions

package version
@typescript-eslint/parser 2.1.0
TypeScript 3.5.3
ESLint 6.3.0
node 10.16.3
npm 6.9.0
yarn 1.7.3
.eslintrc.json

```json { "parser": "@typescript-eslint/parser", "plugins": [ "react", "@typescript-eslint" ], "extends": [ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking" ], "parserOptions": { "project": "tsconfig.json", "ecmaFeatures": { "jsx": true }, "ecmaVersion": 2018, "sourceType": "module" }, "env": { "browser": true, "es6": true }, "globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly" }, "rules": { "indent": [ "error", "tab" ], "linebreak-style": [ "error", "unix" ], "quotes": [ "error", "double" ], "semi": [ "error", "always" ] } } ```

tsconfig.json

```json { "compilerOptions": { "target": "es5", "module": "esnext", "jsx": "preserve", "outDir": "./dist", "strict": true, "esModuleInterop": true, "allowJs": true, "lib": [ "dom", "dom.iterable", "esnext" ], "skipLibCheck": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true }, "include": [ "src" ] } ```

References:

Possible related to:

If needed I can investigate further and make a pull request solving the issue - but I would like to get a direction on where to best solve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already existspackage: parserIssues related to @typescript-eslint/parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions