Merge pull request #2112 from rejas/issue_2109

Fix config check after merge of prettier
This commit is contained in:
Michael Teeuw 2020-08-13 21:44:08 +02:00 committed by GitHub
commit 904f5a2656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -75,6 +75,7 @@ Special thanks to the following contributors: @AndreKoepke, @andrezibaia, @bryan
- Throw error when check_config fails. [#1928](https://github.com/MichMich/MagicMirror/issues/1928) - Throw error when check_config fails. [#1928](https://github.com/MichMich/MagicMirror/issues/1928)
- Bug fix related to 'maxEntries' not displaying Calendar events. [#2050](https://github.com/MichMich/MagicMirror/issues/2050) - Bug fix related to 'maxEntries' not displaying Calendar events. [#2050](https://github.com/MichMich/MagicMirror/issues/2050)
- Updated ical library to latest version. [#1926](https://github.com/MichMich/MagicMirror/issues/1926) - Updated ical library to latest version. [#1926](https://github.com/MichMich/MagicMirror/issues/1926)
- Fix config check after merge of prettier [#2109](https://github.com/MichMich/MagicMirror/issues/2109)
## [2.11.0] - 2020-04-01 ## [2.11.0] - 2020-04-01

View File

@ -12,7 +12,6 @@ const path = require("path");
const fs = require("fs"); const fs = require("fs");
const rootPath = path.resolve(__dirname + "/../"); const rootPath = path.resolve(__dirname + "/../");
const config = require(rootPath + "/.eslintrc.json");
const Log = require(rootPath + "/js/logger.js"); const Log = require(rootPath + "/js/logger.js");
const Utils = require(rootPath + "/js/utils.js"); const Utils = require(rootPath + "/js/utils.js");
@ -59,16 +58,15 @@ function checkConfigFile() {
if (err) { if (err) {
throw err; throw err;
} }
const messages = linter.verify(data, config); const messages = linter.verify(data);
if (messages.length === 0) { if (messages.length === 0) {
Log.log("Your configuration file doesn't contain syntax errors :)"); Log.info(Utils.colors.pass("Your configuration file doesn't contain syntax errors :)"));
return true;
} else { } else {
Log.error(Utils.colors.error("Your configuration file contains syntax errors :("));
// In case the there errors show messages and return // In case the there errors show messages and return
messages.forEach((error) => { messages.forEach((error) => {
Log.log("Line", error.line, "col", error.column, error.message); Log.error("Line", error.line, "col", error.column, error.message);
}); });
throw new Error("Wrong syntax in config file!");
} }
}); });
} }

View File

@ -10,7 +10,8 @@ var Utils = {
colors: { colors: {
warn: colors.yellow, warn: colors.yellow,
error: colors.red, error: colors.red,
info: colors.blue info: colors.blue,
pass: colors.green
} }
}; };