mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Add eslint semi rule
This commit is contained in:
parent
2bce15dc6e
commit
835668d96d
@ -2,6 +2,7 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"indent": ["error", "tab"],
|
"indent": ["error", "tab"],
|
||||||
"quotes": ["error", "double"],
|
"quotes": ["error", "double"],
|
||||||
|
"semi": ["error"],
|
||||||
"max-len": ["error", 250],
|
"max-len": ["error", 250],
|
||||||
"curly": "error",
|
"curly": "error",
|
||||||
"camelcase": ["error", {"properties": "never"}],
|
"camelcase": ["error", {"properties": "never"}],
|
||||||
|
@ -29,7 +29,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Allowance HTML5 autoplay-policy (policy is changed from Chrome 66 updates)
|
- Allowance HTML5 autoplay-policy (policy is changed from Chrome 66 updates)
|
||||||
- Handle SIGTERM messages
|
- Handle SIGTERM messages
|
||||||
- Fixes sliceMultiDayEvents so it respects maximumNumberOfDays
|
- 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
|
## [2.7.1] - 2019-04-02
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// Prefer command line arguments over environment variables
|
// Prefer command line arguments over environment variables
|
||||||
["address", "port"].forEach((key) => {
|
["address", "port"].forEach((key) => {
|
||||||
config[key] = getCommandLineParameter(key, process.env[key.toUpperCase()]);
|
config[key] = getCommandLineParameter(key, process.env[key.toUpperCase()]);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getServerConfig(url) {
|
function getServerConfig(url) {
|
||||||
@ -43,7 +43,7 @@
|
|||||||
request.on("error", function(error) {
|
request.on("error", function(error) {
|
||||||
reject(new Error(`Unable to read config from server (${url} (${error.message}`));
|
reject(new Error(`Unable to read config from server (${url} (${error.message}`));
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function fail(message, code = 1) {
|
function fail(message, code = 1) {
|
||||||
|
@ -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
|
// 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
|
// 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")) {
|
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.
|
// 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.
|
// Check if the PR body or title includes the text: #accepted.
|
||||||
// If not, the PR will fail.
|
// If not, the PR will fail.
|
||||||
if ((danger.github.pr.body + danger.github.pr.title).includes("#accepted")) {
|
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -95,7 +95,7 @@ var App = function() {
|
|||||||
". Check README and CHANGELOG for more up-to-date ways of getting the same functionality.")
|
". Check README and CHANGELOG for more up-to-date ways of getting the same functionality.")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/* loadModule(module)
|
/* loadModule(module)
|
||||||
* Loads a specific module.
|
* Loads a specific module.
|
||||||
|
@ -92,7 +92,7 @@ var Module = Class.extend({
|
|||||||
// the template is a filename
|
// the template is a filename
|
||||||
self.nunjucksEnvironment().render(template, templateData, function (err, res) {
|
self.nunjucksEnvironment().render(template, templateData, function (err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
Log.error(err)
|
Log.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.innerHTML = res;
|
div.innerHTML = res;
|
||||||
@ -138,7 +138,7 @@ var Module = Class.extend({
|
|||||||
* return Object
|
* return Object
|
||||||
*/
|
*/
|
||||||
getTemplateData: function () {
|
getTemplateData: function () {
|
||||||
return {}
|
return {};
|
||||||
},
|
},
|
||||||
|
|
||||||
/* notificationReceived(notification, payload, sender)
|
/* notificationReceived(notification, payload, sender)
|
||||||
@ -175,7 +175,7 @@ var Module = Class.extend({
|
|||||||
lstripBlocks: true
|
lstripBlocks: true
|
||||||
});
|
});
|
||||||
this._nunjucksEnvironment.addFilter("translate", function(str) {
|
this._nunjucksEnvironment.addFilter("translate", function(str) {
|
||||||
return self.translate(str)
|
return self.translate(str);
|
||||||
});
|
});
|
||||||
|
|
||||||
return this._nunjucksEnvironment;
|
return this._nunjucksEnvironment;
|
||||||
|
@ -27,7 +27,7 @@ var Server = function(config, callback) {
|
|||||||
server.listen(port, config.address ? config.address : null);
|
server.listen(port, config.address ? config.address : null);
|
||||||
|
|
||||||
if (config.ipWhitelist instanceof Array && config.ipWhitelist.length === 0) {
|
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) {
|
app.use(function(req, res, next) {
|
||||||
|
@ -105,7 +105,7 @@ Module.register("calendar", {
|
|||||||
calendar.auth = {
|
calendar.auth = {
|
||||||
user: calendar.user,
|
user: calendar.user,
|
||||||
pass: calendar.pass
|
pass: calendar.pass
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addCalendar(calendar.url, calendar.auth, calendarConfig);
|
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 midnight = moment(event.startDate, "x").clone().startOf("day").add(1, "day").format("x");
|
||||||
var count = 1;
|
var count = 1;
|
||||||
while (event.endDate > midnight) {
|
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.today = thisEvent.startDate >= today && thisEvent.startDate < (today + 24 * 60 * 60 * 1000);
|
||||||
thisEvent.endDate = midnight;
|
thisEvent.endDate = midnight;
|
||||||
thisEvent.title += " (" + count + "/" + maxCount + ")";
|
thisEvent.title += " (" + count + "/" + maxCount + ")";
|
||||||
|
@ -37,7 +37,7 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
|
|||||||
if(auth.method === "bearer"){
|
if(auth.method === "bearer"){
|
||||||
opts.auth = {
|
opts.auth = {
|
||||||
bearer: auth.pass
|
bearer: auth.pass
|
||||||
}
|
};
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
opts.auth = {
|
opts.auth = {
|
||||||
|
@ -65,12 +65,12 @@ Module.register("clock",{
|
|||||||
var timeWrapper = document.createElement("div");
|
var timeWrapper = document.createElement("div");
|
||||||
var secondsWrapper = document.createElement("sup");
|
var secondsWrapper = document.createElement("sup");
|
||||||
var periodWrapper = document.createElement("span");
|
var periodWrapper = document.createElement("span");
|
||||||
var weekWrapper = document.createElement("div")
|
var weekWrapper = document.createElement("div");
|
||||||
// Style Wrappers
|
// Style Wrappers
|
||||||
dateWrapper.className = "date normal medium";
|
dateWrapper.className = "date normal medium";
|
||||||
timeWrapper.className = "time bright large light";
|
timeWrapper.className = "time bright large light";
|
||||||
secondsWrapper.className = "dimmed";
|
secondsWrapper.className = "dimmed";
|
||||||
weekWrapper.className = "week dimmed medium"
|
weekWrapper.className = "week dimmed medium";
|
||||||
|
|
||||||
// Set content of wrappers.
|
// Set content of wrappers.
|
||||||
// The moment().format("h") method has a bug on the Raspberry Pi.
|
// The moment().format("h") method has a bug on the Raspberry Pi.
|
||||||
|
@ -353,7 +353,7 @@ Module.register("currentweather",{
|
|||||||
} else if(this.config.location) {
|
} else if(this.config.location) {
|
||||||
params += "q=" + this.config.location;
|
params += "q=" + this.config.location;
|
||||||
} else if (this.firstEvent && this.firstEvent.geo) {
|
} 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) {
|
} else if (this.firstEvent && this.firstEvent.location) {
|
||||||
params += "q=" + this.firstEvent.location;
|
params += "q=" + this.firstEvent.location;
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,10 +15,10 @@ Module.register("helloworld",{
|
|||||||
},
|
},
|
||||||
|
|
||||||
getTemplate: function () {
|
getTemplate: function () {
|
||||||
return "helloworld.njk"
|
return "helloworld.njk";
|
||||||
},
|
},
|
||||||
|
|
||||||
getTemplateData: function () {
|
getTemplateData: function () {
|
||||||
return this.config
|
return this.config;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -84,7 +84,7 @@ var Fetcher = function(url, reloadInterval, encoding, logFeedWarnings) {
|
|||||||
nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
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/)",
|
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",
|
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
|
||||||
"Pragma": "no-cache"}
|
"Pragma": "no-cache"};
|
||||||
|
|
||||||
request({uri: url, encoding: null, headers: headers})
|
request({uri: url, encoding: null, headers: headers})
|
||||||
.on("error", function(error) {
|
.on("error", function(error) {
|
||||||
|
@ -189,7 +189,7 @@ Module.register("newsfeed",{
|
|||||||
fullArticle.style.top = "0";
|
fullArticle.style.top = "0";
|
||||||
fullArticle.style.left = "0";
|
fullArticle.style.left = "0";
|
||||||
fullArticle.style.border = "none";
|
fullArticle.style.border = "none";
|
||||||
fullArticle.src = this.getActiveItemURL()
|
fullArticle.src = this.getActiveItemURL();
|
||||||
fullArticle.style.zIndex = 1;
|
fullArticle.style.zIndex = 1;
|
||||||
wrapper.appendChild(fullArticle);
|
wrapper.appendChild(fullArticle);
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ Module.register("newsfeed",{
|
|||||||
date: this.newsItems[this.activeItem].pubdate,
|
date: this.newsItems[this.activeItem].pubdate,
|
||||||
desc: this.newsItems[this.activeItem].description,
|
desc: this.newsItems[this.activeItem].description,
|
||||||
url: this.getActiveItemURL()
|
url: this.getActiveItemURL()
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
Log.info(this.name + " - unknown notification, ignoring: " + notification);
|
Log.info(this.name + " - unknown notification, ignoring: " + notification);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ module.exports = NodeHelper.create({
|
|||||||
|
|
||||||
scheduleNextFetch: function(delay) {
|
scheduleNextFetch: function(delay) {
|
||||||
if (delay < 60 * 1000) {
|
if (delay < 60 * 1000) {
|
||||||
delay = 60 * 1000
|
delay = 60 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -137,7 +137,7 @@ Module.register("weather",{
|
|||||||
humidity: this.indoorHumidity,
|
humidity: this.indoorHumidity,
|
||||||
temperature: this.indoorTemperature
|
temperature: this.indoorTemperature
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
// What to do when the weather provider has new information available?
|
// 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"}`;
|
value = `${value.toFixed(2)} ${this.config.units === "imperial" ? "in" : "mm"}`;
|
||||||
}
|
}
|
||||||
} else if (type === "humidity") {
|
} else if (type === "humidity") {
|
||||||
value += "%"
|
value += "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
@ -111,12 +111,12 @@ var WeatherProvider = Class.extend({
|
|||||||
if (this.status === 200) {
|
if (this.status === 200) {
|
||||||
resolve(JSON.parse(this.response));
|
resolve(JSON.parse(this.response));
|
||||||
} else {
|
} else {
|
||||||
reject(request)
|
reject(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
request.send();
|
request.send();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ Module.register("weatherforecast",{
|
|||||||
} else if(this.config.location) {
|
} else if(this.config.location) {
|
||||||
params += "q=" + this.config.location;
|
params += "q=" + this.config.location;
|
||||||
} else if (this.firstEvent && this.firstEvent.geo) {
|
} 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) {
|
} else if (this.firstEvent && this.firstEvent.location) {
|
||||||
params += "q=" + this.firstEvent.location;
|
params += "q=" + this.firstEvent.location;
|
||||||
} else {
|
} else {
|
||||||
@ -315,7 +315,7 @@ Module.register("weatherforecast",{
|
|||||||
*/
|
*/
|
||||||
parserDataWeather: function(data) {
|
parserDataWeather: function(data) {
|
||||||
if (data.hasOwnProperty("main")) {
|
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;
|
return data;
|
||||||
},
|
},
|
||||||
@ -330,7 +330,7 @@ Module.register("weatherforecast",{
|
|||||||
|
|
||||||
this.forecast = [];
|
this.forecast = [];
|
||||||
var lastDay = null;
|
var lastDay = null;
|
||||||
var forecastData = {}
|
var forecastData = {};
|
||||||
|
|
||||||
for (var i = 0, count = data.list.length; i < count; i++) {
|
for (var i = 0, count = data.list.length; i < count; i++) {
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ describe("ipWhitelist directive configuration", function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
return helpers.startApplication({
|
return helpers.startApplication({
|
||||||
args: ["js/electron.js"]
|
args: ["js/electron.js"]
|
||||||
}).then(function (startedApp) { app = startedApp; })
|
}).then(function (startedApp) { app = startedApp; });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
@ -19,7 +19,7 @@ describe("Position of modules", function () {
|
|||||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/positions.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/positions.js";
|
||||||
return helpers.startApplication({
|
return helpers.startApplication({
|
||||||
args: ["js/electron.js"]
|
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",
|
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
|
||||||
|
@ -15,7 +15,7 @@ describe("port directive configuration", function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
return helpers.startApplication({
|
return helpers.startApplication({
|
||||||
args: ["js/electron.js"]
|
args: ["js/electron.js"]
|
||||||
}).then(function (startedApp) { app = startedApp; })
|
}).then(function (startedApp) { app = startedApp; });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
|
@ -121,7 +121,7 @@ describe("Translations", function() {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@ describe("Vendors", function () {
|
|||||||
before(function () {
|
before(function () {
|
||||||
return helpers.startApplication({
|
return helpers.startApplication({
|
||||||
args: ["js/electron.js"]
|
args: ["js/electron.js"]
|
||||||
}).then(function (startedApp) { app = startedApp; })
|
}).then(function (startedApp) { app = startedApp; });
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function () {
|
after(function () {
|
||||||
|
@ -13,7 +13,7 @@ describe("Check configuration without modules", function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
return helpers.startApplication({
|
return helpers.startApplication({
|
||||||
args: ["js/electron.js"]
|
args: ["js/electron.js"]
|
||||||
}).then(function (startedApp) { app = startedApp; })
|
}).then(function (startedApp) { app = startedApp; });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function () {
|
afterEach(function () {
|
||||||
@ -27,7 +27,7 @@ describe("Check configuration without modules", function () {
|
|||||||
|
|
||||||
it("Show the message MagicMirror title", function () {
|
it("Show the message MagicMirror title", function () {
|
||||||
return app.client.waitUntilWindowLoaded()
|
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 () {
|
it("Show the text Michael's website", function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user