ota-meshi / typescript-eslint-parser-for-extra-files

An experimental ESLint custom parser for Vue, Svelte, and Astro for use with TypeScript. It provides type information in combination with each framework's ESLint custom parser.
MIT License
42 stars 1 forks source link

VSCode ESLint service must be restarted for every new file #72

Open 6XGate opened 11 months ago

6XGate commented 11 months ago

Before You File a Bug Report Please Confirm You Have Done The Following...

What version of ESLint are you using?

8.5.0

What version of typescript-eslint-parser-for-extra-files are you using?

What did you do?

Configuration ```yml root: true extends: - eslint:recommended - plugin:import/recommended - plugin:import/typescript - plugin:@typescript-eslint/strict-type-checked - plugin:@typescript-eslint/stylistic-type-checked - plugin:vue/vue3-recommended - '@vue/eslint-config-typescript' - prettier plugins: - '@typescript-eslint' - prettier - vue parser: vue-eslint-parser parserOptions: project: ./tsconfig.json extraFileExtensions: [.vue] parser: js: espree ts: typescript-eslint-parser-for-extra-files vue: vue-eslint-parser settings: import/parsers: typescript-eslint-parser-for-extra-files: [.ts, .tsx, .cts, .mts] vue-eslint-parser: [.vue] import/extensions: - .js - .cjs - .mjs - .jsx - .ts - .cts - .mts - .tsx import/resolver: typescript: true node: true rules: # ECMAScript accessor-pairs: error eqeqeq: [error, always, { null: ignore }] new-cap: error new-parens: error no-caller: error no-eval: error no-extend-native: error no-extra-bind: error no-floating-decimal: error no-iterator: error no-label-var: error no-labels: error no-lone-blocks: error no-multi-str: error no-new: error no-new-func: error no-new-wrappers: error no-octal-escape: error no-proto: error no-return-assign: error no-self-compare: warn no-sequences: error no-template-curly-in-string: error no-undef-init: warn no-unmodified-loop-condition: error no-unneeded-ternary: error no-useless-call: error no-useless-computed-key: error no-useless-rename: error one-var: [error, never] yoda: [warn, never, { exceptRange: true }] # Prettier prettier/prettier: error # Import import/consistent-type-specifier-style: error import/default: off import/newline-after-import: error import/no-anonymous-default-export: error import/no-dynamic-require: error import/no-self-import: error import/no-useless-path-segments: error import/no-mutable-exports: error import/no-unused-modules: error import/no-amd: error import/order: - warn - groups: [builtin, external, parent, sibling, index, type] alphabetize: { order: asc } # TypeScript '@typescript-eslint/consistent-type-imports': error '@typescript-eslint/consistent-type-exports': error '@typescript-eslint/no-unused-vars': [error, { argsIgnorePattern: ^_ }] "@typescript-eslint/prefer-readonly": error "@typescript-eslint/promise-function-async": error "@typescript-eslint/return-await": [error, always] # TypeScript complex rules "@typescript-eslint/require-array-sort-compare": - error - ignoreStringArrays: true "@typescript-eslint/strict-boolean-expressions": - error - allowString: false allowNumber: false allowNullableObject: false allowNullableBoolean: false allowNullableString: false allowNullableNumber: false allowAny: false # Vue vue/multi-word-component-names: off overrides: - files: ['*.js', '*.cjs', '*.mjs', '*.jsx'] extends: - plugin:@typescript-eslint/disable-type-checked - files: ['*.ts', '*.cts', '*.mts', '*.tsx'] rules: import/default: off - files: ['vite.config.ts'] parserOptions: project: tsconfig.node.json ```

What did you expect to happen?

No issues with IDE ESLint services.

What actually happened?

Every time a new file is added to a project, the ESLint service in VSCode must be restarted. Every new file triggers the following ESLint error:

`Parsing error: "parserOptions.programs" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided program instance(s): ${relativePathOfFile}`

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/6XGate/tsprograms-bug

Additional comments

This issue only occurs when files are added to the project.

kuoruan commented 9 months ago

I'm facing the same issue, can we watch the new file creating and restart the inner typescript-eslint instance?

ZerdoX-x commented 8 months ago

Can confirm the same issue in neovim which uses regular language servers. Just would like to know that it is not IDE specific.

image

kuoruan commented 8 months ago

The tsconfig.json and programs are required when you enable type check for vue files. So I fixed by disable type check for vue files: https://typescript-eslint.io/linting/typed-linting#how-can-i-disable-type-aware-linting-for-a-subset-of-files

https://typescript-eslint.io/packages/parser#project

6XGate commented 7 months ago

The tsconfig.json and programs are required when you enable type check for vue files. So I fixed by disable type check for vue files: https://typescript-eslint.io/linting/typed-linting#how-can-i-disable-type-aware-linting-for-a-subset-of-files

https://typescript-eslint.io/packages/parser#project

Not really desirable, but can see that working.