mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 23:57:22 +02:00
ESLintify Part 1 (#837)
* ESLint-ify * Allow empty try/catch * Escape regexp
This commit is contained in:
parent
128dbfca0a
commit
e8e3f42685
44 changed files with 466 additions and 555 deletions
|
@ -5,10 +5,11 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const CWD = process.cwd();
|
||||
const fs = require('fs');
|
||||
|
||||
const Metadata = require('../core/metadata.js');
|
||||
const fs = require('fs');
|
||||
|
||||
const CWD = process.cwd();
|
||||
let languages;
|
||||
if (fs.existsSync(CWD + '/languages.js')) {
|
||||
languages = require(CWD + '/languages.js');
|
||||
|
@ -24,10 +25,9 @@ if (fs.existsSync(CWD + '/languages.js')) {
|
|||
|
||||
// returns data broken up into categories for a sidebar
|
||||
function readCategories(sidebar) {
|
||||
const enabledLanguages = [];
|
||||
languages.filter(lang => lang.enabled).map(lang => {
|
||||
enabledLanguages.push(lang.tag);
|
||||
});
|
||||
const enabledLanguages = languages
|
||||
.filter(lang => lang.enabled)
|
||||
.map(lang => lang.tag);
|
||||
|
||||
const allCategories = {};
|
||||
|
||||
|
@ -88,7 +88,9 @@ function readCategories(sidebar) {
|
|||
let i = 0;
|
||||
while (metadata && i++ < 1000) {
|
||||
if (!currentCategory || metadata.category !== currentCategory.name) {
|
||||
currentCategory && categories.push(currentCategory);
|
||||
if (currentCategory) {
|
||||
categories.push(currentCategory);
|
||||
}
|
||||
currentCategory = {
|
||||
name: metadata.category,
|
||||
links: [],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue