Bug 1561435 - Fix linting errors for tools/, r=standard8
authorVictor Porof <vporof@mozilla.com>
Fri, 28 Jun 2019 22:52:16 +0200
changeset 541098 c97b04d9be60c34e87a47e591f2830a0d09273e4
parent 541097 2106cbe66fff3ea3be766493a665cd96c1475e12
child 541099 52e9f4dddabf88123eb835da03c74c0db2f90fce
push id11533
push userarchaeopteryx@coole-files.de
push dateMon, 08 Jul 2019 18:18:03 +0000
treeherdermozilla-beta@f4452e031aed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs1561435
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1561435 - Fix linting errors for tools/, r=standard8 # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D35941
tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-Date-timing.js
tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-parameters.js
tools/lint/eslint/eslint-plugin-mozilla/tests/use-default-preference-values.js
tools/profiler/tests/xpcshell/test_enterjit_osr.js
tools/profiler/tests/xpcshell/test_enterjit_osr_disabling.js
tools/profiler/tests/xpcshell/test_enterjit_osr_enabling.js
--- a/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-Date-timing.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/avoid-Date-timing.js
@@ -26,17 +26,17 @@ ruleTester.run("avoid-Date-timing", rule
     "new Date(1499790192440);",
     "new Date(2017, 7, 11);",
     "Date.UTC(2017, 7);",
   ],
   invalid: [
     invalidCode(
       "Date.now();",
       "CallExpression",
-      "use performance.now() instead of Date.now() " + "for timing measurements"
+      "use performance.now() instead of Date.now() for timing measurements"
     ),
     invalidCode(
       "new Date();",
       "NewExpression",
-      "use performance.now() instead of new Date() " + "for timing measurements"
+      "use performance.now() instead of new Date() for timing measurements"
     ),
   ],
 });
--- a/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-parameters.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/no-useless-parameters.js
@@ -101,31 +101,31 @@ ruleTester.run("no-useless-parameters", 
         "removeEventListener's third parameter can be omitted when it's" +
           " false."
       ),
     },
     {
       code: "Services.obs.addObserver(this, 'topic', false);",
       output: "Services.obs.addObserver(this, 'topic');",
       errors: callError(
-        "addObserver's third parameter can be omitted when it's" + " false."
+        "addObserver's third parameter can be omitted when it's false."
       ),
     },
     {
       code: "Services.prefs.addObserver('branch', this, false);",
       output: "Services.prefs.addObserver('branch', this);",
       errors: callError(
-        "addObserver's third parameter can be omitted when it's" + " false."
+        "addObserver's third parameter can be omitted when it's false."
       ),
     },
     {
       code: "array.appendElement(elt, false);",
       output: "array.appendElement(elt);",
       errors: callError(
-        "appendElement's second parameter can be omitted when it's" + " false."
+        "appendElement's second parameter can be omitted when it's false."
       ),
     },
     {
       code: "Services.obs.notifyObservers(obj, 'topic', null);",
       output: "Services.obs.notifyObservers(obj, 'topic');",
       errors: callError("notifyObservers's third parameter can be omitted."),
     },
     {
--- a/tools/lint/eslint/eslint-plugin-mozilla/tests/use-default-preference-values.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/tests/use-default-preference-values.js
@@ -24,18 +24,17 @@ function invalidCode(code) {
 let types = ["Bool", "Char", "Float", "Int"];
 let methods = types.map(type => "get" + type + "Pref");
 
 ruleTester.run("use-default-preference-values", rule, {
   valid: [].concat(
     methods.map(m => "blah = branch." + m + "('blah', true);"),
     methods.map(m => "blah = branch." + m + "('blah');"),
     methods.map(
-      m =>
-        "try { canThrow();" + " blah = branch." + m + "('blah'); } catch(e) {}"
+      m => "try { canThrow(); blah = branch." + m + "('blah'); } catch(e) {}"
     )
   ),
 
   invalid: [].concat(
     methods.map(m =>
       invalidCode("try { blah = branch." + m + "('blah'); } catch(e) {}")
     )
   ),
--- a/tools/profiler/tests/xpcshell/test_enterjit_osr.js
+++ b/tools/profiler/tests/xpcshell/test_enterjit_osr.js
@@ -18,16 +18,17 @@ function run_test() {
     // A frame for |arbitrary_name| has been pushed.  Do a sequence of
     // increasingly long spins until we get a sample.
     var delayMS = 5;
     while (1) {
       info("loop: ms = " + delayMS);
       const then = Date.now();
       do {
         let n = 10000;
+        // eslint-disable-next-line no-empty
         while (--n) {} // OSR happens here
         // Spin in the hope of getting a sample.
       } while (Date.now() - then < delayMS);
       let profile = Services.profiler.getProfileData().threads[0];
 
       // Go through all of the stacks, and search for this function name.
       for (const sample of profile.samples.data) {
         const stack = getInflatedStackLocations(profile, sample);
--- a/tools/profiler/tests/xpcshell/test_enterjit_osr_disabling.js
+++ b/tools/profiler/tests/xpcshell/test_enterjit_osr_disabling.js
@@ -6,13 +6,14 @@ function run_test() {
 
   Assert.ok(!Services.profiler.IsActive());
 
   Services.profiler.StartProfiler(100, 10, ["js"]);
   // The function is entered with the profiler enabled
   (function() {
     Services.profiler.StopProfiler();
     let n = 10000;
+    // eslint-disable-next-line no-empty
     while (--n) {} // OSR happens here with the profiler disabled.
     // An assertion will fail when this function returns, if the
     // profiler stack was misbalanced.
   })();
 }
--- a/tools/profiler/tests/xpcshell/test_enterjit_osr_enabling.js
+++ b/tools/profiler/tests/xpcshell/test_enterjit_osr_enabling.js
@@ -4,14 +4,15 @@ function run_test() {
   }
 
   Assert.ok(!Services.profiler.IsActive());
 
   // The function is entered with the profiler disabled.
   (function() {
     Services.profiler.StartProfiler(100, 10, ["js"]);
     let n = 10000;
+    // eslint-disable-next-line no-empty
     while (--n) {} // OSR happens here with the profiler enabled.
     // An assertion will fail when this function returns, if the
     // profiler stack was misbalanced.
   })();
   Services.profiler.StopProfiler();
 }