diff --git a/.eslintrc.json b/.eslintrc.json index 7390c3b7..16be57c8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,6 +2,7 @@ "rules": { "indent": ["error", "tab"], "quotes": ["error", "double"], + "semi": ["error"], "max-len": ["error", 250], "curly": "error", "camelcase": ["error", {"properties": "never"}], diff --git a/CHANGELOG.md b/CHANGELOG.md index 36aff1e8..b7fd09e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,7 +29,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Allowance HTML5 autoplay-policy (policy is changed from Chrome 66 updates) - Handle SIGTERM messages - Fixes sliceMultiDayEvents so it respects maximumNumberOfDays -- Fix typos and small syntax errors, cleanup dependencies, remove multiple-empty-lines +- Fix typos and small syntax errors, cleanup dependencies, remove multiple-empty-lines, add semi-rule ## [2.7.1] - 2019-04-02 diff --git a/clientonly/index.js b/clientonly/index.js index 63ac0ea0..895dacae 100644 --- a/clientonly/index.js +++ b/clientonly/index.js @@ -19,7 +19,7 @@ // Prefer command line arguments over environment variables ["address", "port"].forEach((key) => { config[key] = getCommandLineParameter(key, process.env[key.toUpperCase()]); - }) + }); } function getServerConfig(url) { @@ -43,7 +43,7 @@ request.on("error", function(error) { reject(new Error(`Unable to read config from server (${url} (${error.message}`)); }); - }) + }); } function fail(message, code = 1) { diff --git a/dangerfile.js b/dangerfile.js index 1cbe69db..6920cad9 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -1,9 +1,9 @@ -import { danger, fail, warn } from "danger" +import { danger, fail, warn } from "danger"; // Check if the CHANGELOG.md file has been edited // Fail the build and post a comment reminding submitters to do so if it wasn't changed if (!danger.git.modified_files.includes("CHANGELOG.md")) { - warn("Please include an updated `CHANGELOG.md` file.
This way we can keep track of all the contributions.") + warn("Please include an updated `CHANGELOG.md` file.
This way we can keep track of all the contributions."); } // Check if the PR request is send to the master branch. @@ -12,6 +12,6 @@ if (danger.github.pr.base.ref === "master" && danger.github.pr.user.login !== "M // Check if the PR body or title includes the text: #accepted. // If not, the PR will fail. if ((danger.github.pr.body + danger.github.pr.title).includes("#accepted")) { - fail("Please send all your pull requests to the `develop` branch.
Pull requests on the `master` branch will not be accepted.") + fail("Please send all your pull requests to the `develop` branch.
Pull requests on the `master` branch will not be accepted."); } -} \ No newline at end of file +} diff --git a/js/app.js b/js/app.js index c059bef6..78f0c847 100644 --- a/js/app.js +++ b/js/app.js @@ -95,7 +95,7 @@ var App = function() { ". Check README and CHANGELOG for more up-to-date ways of getting the same functionality.") ); } - } + }; /* loadModule(module) * Loads a specific module. diff --git a/js/module.js b/js/module.js index 8ddcda7d..62bf80ce 100644 --- a/js/module.js +++ b/js/module.js @@ -92,7 +92,7 @@ var Module = Class.extend({ // the template is a filename self.nunjucksEnvironment().render(template, templateData, function (err, res) { if (err) { - Log.error(err) + Log.error(err); } div.innerHTML = res; @@ -138,7 +138,7 @@ var Module = Class.extend({ * return Object */ getTemplateData: function () { - return {} + return {}; }, /* notificationReceived(notification, payload, sender) @@ -175,7 +175,7 @@ var Module = Class.extend({ lstripBlocks: true }); this._nunjucksEnvironment.addFilter("translate", function(str) { - return self.translate(str) + return self.translate(str); }); return this._nunjucksEnvironment; diff --git a/js/server.js b/js/server.js index ec899216..2e6e530a 100644 --- a/js/server.js +++ b/js/server.js @@ -27,7 +27,7 @@ var Server = function(config, callback) { server.listen(port, config.address ? config.address : null); if (config.ipWhitelist instanceof Array && config.ipWhitelist.length === 0) { - console.info(Utils.colors.warn("You're using a full whitelist configuration to allow for all IPs")) + console.info(Utils.colors.warn("You're using a full whitelist configuration to allow for all IPs")); } app.use(function(req, res, next) { diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index f27864e2..dc95a3ba 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -105,7 +105,7 @@ Module.register("calendar", { calendar.auth = { user: calendar.user, pass: calendar.pass - } + }; } this.addCalendar(calendar.url, calendar.auth, calendarConfig); @@ -498,7 +498,7 @@ Module.register("calendar", { var midnight = moment(event.startDate, "x").clone().startOf("day").add(1, "day").format("x"); var count = 1; while (event.endDate > midnight) { - var thisEvent = JSON.parse(JSON.stringify(event)) // clone object + var thisEvent = JSON.parse(JSON.stringify(event)); // clone object thisEvent.today = thisEvent.startDate >= today && thisEvent.startDate < (today + 24 * 60 * 60 * 1000); thisEvent.endDate = midnight; thisEvent.title += " (" + count + "/" + maxCount + ")"; diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 882577bc..a57b614a 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -37,7 +37,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri if(auth.method === "bearer"){ opts.auth = { bearer: auth.pass - } + }; } else { opts.auth = { diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 5b796dcf..6e19f6fe 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -65,12 +65,12 @@ Module.register("clock",{ var timeWrapper = document.createElement("div"); var secondsWrapper = document.createElement("sup"); var periodWrapper = document.createElement("span"); - var weekWrapper = document.createElement("div") + var weekWrapper = document.createElement("div"); // Style Wrappers dateWrapper.className = "date normal medium"; timeWrapper.className = "time bright large light"; secondsWrapper.className = "dimmed"; - weekWrapper.className = "week dimmed medium" + weekWrapper.className = "week dimmed medium"; // Set content of wrappers. // The moment().format("h") method has a bug on the Raspberry Pi. diff --git a/modules/default/currentweather/currentweather.js b/modules/default/currentweather/currentweather.js index 2ccc23b7..7b5554c5 100644 --- a/modules/default/currentweather/currentweather.js +++ b/modules/default/currentweather/currentweather.js @@ -353,7 +353,7 @@ Module.register("currentweather",{ } else if(this.config.location) { params += "q=" + this.config.location; } else if (this.firstEvent && this.firstEvent.geo) { - params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon + params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon; } else if (this.firstEvent && this.firstEvent.location) { params += "q=" + this.firstEvent.location; } else { diff --git a/modules/default/helloworld/helloworld.js b/modules/default/helloworld/helloworld.js index a1fb9d7d..cf6cebfa 100644 --- a/modules/default/helloworld/helloworld.js +++ b/modules/default/helloworld/helloworld.js @@ -15,10 +15,10 @@ Module.register("helloworld",{ }, getTemplate: function () { - return "helloworld.njk" + return "helloworld.njk"; }, getTemplateData: function () { - return this.config + return this.config; } }); diff --git a/modules/default/newsfeed/fetcher.js b/modules/default/newsfeed/fetcher.js index 17e973fd..4e3bcca7 100644 --- a/modules/default/newsfeed/fetcher.js +++ b/modules/default/newsfeed/fetcher.js @@ -84,7 +84,7 @@ var Fetcher = function(url, reloadInterval, encoding, logFeedWarnings) { nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]); headers = {"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)", "Cache-Control": "max-age=0, no-cache, no-store, must-revalidate", - "Pragma": "no-cache"} + "Pragma": "no-cache"}; request({uri: url, encoding: null, headers: headers}) .on("error", function(error) { diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index 3bb38d0a..afad4c8f 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -189,7 +189,7 @@ Module.register("newsfeed",{ fullArticle.style.top = "0"; fullArticle.style.left = "0"; fullArticle.style.border = "none"; - fullArticle.src = this.getActiveItemURL() + fullArticle.src = this.getActiveItemURL(); fullArticle.style.zIndex = 1; wrapper.appendChild(fullArticle); } @@ -398,7 +398,7 @@ Module.register("newsfeed",{ date: this.newsItems[this.activeItem].pubdate, desc: this.newsItems[this.activeItem].description, url: this.getActiveItemURL() - }) + }); } else { Log.info(this.name + " - unknown notification, ignoring: " + notification); } diff --git a/modules/default/updatenotification/node_helper.js b/modules/default/updatenotification/node_helper.js index f4014519..2445daff 100644 --- a/modules/default/updatenotification/node_helper.js +++ b/modules/default/updatenotification/node_helper.js @@ -79,7 +79,7 @@ module.exports = NodeHelper.create({ scheduleNextFetch: function(delay) { if (delay < 60 * 1000) { - delay = 60 * 1000 + delay = 60 * 1000; } var self = this; diff --git a/modules/default/weather/weather.js b/modules/default/weather/weather.js index 097b1437..dcbbab7f 100644 --- a/modules/default/weather/weather.js +++ b/modules/default/weather/weather.js @@ -137,7 +137,7 @@ Module.register("weather",{ humidity: this.indoorHumidity, temperature: this.indoorTemperature } - } + }; }, // What to do when the weather provider has new information available? @@ -207,7 +207,7 @@ Module.register("weather",{ value = `${value.toFixed(2)} ${this.config.units === "imperial" ? "in" : "mm"}`; } } else if (type === "humidity") { - value += "%" + value += "%"; } return value; diff --git a/modules/default/weather/weatherprovider.js b/modules/default/weather/weatherprovider.js index ba3e9188..8940763a 100644 --- a/modules/default/weather/weatherprovider.js +++ b/modules/default/weather/weatherprovider.js @@ -111,12 +111,12 @@ var WeatherProvider = Class.extend({ if (this.status === 200) { resolve(JSON.parse(this.response)); } else { - reject(request) + reject(request); } } }; request.send(); - }) + }); } }); diff --git a/modules/default/weatherforecast/weatherforecast.js b/modules/default/weatherforecast/weatherforecast.js index 89f34a6b..b6b57d8c 100644 --- a/modules/default/weatherforecast/weatherforecast.js +++ b/modules/default/weatherforecast/weatherforecast.js @@ -291,7 +291,7 @@ Module.register("weatherforecast",{ } else if(this.config.location) { params += "q=" + this.config.location; } else if (this.firstEvent && this.firstEvent.geo) { - params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon + params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon; } else if (this.firstEvent && this.firstEvent.location) { params += "q=" + this.firstEvent.location; } else { @@ -315,7 +315,7 @@ Module.register("weatherforecast",{ */ parserDataWeather: function(data) { if (data.hasOwnProperty("main")) { - data["temp"] = {"min": data.main.temp_min, "max": data.main.temp_max} + data["temp"] = {"min": data.main.temp_min, "max": data.main.temp_max}; } return data; }, @@ -330,7 +330,7 @@ Module.register("weatherforecast",{ this.forecast = []; var lastDay = null; - var forecastData = {} + var forecastData = {}; for (var i = 0, count = data.list.length; i < count; i++) { diff --git a/tests/e2e/ipWhistlist_spec.js b/tests/e2e/ipWhistlist_spec.js index e109e72d..c544465e 100644 --- a/tests/e2e/ipWhistlist_spec.js +++ b/tests/e2e/ipWhistlist_spec.js @@ -15,7 +15,7 @@ describe("ipWhitelist directive configuration", function () { beforeEach(function () { return helpers.startApplication({ args: ["js/electron.js"] - }).then(function (startedApp) { app = startedApp; }) + }).then(function (startedApp) { app = startedApp; }); }); afterEach(function () { diff --git a/tests/e2e/modules_position_spec.js b/tests/e2e/modules_position_spec.js index 8bbcffae..40399680 100644 --- a/tests/e2e/modules_position_spec.js +++ b/tests/e2e/modules_position_spec.js @@ -19,7 +19,7 @@ describe("Position of modules", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/positions.js"; return helpers.startApplication({ args: ["js/electron.js"] - }).then(function (startedApp) { app = startedApp; }) + }).then(function (startedApp) { app = startedApp; }); }); var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third", diff --git a/tests/e2e/port_config.js b/tests/e2e/port_config.js index 99bf04d0..41f50e75 100644 --- a/tests/e2e/port_config.js +++ b/tests/e2e/port_config.js @@ -15,7 +15,7 @@ describe("port directive configuration", function () { beforeEach(function () { return helpers.startApplication({ args: ["js/electron.js"] - }).then(function (startedApp) { app = startedApp; }) + }).then(function (startedApp) { app = startedApp; }); }); afterEach(function () { diff --git a/tests/e2e/translations_spec.js b/tests/e2e/translations_spec.js index 06866e8c..e589689e 100644 --- a/tests/e2e/translations_spec.js +++ b/tests/e2e/translations_spec.js @@ -121,7 +121,7 @@ describe("Translations", function() { throw e; } } - }) + }); }); } }); diff --git a/tests/e2e/vendor_spec.js b/tests/e2e/vendor_spec.js index 91c92921..c58c0ce3 100644 --- a/tests/e2e/vendor_spec.js +++ b/tests/e2e/vendor_spec.js @@ -18,7 +18,7 @@ describe("Vendors", function () { before(function () { return helpers.startApplication({ args: ["js/electron.js"] - }).then(function (startedApp) { app = startedApp; }) + }).then(function (startedApp) { app = startedApp; }); }); after(function () { diff --git a/tests/e2e/without_modules.js b/tests/e2e/without_modules.js index 39cce753..9726cc01 100644 --- a/tests/e2e/without_modules.js +++ b/tests/e2e/without_modules.js @@ -13,7 +13,7 @@ describe("Check configuration without modules", function () { beforeEach(function () { return helpers.startApplication({ args: ["js/electron.js"] - }).then(function (startedApp) { app = startedApp; }) + }).then(function (startedApp) { app = startedApp; }); }); afterEach(function () { @@ -27,7 +27,7 @@ describe("Check configuration without modules", function () { it("Show the message MagicMirror title", function () { return app.client.waitUntilWindowLoaded() - .getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2") + .getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2"); }); it("Show the text Michael's website", function () {