From ba18815372194da2abdb6946fd7fafd3c52c0330 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Wed, 19 Jul 2017 07:40:23 +1000 Subject: [PATCH] refactor(rxjs-add): Skip .d.ts files. --- source/rules/rxjsAddRule.ts | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/source/rules/rxjsAddRule.ts b/source/rules/rxjsAddRule.ts index 52fd4a1a..2c1db442 100644 --- a/source/rules/rxjsAddRule.ts +++ b/source/rules/rxjsAddRule.ts @@ -75,25 +75,28 @@ class Walker extends UsedWalker { for (let i = 0, length = sourceFiles.length; i < length; ++i) { const sourceFile = sourceFiles[i]; - const sourceFileWalker = new UsedWalker(sourceFile, { - disabledIntervals: [], - ruleArguments: [], - ruleName: this.getRuleName(), - ruleSeverity: "error" - }, program); - sourceFileWalker.walk(sourceFile); - - Object.keys(sourceFileWalker.usedObservables).forEach((key) => { - sourceFileWalker.usedObservables[key].forEach((node) => { - UsedWalker.add(usedObservables, key, node); + if (!sourceFile["isDeclarationFile"]) { + + const sourceFileWalker = new UsedWalker(sourceFile, { + disabledIntervals: [], + ruleArguments: [], + ruleName: this.getRuleName(), + ruleSeverity: "error" + }, program); + sourceFileWalker.walk(sourceFile); + + Object.keys(sourceFileWalker.usedObservables).forEach((key) => { + sourceFileWalker.usedObservables[key].forEach((node) => { + UsedWalker.add(usedObservables, key, node); + }); }); - }); - Object.keys(sourceFileWalker.usedOperators).forEach((key) => { - sourceFileWalker.usedOperators[key].forEach((node) => { - UsedWalker.add(usedOperators, key, node); + Object.keys(sourceFileWalker.usedOperators).forEach((key) => { + sourceFileWalker.usedOperators[key].forEach((node) => { + UsedWalker.add(usedOperators, key, node); + }); }); - }); + } } Object.keys(addedObservables).forEach((key) => {