Add eslint semi rule

This commit is contained in:
rejas 2019-06-05 10:23:58 +02:00
parent 2bce15dc6e
commit 835668d96d
24 changed files with 39 additions and 38 deletions

View File

@ -2,6 +2,7 @@
"rules": {
"indent": ["error", "tab"],
"quotes": ["error", "double"],
"semi": ["error"],
"max-len": ["error", 250],
"curly": "error",
"camelcase": ["error", {"properties": "never"}],

View File

@ -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

View File

@ -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) {

View File

@ -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.<br>This way we can keep track of all the contributions.")
warn("Please include an updated `CHANGELOG.md` file.<br>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.<br>Pull requests on the `master` branch will not be accepted.")
fail("Please send all your pull requests to the `develop` branch.<br>Pull requests on the `master` branch will not be accepted.");
}
}

View File

@ -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.

View File

@ -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;

View File

@ -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) {

View File

@ -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 + ")";

View File

@ -37,7 +37,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
if(auth.method === "bearer"){
opts.auth = {
bearer: auth.pass
}
};
} else {
opts.auth = {

View File

@ -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.

View File

@ -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 {

View File

@ -15,10 +15,10 @@ Module.register("helloworld",{
},
getTemplate: function () {
return "helloworld.njk"
return "helloworld.njk";
},
getTemplateData: function () {
return this.config
return this.config;
}
});

View File

@ -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) {

View File

@ -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);
}

View File

@ -79,7 +79,7 @@ module.exports = NodeHelper.create({
scheduleNextFetch: function(delay) {
if (delay < 60 * 1000) {
delay = 60 * 1000
delay = 60 * 1000;
}
var self = this;

View File

@ -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;

View File

@ -111,12 +111,12 @@ var WeatherProvider = Class.extend({
if (this.status === 200) {
resolve(JSON.parse(this.response));
} else {
reject(request)
reject(request);
}
}
};
request.send();
})
});
}
});

View File

@ -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++) {

View File

@ -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 () {

View File

@ -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",

View File

@ -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 () {

View File

@ -121,7 +121,7 @@ describe("Translations", function() {
throw e;
}
}
})
});
});
}
});

View File

@ -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 () {

View File

@ -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 () {