A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/typescript-eslint/typescript-eslint/issues/1723 below:

"parserOptions.project" has been set for @typescript-eslint/parser. · Issue #1723 · typescript-eslint/typescript-eslint · GitHub

What code were you trying to parse?

// new.ts
console.log(`hello`)l

What did you expect to happen?

no errors

What actually happened?
vscode-eslint yells at me. Running in cli is fine. Only happens for new files.

I know the workaround is to restart vscode but that's like dropping a nuclear bomb to break open a coconut.

I assume it's an issue with watching for changes.

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: common/util/new.ts.
The file must be included in at least one of the projects provided.

Always see this at the start of a new file. Existing files work fine. I assumed this was fixed in new version, but it seems not.

Configs

tsconfig.json

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "alwaysStrict": true,
    "baseUrl": ".",
    "checkJs": false, 
    "declaration": false,
    "esModuleInterop": true,
    "jsx": "react",
    "jsxFactory": "h",
    "lib": ["esnext", "dom"],
    "moduleResolution": "node",
    "noEmit": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "pretty": true,
    "resolveJsonModule": true,
    "sourceMap": true,
    "strictNullChecks": false,
    "target": "es6",
    "typeRoots": ["./node_modules/@types", "./ts-global-types"],
    "paths": {
      "common/*": ["./common/*"],
      "server/*": ["./server/*"]
    }
  },
  "include": ["common/", "frontend/", "server/"]
}

.eslintrc.js

const TS_OVERRIDE = {
  files: [`**/*.ts`, `**/*.tsx`],
  parser: `@typescript-eslint/parser`,
  parserOptions: {
    project: `./tsconfig.json`,
    tsconfigRootDir: __dirname,
  },
  plugins: [`@typescript-eslint`],
  extends: [
    `eslint:recommended`,
    `plugin:@typescript-eslint/eslint-recommended`,
    `plugin:@typescript-eslint/recommended`,
    `plugin:@typescript-eslint/recommended-requiring-type-checking`,
    `prettier`,
    `prettier/@typescript-eslint`,
  ],
  rules: ...
};

module.exports = {
  root: true,
  env: {
    browser: true,
    es6: true,
  },
  extends: `eslint:recommended`,
  overrides: [TS_OVERRIDE],
  parserOptions: {
    ecmaVersion: 2020,
    sourceType: `module`,
    ecmaFeatures: {
      jsx: true,
    },
  },
  plugins: [`react`],
  settings: {
    react: {
      pragma: `h`,
    },
  },
....
}

Versions

    "@typescript-eslint/eslint-plugin": "2.23.0",
    "@typescript-eslint/parser": "2.23.0",
    "typescript": "3.8.3",
    "eslint": "6.8.0",
    node v12.14.0
    npm 6.13.6

Halp!

Axepuff, Vishesh30, colthreepv, vashchukmaksim, emmanuelgratuze and 2 more


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4