@typescript-eslint/typescript-estree
Advanced tools
Comparing version 8.2.1-alpha.27 to 8.2.1-alpha.28
@@ -6,2 +6,3 @@ import type * as ts from 'typescript/lib/tsserverlibrary'; | ||
allowDefaultProject: string[] | undefined; | ||
lastReloadTimestamp: number; | ||
maximumDefaultProjectFileMatchCount: number; | ||
@@ -8,0 +9,0 @@ service: TypeScriptProjectService; |
@@ -113,2 +113,3 @@ "use strict"; | ||
allowDefaultProject: options.allowDefaultProject, | ||
lastReloadTimestamp: performance.now(), | ||
maximumDefaultProjectFileMatchCount: options.maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING ?? | ||
@@ -115,0 +116,0 @@ DEFAULT_PROJECT_MATCHED_FILES_THRESHOLD, |
@@ -38,2 +38,3 @@ "use strict"; | ||
const validateDefaultProjectForFilesGlob_1 = require("./create-program/validateDefaultProjectForFilesGlob"); | ||
const RELOAD_THROTTLE_MS = 250; | ||
const log = (0, debug_1.default)('typescript-eslint:typescript-estree:useProgramFromProjectService'); | ||
@@ -57,5 +58,4 @@ const serviceFileExtensions = new WeakMap(); | ||
function openClientFileFromProjectService(defaultProjectMatchedFiles, isDefaultProjectAllowed, filePathAbsolute, parseSettings, serviceSettings) { | ||
const opened = serviceSettings.service.openClientFile(filePathAbsolute, parseSettings.codeFullText, | ||
/* scriptKind */ undefined, parseSettings.tsconfigRootDir); | ||
log('Project service type information enabled; checking for file path match on: %o', serviceSettings.allowDefaultProject); | ||
const opened = openClientFileAndMaybeReload(); | ||
log('Result from attempting to open client file: %o', opened); | ||
log('Default project allowed path: %s, based on config file: %s', isDefaultProjectAllowed, opened.configFileName); | ||
@@ -88,2 +88,25 @@ if (opened.configFileName) { | ||
return opened; | ||
function openClientFile() { | ||
return serviceSettings.service.openClientFile(filePathAbsolute, parseSettings.codeFullText, | ||
/* scriptKind */ undefined, parseSettings.tsconfigRootDir); | ||
} | ||
function openClientFileAndMaybeReload() { | ||
log('Opening project service client file at path: %s', filePathAbsolute); | ||
let opened = openClientFile(); | ||
// If no project included the file and we're not in single-run mode, | ||
// we might be running in an editor with outdated file info. | ||
// We can try refreshing the project service - debounced for performance. | ||
if (!opened.configFileErrors && | ||
!opened.configFileName && | ||
!parseSettings.singleRun && | ||
!isDefaultProjectAllowed && | ||
performance.now() - serviceSettings.lastReloadTimestamp > | ||
RELOAD_THROTTLE_MS) { | ||
log('No config file found; reloading project service and retrying.'); | ||
serviceSettings.service.reloadProjects(); | ||
opened = openClientFile(); | ||
serviceSettings.lastReloadTimestamp = performance.now(); | ||
} | ||
return opened; | ||
} | ||
} | ||
@@ -90,0 +113,0 @@ function createNoProgramWithProjectService(filePathAbsolute, parseSettings, service) { |
{ | ||
"name": "@typescript-eslint/typescript-estree", | ||
"version": "8.2.1-alpha.27", | ||
"version": "8.2.1-alpha.28", | ||
"description": "A parser that converts TypeScript source code into an ESTree compatible form", | ||
@@ -57,4 +57,4 @@ "files": [ | ||
"dependencies": { | ||
"@typescript-eslint/types": "8.2.1-alpha.27", | ||
"@typescript-eslint/visitor-keys": "8.2.1-alpha.27", | ||
"@typescript-eslint/types": "8.2.1-alpha.28", | ||
"@typescript-eslint/visitor-keys": "8.2.1-alpha.28", | ||
"debug": "^4.3.4", | ||
@@ -61,0 +61,0 @@ "fast-glob": "^3.3.2", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
586731
7560
+ Added@typescript-eslint/types@8.2.1-alpha.28(transitive)
+ Added@typescript-eslint/visitor-keys@8.2.1-alpha.28(transitive)
- Removed@typescript-eslint/types@8.2.1-alpha.27(transitive)
- Removed@typescript-eslint/visitor-keys@8.2.1-alpha.27(transitive)