diff --git a/.eslintrc.json b/.eslintrc.json index b5e07288..6936dd7e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,5 +12,11 @@ "browser": true, "node": true, "es6": true - } + }, + "parserOptions": { + "sourceType": "module", + "ecmaFeatures": { + "globalReturn": true + } + } } diff --git a/dangerfile.js b/dangerfile.js index 19ec4344..1b5ccb27 100644 --- a/dangerfile.js +++ b/dangerfile.js @@ -1,9 +1,9 @@ -import { danger, fail } from 'danger' +import { danger, fail } from "danger" // Check if the CHANGELOG.md file has been edited -const changelogEdited = danger.git.modified_files.includes('CHANGELOG.md') +const changelogEdited = danger.git.modified_files.includes("CHANGELOG.md") // Fail the build and post a comment reminding submitters to do so if it wasn't changed if (!changelogEdited) { - fail('Please include a CHANGELOG entry. You can find it at [CHANGELOG.md](CHANGELOG.md).') + fail("Please include a CHANGELOG entry. You can find it at [CHANGELOG.md](CHANGELOG.md).") } \ No newline at end of file diff --git a/tests/configs/check_config.js b/tests/configs/check_config.js index c4690223..baee1caf 100644 --- a/tests/configs/check_config.js +++ b/tests/configs/check_config.js @@ -14,8 +14,6 @@ var path = require("path"); var fs = require("fs"); var Utils = require(__dirname + "/../../js/utils.js"); -if (process.env.NODE_ENV == "test") { return 0 }; - /* getConfigFile() * Return string with path of configuration file * Check if set by enviroment variable MM_CONFIG_FILE @@ -30,37 +28,43 @@ function getConfigFile() { return configFileName; } -var configFileName = getConfigFile(); -// Check if file is present -if (fs.existsSync(configFileName) === false) { - console.error(Utils.colors.error("File not found: "), configFileName); - return; -} -// check permision -try { - fs.accessSync(configFileName, fs.F_OK); -} catch (e) { - console.log(Utils.colors.error(e)); - return; -} - -// Validate syntax of the configuration file. -// In case the there errors show messages and -// return -console.info(Utils.colors.info("Checking file... ", configFileName)); -// I'm not sure if all ever is utf-8 -fs.readFile(configFileName, "utf-8", function (err, data) { - if (err) { throw err; } - v.JSHINT(data); // Parser by jshint - - if (v.JSHINT.errors.length == 0) { - console.log("Your configuration file doesn't contain syntax errors :)"); - return true; - } else { - errors = v.JSHINT.data().errors; - for (idx in errors) { - error = errors[idx]; - console.log("Line", error.line, "col", error.character, error.reason); - } +function checkConfigFile() { + var configFileName = getConfigFile(); + // Check if file is present + if (fs.existsSync(configFileName) === false) { + console.error(Utils.colors.error("File not found: "), configFileName); + return; } -}); + // check permision + try { + fs.accessSync(configFileName, fs.F_OK); + } catch (e) { + console.log(Utils.colors.error(e)); + return; + } + + // Validate syntax of the configuration file. + // In case the there errors show messages and + // return + console.info(Utils.colors.info("Checking file... ", configFileName)); + // I'm not sure if all ever is utf-8 + fs.readFile(configFileName, "utf-8", function (err, data) { + if (err) { throw err; } + v.JSHINT(data); // Parser by jshint + + if (v.JSHINT.errors.length == 0) { + console.log("Your configuration file doesn't contain syntax errors :)"); + return true; + } else { + errors = v.JSHINT.data().errors; + for (idx in errors) { + error = errors[idx]; + console.log("Line", error.line, "col", error.character, error.reason); + } + } + }); +} + +if (process.env.NODE_ENV !== "test") { + checkConfigFile(); +}; \ No newline at end of file