Browse Source

various fix thanks to eslint

boyska 7 months ago
parent
commit
3d0ac08488
3 changed files with 9 additions and 5 deletions
  1. 3 1
      .eslintrc.json
  2. 2 2
      radiomanifest.js
  3. 4 2
      ui.js

+ 3 - 1
.eslintrc.json

@@ -9,5 +9,7 @@
     "ecmaVersion": "latest",
     "sourceType": "module"
   },
-  "rules": {}
+  "rules": {
+	  "no-unused-vars": ["error", {"argsIgnorePattern": "^_"}]
+  }
 }

+ 2 - 2
radiomanifest.js

@@ -178,7 +178,7 @@ class Radio {
 class RadioStreaming {
   constructor(sources) {
     this.sources = sources.sort(
-      (a, b) => this.getPriority(a) < this.getPriority(a),
+      (a, b) => this.getPriority(a) < this.getPriority(b),
     );
   }
 
@@ -254,7 +254,7 @@ class RadioStreaming {
  * @param {Object} options options. Currenly unused
  * @return {Radio}
  */
-async function get(siteurl, options) {
+async function get(siteurl, _options) {
   let resp = await fetch(getManifestUrl(siteurl));
   let text = await resp.text();
 

+ 4 - 2
ui.js

@@ -1,12 +1,14 @@
+/* global radiomanifest */
 // const radiomanifest = require('radiomanifest.js')
 
 function updateNow(radio) {
   var box = document.querySelector("#now-info");
   const show = radio.getSchedule().getNowShow();
+  var showText;
   try {
-    var showText = show.getName() + "\nfeed: " + show.getWebsite();
+    showText = show.getName() + "\nfeed: " + show.getWebsite();
   } catch (e) {
-    var showText = String(show);
+    showText = String(show);
   }
   var text =
     radio.getName() + " - " + radio.getDescription() + " -- " + showText;