Skip to content
Permalink
Browse files

fix(typescript-estree): only call watch callback on new files (#367)

  • Loading branch information...
uniqueiniquity authored and James Henry committed Mar 19, 2019
1 parent 3b28cac commit 0ef07c4075049018e93592931439757ccc4cf0d0
Showing with 6 additions and 2 deletions.
  1. +2 −1 .eslintrc.json
  2. +4 −1 packages/typescript-estree/src/tsconfig-parser.ts
@@ -25,7 +25,8 @@
"sourceType": "module",
"ecmaFeatures": {
"jsx": false
}
},
"project": "./tsconfig.base.json"
},
"overrides": [
{
@@ -28,6 +28,8 @@ const knownWatchProgramMap = new Map<
*/
const watchCallbackTrackingMap = new Map<string, ts.FileWatcherCallback>();

const parsedFilesSeen = new Set<string>();

/**
* Holds information about the file currently being linted
*/
@@ -71,7 +73,7 @@ export function calculateProjectParserOptions(
// Update file version if necessary
// TODO: only update when necessary, currently marks as changed on every lint
const watchCallback = watchCallbackTrackingMap.get(filePath);
if (typeof watchCallback !== 'undefined') {
if (parsedFilesSeen.has(filePath) && typeof watchCallback !== 'undefined') {
watchCallback(filePath, ts.FileWatcherEventKind.Changed);
}

@@ -174,6 +176,7 @@ export function calculateProjectParserOptions(
results.push(program);
}

parsedFilesSeen.add(filePath);
return results;
}

0 comments on commit 0ef07c4

Please sign in to comment.
You can’t perform that action at this time.