Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Relevant Package
typescript-estree
ESLint Config
importtseslintfrom"typescript-eslint";exportdefaulttseslint.config(tseslint.configs.base,{files:["**/*.ts"],languageOptions:{parserOptions:{projectService:true,tsconfigRootDir:import.meta.dirname,},},rules:{"@typescript-eslint/no-floating-promises":"error",},});
Expected Result
Internally,inferSingleRun
should returntrue
when we're in single-run mode. Executing this config with something likenpx eslint .
should be determined to be in single-run mode.
Actual Result
singleRun
is always inferred to befalse
right now, because of:
typescript-eslint/packages/typescript-estree/src/parseSettings/inferSingleRun.ts
Lines 25 to 33 in382e87b
if( | |
// single-run implies type-aware linting - no projects means we can't be in single-run mode | |
options?.project==null|| | |
// programs passed via options means the user should be managing the programs, so we shouldn't | |
// be creating our own single-run programs accidentally | |
options.programs!=null | |
){ | |
returnfalse; | |
} |
Additional Info
This doesn't generally have any impact on runtime performance right now. The project service doesn't generally use any single-run optimizations in single-run mode. But:
- It's confusing internally to see
singleRun
set tofalse
- There'll likely eventually be some optimizations, such as the caching TS system host mentioned in⚡ Performance: Project service doesn't cache all fs.statSync microsoft/TypeScript#59338 (comment)
We should also investigate whether theoptions?.extraFileExtensions?.length
check can be bypassed withoptions.projectService
per#9504:
typescript-eslint/packages/typescript-estree/src/parseSettings/inferSingleRun.ts
Lines 18 to 23 in382e87b
// https://github.com/typescript-eslint/typescript-eslint/issues/9504 | |
// There's no support (yet?) for extraFileExtensions in single-run hosts. | |
// Only watch program hosts and project service can support that. | |
if(options?.extraFileExtensions?.length){ | |
returnfalse; | |
} |
Versions
package | version |
---|---|
@typescript-eslint/typescript-estree | 8.2.0 |