Add Prettier Formatting (#258)

* Add Prettier formatting to source files and example files, and check that Prettier formatting is maintained on PRs

* Remove trailing-comma as we are using Node 6 on Circle

* Use latest Node 6 LTS version in Circle

* Remove unused test
This commit is contained in:
Héctor Ramos 2017-12-04 19:21:02 -08:00 committed by Joel Marcey
parent 0cead4b6f9
commit 65421db62e
50 changed files with 1376 additions and 1350 deletions

View file

@ -7,18 +7,18 @@
const CWD = process.cwd();
const Metadata = require("../core/metadata.js");
const fs = require("fs");
const Metadata = require('../core/metadata.js');
const fs = require('fs');
let languages;
if (fs.existsSync(CWD + "/languages.js")) {
languages = require(CWD + "/languages.js");
if (fs.existsSync(CWD + '/languages.js')) {
languages = require(CWD + '/languages.js');
} else {
languages = [
{
enabled: true,
name: "English",
tag: "en"
}
name: 'English',
tag: 'en',
},
];
}
@ -57,8 +57,14 @@ function readCategories(sidebar) {
if (!articles[metadata.next]) {
throw new Error(
metadata.version
? `Improper sidebars file for version ${metadata.version}, document with id '${metadata.next}' not found. Make sure that all documents with ids specified in this version's sidebar file exist and that no ids are repeated.`
: `Improper sidebars.json file, document with id '${metadata.next}' not found. Make sure that documents with the ids specified in sidebars.json exist and that no ids are repeated.`
? `Improper sidebars file for version ${
metadata.version
}, document with id '${
metadata.next
}' not found. Make sure that all documents with ids specified in this version's sidebar file exist and that no ids are repeated.`
: `Improper sidebars.json file, document with id '${
metadata.next
}' not found. Make sure that documents with the ids specified in sidebars.json exist and that no ids are repeated.`
);
}
previous[articles[metadata.next].id] = metadata.id;
@ -85,7 +91,7 @@ function readCategories(sidebar) {
currentCategory && categories.push(currentCategory);
currentCategory = {
name: metadata.category,
links: []
links: [],
};
}
currentCategory.links.push(metadata);