ESlinted scripts

This commit is contained in:
Angelos Chalaris
2018-10-18 22:38:53 +03:00
parent 08e84b7336
commit 1eb609cd90
5 changed files with 63 additions and 45 deletions

View File

@ -31,7 +31,8 @@ const getFilesInDir = (directoryPath, withPath, exclude = null) => {
}, []);
}
return directoryFilenames;
} catch (err) {
}
catch (err) {
console.log(`${chalk.red('ERROR!')} During snippet loading: ${err}`);
process.exit(1);
}
@ -45,7 +46,8 @@ const readSnippets = snippetsPath => {
try {
for (let snippet of snippetFilenames)
snippets[snippet] = fs.readFileSync(path.join(snippetsPath, snippet), 'utf8');
} catch (err) {
}
catch (err) {
console.log(`${chalk.red('ERROR!')} During snippet loading: ${err}`);
process.exit(1);
}
@ -68,7 +70,8 @@ const readTags = () => {
return data;
})
);
} catch (err) {
}
catch (err) {
// Handle errors (hopefully not!)
console.log(`${chalk.red('ERROR!')} During tag database loading: ${err}`);
process.exit(1);
@ -82,9 +85,9 @@ const optimizeNodes = (data, regexp, replacer) => {
do {
output = output.replace(regexp, replacer);
count = 0;
while (regexp.exec(output) !== null) {
while (regexp.exec(output) !== null)
++count;
}
} while (count > 0);
return output;
};
@ -116,9 +119,9 @@ const getCodeBlocks = str => {
const results = [];
let m = null;
while ((m = regex.exec(str)) !== null) {
if (m.index === regex.lastIndex) {
if (m.index === regex.lastIndex)
regex.lastIndex += 1;
}
m.forEach((match, groupIndex) => {
results.push(match);
});
@ -131,9 +134,9 @@ const getTextualContent = str => {
const results = [];
let m = null;
while ((m = regex.exec(str)) !== null) {
if (m.index === regex.lastIndex) {
if (m.index === regex.lastIndex)
regex.lastIndex += 1;
}
m.forEach((match, groupIndex) => {
results.push(match);
});