-
-
Notifications
You must be signed in to change notification settings - Fork 2.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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Relevant Package
typescript-estree
ESLint Config
import tseslint from "typescript-eslint";
export default tseslint.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 return true
when we're in single-run mode. Executing this config with something like npx eslint .
should be determined to be in single-run mode.
Actual Result
singleRun
is always inferred to be false
right now, because of:
typescript-eslint/packages/typescript-estree/src/parseSettings/inferSingleRun.ts
Lines 25 to 33 in 382e87b
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 | |
) { | |
return false; | |
} |
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 the options?.extraFileExtensions?.length
check can be bypassed with options.projectService
per #9504:
typescript-eslint/packages/typescript-estree/src/parseSettings/inferSingleRun.ts
Lines 18 to 23 in 382e87b
// 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) { | |
return false; | |
} |
Versions
package | version |
---|---|
@typescript-eslint/typescript-estree |
8.2.0 |