From ef2e382ca94442a4c6ae48ace03ebd145f995217 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 7 Mar 2019 11:08:49 +0000 Subject: [PATCH 1/2] feat: add no-shadow to recommended rules --- lib/configs/recommended.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/configs/recommended.js b/lib/configs/recommended.js index 9b03e746..1fc15243 100644 --- a/lib/configs/recommended.js +++ b/lib/configs/recommended.js @@ -55,6 +55,7 @@ module.exports = { 'no-regex-spaces': 'error', 'no-return-assign': 'error', 'no-self-assign': 'error', + 'no-shadow': 'error', 'no-sparse-arrays': 'error', 'no-this-before-super': 'error', 'no-throw-literal': 'error', From 4f7207c4155cf49f36acab7fbb642d70e902690e Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 7 Mar 2019 12:27:27 +0000 Subject: [PATCH 2/2] style: fix no-shadow lint violations --- bin/flow-coverage.js | 4 ++-- lib/rules/dependency-graph.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/flow-coverage.js b/bin/flow-coverage.js index dd198e4e..65c92bc7 100755 --- a/bin/flow-coverage.js +++ b/bin/flow-coverage.js @@ -6,7 +6,7 @@ const childProcess = require('child_process') const flow = require('flow-bin') const fs = require('fs') -const path = require('path') +const {join} = require('path') const execFile = (file, args) => new Promise((resolve, reject) => { @@ -86,7 +86,7 @@ async function grepFlowFiles() { ;(async function() { let threshold = 0 - const packageJsonPath = path.join(process.cwd(), 'package.json') + const packageJsonPath = join(process.cwd(), 'package.json') if (fs.existsSync(packageJsonPath)) { const packageJson = require(packageJsonPath) threshold = (packageJson.flow && packageJson.flow.coverageThreshold) || 0 diff --git a/lib/rules/dependency-graph.js b/lib/rules/dependency-graph.js index c67b5185..e8304776 100644 --- a/lib/rules/dependency-graph.js +++ b/lib/rules/dependency-graph.js @@ -19,11 +19,11 @@ module.exports = { checkEntriesWhitelist(filename) - function recordImport(filename, symbol) { - let symbols = imports.get(filename) + function recordImport(importPath, symbol) { + let symbols = imports.get(importPath) if (!symbols) { symbols = new Set() - imports.set(filename, symbols) + imports.set(importPath, symbols) } if (symbol) {