Repository: eslint/eslint
Pull request #10579 (2018-07-08 22:56:08)

Chore: Move lib/logging and lib/timing to lib/util/ (refs #10559)
<!--
    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
-->

**What is the purpose of this pull request? (put an "X" next to item)**

[ ] Documentation update
[ ] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/bug-report.md))
[ ] New rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-proposal.md))
[ ] Changes an existing rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-change-proposal.md))
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain: Moving two modules under `lib/` to `lib/util/`.

Refs #10559.

<!--
    If the item you've checked above has a template, please paste the template questions below and answer them. (If this pull request is addressing an issue, you can just paste a link to the issue here instead.)
-->

<!--
    Please ensure your pull request is ready:

    - Read the pull request guide (https://eslint.org/docs/developer-guide/contributing/pull-requests)
    - Include tests for this change
    - Update documentation for this change (if appropriate)
-->

<!--
    The following is required for all pull requests:
-->

**What changes did you make? (Give an overview)**

Moved lib/logging.js to lib/util/logging.js, and moved lib/timing.js to lib/util/timing.js. This is to try to make the codebase a little more organized by having only key strategic modules directly under lib/.

**Is there anything you'd like reviewers to focus on?**

Not really.


Patch:
diff --git a/lib/cli.js b/lib/cli.js
index 1bd3c52eb..f854015fe 100644
--- a/lib/cli.js
+++ b/lib/cli.js
@@ -20,7 +20,7 @@ const fs = require("fs"),
     options = require("./options"),
     CLIEngine = require("./cli-engine"),
     mkdirp = require("mkdirp"),
-    log = require("./logging");
+    log = require("./util/logging");
 
 const debug = require("debug")("eslint:cli");
 
diff --git a/lib/config/config-initializer.js b/lib/config/config-initializer.js
index b090d36b5..4273abae5 100644
--- a/lib/config/config-initializer.js
+++ b/lib/config/config-initializer.js
@@ -20,7 +20,7 @@ const util = require("util"),
     ModuleResolver = require("../util/module-resolver"),
     npmUtil = require("../util/npm-util"),
     recConfig = require("../../conf/eslint-recommended"),
-    log = require("../logging");
+    log = require("../util/logging");
 
 const debug = require("debug")("eslint:config-initializer");
 
diff --git a/lib/linter.js b/lib/linter.js
index e48c4d7a9..faf7654cd 100644
--- a/lib/linter.js
+++ b/lib/linter.js
@@ -24,7 +24,7 @@ const eslintScope = require("eslint-scope"),
     Traverser = require("./util/traverser"),
     createReportTranslator = require("./report-translator"),
     Rules = require("./rules"),
-    timing = require("./timing"),
+    timing = require("./util/timing"),
     astUtils = require("./ast-utils"),
     pkg = require("../package.json"),
     SourceCodeFixer = require("./util/source-code-fixer");
diff --git a/lib/logging.js b/lib/util/logging.js
similarity index 100%
rename from lib/logging.js
rename to lib/util/logging.js
diff --git a/lib/util/npm-util.js b/lib/util/npm-util.js
index 97aabde7b..ddf8f24cc 100644
--- a/lib/util/npm-util.js
+++ b/lib/util/npm-util.js
@@ -12,7 +12,7 @@
 const fs = require("fs"),
     spawn = require("cross-spawn"),
     path = require("path"),
-    log = require("../logging");
+    log = require("./logging");
 
 //------------------------------------------------------------------------------
 // Helpers


Test patch:
diff --git a/lib/timing.js b/lib/util/timing.js
similarity index 100%
rename from lib/timing.js
rename to lib/util/timing.js
diff --git a/tests/lib/cli.js b/tests/lib/cli.js
index 53e80ba43..9824edbad 100644
--- a/tests/lib/cli.js
+++ b/tests/lib/cli.js
@@ -37,7 +37,7 @@ describe("cli", () => {
         error: sinon.spy()
     };
     const cli = proxyquire("../../lib/cli", {
-        "./logging": log
+        "./util/logging": log
     });
 
     /**
@@ -58,7 +58,7 @@ describe("cli", () => {
 
         const localCLI = proxyquire("../../lib/cli", {
             "./cli-engine": fakeCLIEngine,
-            "./logging": log
+            "./util/logging": log
         });
 
         localCLI.execute(cmd);
@@ -697,7 +697,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             localCLI.execute("--no-inline-config .");
@@ -719,7 +719,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute(".");
@@ -755,7 +755,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix .");
@@ -791,7 +791,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix .");
@@ -828,7 +828,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix --quiet .");
@@ -844,7 +844,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix .", "foo = bar;");
@@ -878,7 +878,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix-dry-run .");
@@ -914,7 +914,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix-dry-run .");
@@ -951,7 +951,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix-dry-run --quiet .");
@@ -987,7 +987,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix-dry-run .", "foo = bar;");
@@ -1002,7 +1002,7 @@ describe("cli", () => {
 
             localCLI = proxyquire("../../lib/cli", {
                 "./cli-engine": fakeCLIEngine,
-                "./logging": log
+                "./util/logging": log
             });
 
             const exitCode = localCLI.execute("--fix --fix-dry-run .", "foo = bar;");
diff --git a/tests/lib/config/config-initializer.js b/tests/lib/config/config-initializer.js
index ac8a7dd6f..91cc6476b 100644
--- a/tests/lib/config/config-initializer.js
+++ b/tests/lib/config/config-initializer.js
@@ -41,7 +41,7 @@ describe("configInitializer", () => {
         error: sinon.spy()
     };
     const requireStubs = {
-        "../logging": log,
+        "../util/logging": log,
         "../util/module-resolver": class ModuleResolver {
 
             /**
diff --git a/tests/lib/util/npm-util.js b/tests/lib/util/npm-util.js
index 48b0b0c97..b0237c464 100644
--- a/tests/lib/util/npm-util.js
+++ b/tests/lib/util/npm-util.js
@@ -12,7 +12,7 @@ const assert = require("chai").assert,
     spawn = require("cross-spawn"),
     sinon = require("sinon"),
     npmUtil = require("../../../lib/util/npm-util"),
-    log = require("../../../lib/logging"),
+    log = require("../../../lib/util/logging"),
     mockFs = require("mock-fs");
 
 //------------------------------------------------------------------------------