diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 8494ac2706..0000000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -v2 \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index a9f52d1530..3eff994f47 100644 --- a/.prettierrc +++ b/.prettierrc @@ -5,5 +5,5 @@ "printWidth": 80, "proseWrap": "never", "singleQuote": true, - "trailingComma": "es5" + "trailingComma": "all" } diff --git a/docusaurus-init/initialize.js b/docusaurus-init/initialize.js index 942d469405..7b6c10d35f 100644 --- a/docusaurus-init/initialize.js +++ b/docusaurus-init/initialize.js @@ -7,53 +7,53 @@ * LICENSE file in the root directory of this source tree. */ -const shell = require("shelljs"); -const chalk = require("chalk"); -const fs = require("fs"); +const shell = require('shelljs'); +const chalk = require('chalk'); +const fs = require('fs'); const CWD = process.cwd(); let useYarn = false; -if (shell.which("yarn")) { +if (shell.which('yarn')) { useYarn = true; } -if (fs.existsSync(CWD + "/website")) { - console.error(chalk.yellow("Website folder already exists.\n")); +if (fs.existsSync(CWD + '/website')) { + console.error(chalk.yellow('Website folder already exists.\n')); console.log( - "In order for Docusaurus to get set up as your static site generator, you will need to remove any existing 'website' folder from your root directory. If you are migrating from another static site generator, you may want to move your old website folder to a different location." + "In order for Docusaurus to get set up as your static site generator, you will need to remove any existing 'website' folder from your root directory. If you are migrating from another static site generator, you may want to move your old website folder to a different location.", ); process.exit(1); } shell.cd(CWD); -shell.mkdir("website"); +shell.mkdir('website'); -console.log(chalk.green("Website folder created!\n")); +console.log(chalk.green('Website folder created!\n')); -shell.cd("website"); +shell.cd('website'); console.log( - chalk.yellow("Installing latest version of Docusaurus in website.\n") + chalk.yellow('Installing latest version of Docusaurus in website.\n'), ); -const packageContent = { scripts: { examples: "docusaurus-examples" } }; +const packageContent = {scripts: {examples: 'docusaurus-examples'}}; fs.writeFileSync( - CWD + "/website/package.json", - JSON.stringify(packageContent, null, 2) + "\n" + CWD + '/website/package.json', + JSON.stringify(packageContent, null, 2) + '\n', ); if (useYarn) { - shell.exec("yarn add docusaurus --dev"); + shell.exec('yarn add docusaurus --dev'); } else { - shell.exec("npm install docusaurus --save-dev"); + shell.exec('npm install docusaurus --save-dev'); } -console.log(chalk.green("Docusaurus installed in website folder!\n")); +console.log(chalk.green('Docusaurus installed in website folder!\n')); if (useYarn) { - shell.exec("yarn run examples"); + shell.exec('yarn run examples'); } else { - shell.exec("npm run examples"); + shell.exec('npm run examples'); } diff --git a/examples/basics/pages/en/help.js b/examples/basics/pages/en/help.js index f50dbbb94c..512e335a99 100755 --- a/examples/basics/pages/en/help.js +++ b/examples/basics/pages/en/help.js @@ -25,7 +25,7 @@ class Help extends React.Component { { content: `Learn more using the [documentation on this site.](${docUrl( 'doc1.html', - language + language, )})`, title: 'Browse Docs', }, diff --git a/examples/versions/pages/en/versions.js b/examples/versions/pages/en/versions.js index d0895688fa..286464fc17 100644 --- a/examples/versions/pages/en/versions.js +++ b/examples/versions/pages/en/versions.js @@ -77,7 +77,7 @@ function Versions() { Release Notes - ) + ), )} diff --git a/lib/__tests__/build-files.test.js b/lib/__tests__/build-files.test.js index e2b5b7ed0c..0260e58249 100644 --- a/lib/__tests__/build-files.test.js +++ b/lib/__tests__/build-files.test.js @@ -68,7 +68,7 @@ describe('Build files', () => { test('Generated HTML for each Markdown resource', () => { const metadata = outputHTMLFiles.map(file => - filepath.create(file).basename() + filepath.create(file).basename(), ); inputMarkdownFiles.forEach(file => { const data = fs.readFileSync(file, 'utf8'); @@ -90,12 +90,12 @@ describe('Build files', () => { siteConfig.projectName }/css/main.css`; const fileContents = await Promise.all( - [combinedCSSFile, ...inputFiles].map(file => fs.readFile(file, 'utf8')) + [combinedCSSFile, ...inputFiles].map(file => fs.readFile(file, 'utf8')), ); const [outputFileContent, ...inputFileContents] = fileContents; const minifiedCssFiles = await Promise.all( - inputFileContents.map(utils.minifyCss) + inputFileContents.map(utils.minifyCss), ); minifiedCssFiles.forEach(fileContent => { @@ -105,7 +105,7 @@ describe('Build files', () => { test('Copied assets from /docs/assets', () => { const metadata = outputAssetsFiles.map(file => - filepath.create(file).basename() + filepath.create(file).basename(), ); inputAssetsFiles.forEach(file => { const path = filepath.create(file); diff --git a/lib/build-files.js b/lib/build-files.js index 83ed4ceaa9..cd003b49ae 100755 --- a/lib/build-files.js +++ b/lib/build-files.js @@ -27,7 +27,7 @@ const CWD = process.cwd(); if (!fs.existsSync(`${CWD}/siteConfig.js`)) { console.error( - chalk.red('Error: No siteConfig.js file found in website folder!') + chalk.red('Error: No siteConfig.js file found in website folder!'), ); process.exit(1); } diff --git a/lib/copy-examples.js b/lib/copy-examples.js index c766676b79..3fbc67b8b8 100755 --- a/lib/copy-examples.js +++ b/lib/copy-examples.js @@ -27,7 +27,7 @@ commander // add scripts to package.json file if (fs.existsSync(`${CWD}/package.json`)) { const packageContent = JSON.parse( - fs.readFileSync(`${CWD}/package.json`, 'utf8') + fs.readFileSync(`${CWD}/package.json`, 'utf8'), ); if (!packageContent.scripts) { packageContent.scripts = {}; @@ -42,10 +42,10 @@ if (fs.existsSync(`${CWD}/package.json`)) { packageContent.scripts['rename-version'] = 'docusaurus-rename-version'; fs.writeFileSync( `${CWD}/package.json`, - `${JSON.stringify(packageContent, null, 2)}\n` + `${JSON.stringify(packageContent, null, 2)}\n`, ); console.log( - `${chalk.green('Wrote docusaurus scripts to package.json file.')}\n` + `${chalk.green('Wrote docusaurus scripts to package.json file.')}\n`, ); } @@ -62,8 +62,8 @@ if (feature === 'translations') { if (fs.existsSync(`${CWD}/../crowdin.yaml`)) { console.log( `${chalk.yellow('crowdin.yaml already exists')} in ${chalk.yellow( - `${outerFolder}/` - )}. Rename or remove the file to regenerate an example version.\n` + `${outerFolder}/`, + )}. Rename or remove the file to regenerate an example version.\n`, ); } else { fs.copySync(`${folder}/crowdin.yaml`, `${CWD}/../crowdin.yaml`); @@ -87,10 +87,10 @@ if (feature === 'translations') { } catch (e) { console.log( `${chalk.yellow( - `${path.basename(filePath)} already exists` + `${path.basename(filePath)} already exists`, )} in ${chalk.yellow( - `website${filePath.split(path.basename(filePath))[0]}` - )}. Rename or remove the file to regenerate an example version.\n` + `website${filePath.split(path.basename(filePath))[0]}`, + )}. Rename or remove the file to regenerate an example version.\n`, ); } }); @@ -112,10 +112,10 @@ if (feature === 'translations') { } catch (e) { console.log( `${chalk.yellow( - `${path.basename(filePath)} already exists` + `${path.basename(filePath)} already exists`, )} in ${chalk.yellow( - `website${filePath.split(path.basename(filePath))[0]}` - )}. Rename or remove the file to regenerate an example version.\n` + `website${filePath.split(path.basename(filePath))[0]}`, + )}. Rename or remove the file to regenerate an example version.\n`, ); } }); @@ -125,13 +125,13 @@ if (feature === 'translations') { if (fs.existsSync(`${CWD}/../docs-examples-from-docusaurus`)) { console.log( `- ${chalk.green( - 'docs-examples-from-docusaurus' - )} already exists in ${chalk.blue(outerFolder)}.` + 'docs-examples-from-docusaurus', + )} already exists in ${chalk.blue(outerFolder)}.`, ); } else { fs.copySync( `${folder}/docs-examples-from-docusaurus`, - `${CWD}/../docs-examples-from-docusaurus` + `${CWD}/../docs-examples-from-docusaurus`, ); exampleSiteCreated = true; docsCreated = true; @@ -140,13 +140,13 @@ if (feature === 'translations') { if (fs.existsSync(`${CWD}/blog-examples-from-docusaurus`)) { console.log( `- ${chalk.green( - 'blog-examples-from-docusaurus' - )} already exists in ${chalk.blue(`${outerFolder}/website`)}.` + 'blog-examples-from-docusaurus', + )} already exists in ${chalk.blue(`${outerFolder}/website`)}.`, ); } else { fs.copySync( path.join(folder, 'blog-examples-from-docusaurus'), - path.join(CWD, 'blog-examples-from-docusaurus') + path.join(CWD, 'blog-examples-from-docusaurus'), ); exampleSiteCreated = true; blogCreated = true; @@ -159,8 +159,8 @@ if (feature === 'translations') { if (fs.existsSync(dest)) { console.log( `- ${chalk.green(copiedFileName)} already exists in ${chalk.blue( - outerFolder - )}.` + outerFolder, + )}.`, ); } else { fs.copySync(src, dest); @@ -206,10 +206,10 @@ if (feature === 'translations') { } catch (e) { console.log( `- ${chalk.green( - `${path.basename(filePath)}` + `${path.basename(filePath)}`, )} already exists in ${chalk.blue( - `${outerFolder}/website${filePath.split(path.basename(filePath))[0]}` - )}.` + `${outerFolder}/website${filePath.split(path.basename(filePath))[0]}`, + )}.`, ); } }); @@ -233,19 +233,19 @@ if (feature === 'translations') { if (docsCreated) { console.log( `Rename ${chalk.yellow( - `${outerFolder}/docs-examples-from-docusaurus` + `${outerFolder}/docs-examples-from-docusaurus`, )} to ${chalk.yellow( - `${outerFolder}/docs` - )} to see the example docs on your site.\n` + `${outerFolder}/docs`, + )} to see the example docs on your site.\n`, ); } if (blogCreated) { console.log( `Rename ${chalk.yellow( - `${outerFolder}/website/blog-examples-from-docusaurus` + `${outerFolder}/website/blog-examples-from-docusaurus`, )} to ${chalk.yellow( - `${outerFolder}/website/blog` - )} to see the example blog posts on your site.\n` + `${outerFolder}/website/blog`, + )} to see the example blog posts on your site.\n`, ); } diff --git a/lib/core/BlogPageLayout.js b/lib/core/BlogPageLayout.js index 25098e6eec..a63d4c3d40 100644 --- a/lib/core/BlogPageLayout.js +++ b/lib/core/BlogPageLayout.js @@ -52,7 +52,7 @@ class BlogPageLayout extends React.Component { } config={this.props.config} /> - ) + ), )}
{page > 0 && ( diff --git a/lib/core/BlogPost.js b/lib/core/BlogPost.js index da61433d71..bad8435d9d 100644 --- a/lib/core/BlogPost.js +++ b/lib/core/BlogPost.js @@ -25,7 +25,7 @@ class BlogPost extends React.Component { className="button" href={`${this.props.config.baseUrl}blog/${utils.getPath( this.props.post.path, - this.props.config.cleanUrl + this.props.config.cleanUrl, )}`}> Read More @@ -66,7 +66,7 @@ class BlogPost extends React.Component { {post.title} diff --git a/lib/core/Doc.js b/lib/core/Doc.js index 9c15e9542b..b3d3e1e303 100644 --- a/lib/core/Doc.js +++ b/lib/core/Doc.js @@ -11,10 +11,10 @@ const MarkdownBlock = require('./MarkdownBlock.js'); const translate = require('../server/translate.js').translate; const editThisDoc = translate( - 'Edit this Doc|recruitment message asking to edit the doc source' + 'Edit this Doc|recruitment message asking to edit the doc source', ); const translateThisDoc = translate( - 'Translate this Doc|recruitment message asking to translate the docs' + 'Translate this Doc|recruitment message asking to translate the docs', ); // inner doc component for article itself diff --git a/lib/core/DocsLayout.js b/lib/core/DocsLayout.js index 3f47790a07..9fc259935a 100644 --- a/lib/core/DocsLayout.js +++ b/lib/core/DocsLayout.js @@ -30,7 +30,7 @@ class DocsLayout extends React.Component { .replace(/^\.\.\//, '') + extension; return url.resolve( `${this.props.config.baseUrl}${this.props.metadata.permalink}`, - relativeHref + relativeHref, ); }; @@ -95,7 +95,7 @@ class DocsLayout extends React.Component { className="docs-prev button" href={this.getRelativeURL( metadata.localized_id, - metadata.previous_id + metadata.previous_id, )}> ← ) : ( - ) + ), )} {this.props.config.scripts && this.props.config.scripts.map( @@ -152,7 +152,7 @@ class Head extends React.Component { ` + ``, )} diff --git a/v2/lib/index.js b/v2/lib/index.js index 03c0a0dab0..5f5bb5b265 100644 --- a/v2/lib/index.js +++ b/v2/lib/index.js @@ -7,5 +7,5 @@ module.exports = { build, eject, init, - start + start, }; diff --git a/v2/lib/load/config.js b/v2/lib/load/config.js index 890b92ddfb..09688e3417 100644 --- a/v2/lib/load/config.js +++ b/v2/lib/load/config.js @@ -16,7 +16,7 @@ module.exports = function loadConfig(siteDir, deleteCache = true) { 'tagline', 'organizationName', 'projectName', - 'baseUrl' + 'baseUrl', ]; const optionalFields = [ 'customDocsPath', @@ -26,19 +26,19 @@ module.exports = function loadConfig(siteDir, deleteCache = true) { 'configureWebpack', 'chainWebpack', 'docsUrl', - 'customFields' + 'customFields', ]; const missingFields = requiredFields.filter(field => !config[field]); if (missingFields && missingFields.length > 0) { throw new Error( - `${missingFields.join(', ')} fields are missing in siteConfig.js` + `${missingFields.join(', ')} fields are missing in siteConfig.js`, ); } /* Fill default value */ const defaultConfig = { customDocsPath: 'docs', - docsUrl: 'docs' + docsUrl: 'docs', }; Object.keys(defaultConfig).forEach(field => { if (!config[field]) { @@ -55,11 +55,11 @@ module.exports = function loadConfig(siteDir, deleteCache = true) { /* We don't allow useless/ not meaningful field */ const allowedFields = [...requiredFields, ...optionalFields, ...customFields]; const uselessFields = Object.keys(config).filter( - field => !allowedFields.includes(field) + field => !allowedFields.includes(field), ); if (uselessFields && uselessFields.length > 0) { throw new Error( - `${uselessFields.join(', ')} fields are useless in siteConfig.js` + `${uselessFields.join(', ')} fields are useless in siteConfig.js`, ); } diff --git a/v2/lib/load/docs/index.js b/v2/lib/load/docs/index.js index fd7e6aa748..b1d6165f32 100644 --- a/v2/lib/load/docs/index.js +++ b/v2/lib/load/docs/index.js @@ -28,7 +28,7 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { /* metadata for default docs files */ const docsFiles = await globby(['**/*.md'], { - cwd: docsDir + cwd: docsDir, }); await Promise.all( docsFiles.map(async source => { @@ -47,17 +47,17 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { docsDir, env, order, - siteConfig + siteConfig, ); docsMetadatas[metadata.id] = metadata; - }) + }), ); /* metadata for non-default-language docs */ if (translationEnabled) { const translatedDir = path.join(siteDir, 'translated_docs'); const translatedFiles = await globby(['**/*.md'], { - cwd: translatedDir + cwd: translatedDir, }); await Promise.all( translatedFiles.map(async source => { @@ -79,10 +79,10 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { translatedDir, env, order, - siteConfig + siteConfig, ); docsMetadatas[metadata.id] = metadata; - }) + }), ); } @@ -90,7 +90,7 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { if (versioningEnabled) { const versionedDir = path.join(siteDir, 'versioned_docs'); const versionedFiles = await globby(['**/*.md'], { - cwd: versionedDir + cwd: versionedDir, }); await Promise.all( versionedFiles.map(async source => { @@ -99,10 +99,10 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { versionedDir, env, order, - siteConfig + siteConfig, ); docsMetadatas[metadata.id] = metadata; - }) + }), ); } @@ -122,7 +122,7 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { return { docsSidebars, - docsMetadatas + docsMetadatas, }; } diff --git a/v2/lib/load/docs/metadata.js b/v2/lib/load/docs/metadata.js index 9a8c2687dc..45c0ff86bf 100644 --- a/v2/lib/load/docs/metadata.js +++ b/v2/lib/load/docs/metadata.js @@ -41,7 +41,7 @@ module.exports = async function processMetadata( refDir, env, order, - siteConfig + siteConfig, ) { const filepath = path.resolve(refDir, source); const fileString = await fs.readFile(filepath, 'utf-8'); @@ -131,7 +131,7 @@ module.exports = async function processMetadata( .replace(/:docsUrl/, docsUrl) .replace(/:langPart/, langPart) .replace(/:versionPart/, versionPart) - .replace(/:id/, metadata.id) + .replace(/:id/, metadata.id), ); } else { metadata.permalink = `${baseUrl}${docsUrl}/${langPart}${versionPart}${ diff --git a/v2/lib/load/docs/order.js b/v2/lib/load/docs/order.js index 5f9f6c3478..52c8ca9a7e 100644 --- a/v2/lib/load/docs/order.js +++ b/v2/lib/load/docs/order.js @@ -28,7 +28,7 @@ module.exports = function createOrder(allSidebars = {}) { previous, next, sidebar, - category: categoryOrder[i] + category: categoryOrder[i], }; } }); diff --git a/v2/lib/load/docs/sidebars.js b/v2/lib/load/docs/sidebars.js index fd27c22177..ac901ab195 100644 --- a/v2/lib/load/docs/sidebars.js +++ b/v2/lib/load/docs/sidebars.js @@ -19,7 +19,7 @@ module.exports = function loadSidebars({siteDir, env}) { const versionedSidebarsJSONFile = path.join( siteDir, 'versioned_sidebars', - `version-${version}-sidebars.json` + `version-${version}-sidebars.json`, ); if (fs.existsSync(versionedSidebarsJSONFile)) { const sidebar = require(versionedSidebarsJSONFile); // eslint-disable-line diff --git a/v2/lib/load/env.js b/v2/lib/load/env.js index 41d45fcd68..530321bc46 100644 --- a/v2/lib/load/env.js +++ b/v2/lib/load/env.js @@ -7,7 +7,7 @@ module.exports = function loadEnv({siteDir, siteConfig}) { const translation = { enabled: false, enabledLanguages: [], - defaultLanguage: {} + defaultLanguage: {}, }; const languagesFile = path.join(siteDir, 'languages.js'); @@ -24,11 +24,11 @@ module.exports = function loadEnv({siteDir, siteConfig}) { /* Default Language */ const {defaultLanguage: defaultLanguageTag} = siteConfig; const defaultLanguage = enabledLanguages.find( - lang => lang.tag === defaultLanguageTag + lang => lang.tag === defaultLanguageTag, ); if (!defaultLanguage) { throw new Error( - `Please set a default language in 'siteConfig.js' which is enabled in 'languages.js'` + `Please set a default language in 'siteConfig.js' which is enabled in 'languages.js'`, ); } translation.defaultLanguage = defaultLanguage; @@ -41,7 +41,7 @@ module.exports = function loadEnv({siteDir, siteConfig}) { enabled: false, latestVersion: null, defaultVersion: null, - versions: [] + versions: [], }; const versionsJSONFile = path.join(siteDir, 'versions.json'); @@ -55,6 +55,6 @@ module.exports = function loadEnv({siteDir, siteConfig}) { return { translation, - versioning + versioning, }; }; diff --git a/v2/lib/load/index.js b/v2/lib/load/index.js index 2dd0bd4ff3..3b2f86dff7 100644 --- a/v2/lib/load/index.js +++ b/v2/lib/load/index.js @@ -12,7 +12,7 @@ module.exports = async function load(siteDir) { const siteConfig = loadConfig(siteDir); await generate( 'siteConfig.js', - `export default ${JSON.stringify(siteConfig, null, 2)};` + `export default ${JSON.stringify(siteConfig, null, 2)};`, ); // @tested - env @@ -24,15 +24,15 @@ module.exports = async function load(siteDir) { siteDir, docsDir, env, - siteConfig + siteConfig, }); await generate( 'docsMetadatas.js', - `export default ${JSON.stringify(docsMetadatas, null, 2)};` + `export default ${JSON.stringify(docsMetadatas, null, 2)};`, ); await generate( 'docsSidebars.js', - `export default ${JSON.stringify(docsSidebars, null, 2)};` + `export default ${JSON.stringify(docsSidebars, null, 2)};`, ); /* Create source to metadata mapping */ @@ -42,9 +42,9 @@ module.exports = async function load(siteDir) { sourceToMetadata[source] = { version, permalink, - language + language, }; - } + }, ); // pages @@ -52,7 +52,7 @@ module.exports = async function load(siteDir) { const pagesMetadatas = await loadPages(pagesDir); await generate( 'pagesMetadatas.js', - `export default ${JSON.stringify(pagesMetadatas, null, 2)};` + `export default ${JSON.stringify(pagesMetadatas, null, 2)};`, ); // resolve outDir @@ -79,7 +79,7 @@ module.exports = async function load(siteDir) { baseUrl, sourceToMetadata, versionedDir, - translatedDir + translatedDir, }; // Generate React Router Config diff --git a/v2/lib/load/pages.js b/v2/lib/load/pages.js index 5c1b46f6da..7af30239c0 100644 --- a/v2/lib/load/pages.js +++ b/v2/lib/load/pages.js @@ -3,14 +3,14 @@ const {encodePath, fileToPath} = require('./utils'); async function loadPages(pagesDir) { const pagesFiles = await globby(['**/*.js'], { - cwd: pagesDir + cwd: pagesDir, }); const pagesMetadatas = await Promise.all( pagesFiles.map(async source => ({ path: encodePath(fileToPath(source)), - source - })) + source, + })), ); return pagesMetadatas; } diff --git a/v2/lib/load/theme.js b/v2/lib/load/theme.js index a4643feb5c..3a5b6cfc4a 100644 --- a/v2/lib/load/theme.js +++ b/v2/lib/load/theme.js @@ -11,7 +11,7 @@ module.exports = function loadConfig(siteDir) { themeComponents.forEach(component => { if (!require.resolve(path.join(themePath, component))) { throw new Error( - `Failed to load ${themePath}/${component}. It does not exist.` + `Failed to load ${themePath}/${component}. It does not exist.`, ); } }); diff --git a/v2/lib/load/utils.js b/v2/lib/load/utils.js index 060bcea9ac..08708810e7 100644 --- a/v2/lib/load/utils.js +++ b/v2/lib/load/utils.js @@ -55,7 +55,7 @@ function getSubFolder(file, refDir) { const separator = escapeStringRegexp(path.sep); const baseDir = escapeStringRegexp(path.basename(refDir)); const regexSubFolder = new RegExp( - `${baseDir}${separator}(.*?)${separator}.*` + `${baseDir}${separator}(.*?)${separator}.*`, ); const match = regexSubFolder.exec(file); return match && match[1]; @@ -77,5 +77,5 @@ module.exports = { fileToComponentName, getSubFolder, idx, - parse + parse, }; diff --git a/v2/lib/theme/Docs/index.js b/v2/lib/theme/Docs/index.js index 8d4217d37f..3aff930ce5 100644 --- a/v2/lib/theme/Docs/index.js +++ b/v2/lib/theme/Docs/index.js @@ -24,7 +24,7 @@ export default class Docs extends React.Component { const linkMetadata = docsMetadatas[linkID]; if (!linkMetadata) { throw new Error( - `Improper sidebars.json file, document with id '${linkID}' not found.` + `Improper sidebars.json file, document with id '${linkID}' not found.`, ); } const linkClassName = @@ -50,7 +50,7 @@ export default class Docs extends React.Component { siteConfig, docsMetadatas, docsSidebars, - metadata + metadata, } = this.props; return ( diff --git a/v2/lib/theme/Layout/index.js b/v2/lib/theme/Layout/index.js index d96ab6d10c..775f1ae279 100644 --- a/v2/lib/theme/Layout/index.js +++ b/v2/lib/theme/Layout/index.js @@ -7,7 +7,7 @@ export default class Layout extends React.Component { render() { const {children, pagesMetadatas, docsMetadatas = {}, location} = this.props; const docsLinks = Object.values(docsMetadatas).map(data => ({ - path: `${data.permalink}` + path: `${data.permalink}`, })); const routeLinks = [...pagesMetadatas, ...docsLinks].map( data => @@ -15,7 +15,7 @@ export default class Layout extends React.Component {
  • {data.path}
  • - ) + ), ); return (
    diff --git a/v2/lib/theme/Markdown/highlight.js b/v2/lib/theme/Markdown/highlight.js index 643856b550..111de59b25 100644 --- a/v2/lib/theme/Markdown/highlight.js +++ b/v2/lib/theme/Markdown/highlight.js @@ -14,8 +14,8 @@ export default (str, rawLang) => { } catch (e) { console.error( chalk.yellow( - `Highlight.js syntax highlighting for language "${lang}" is not supported.` - ) + `Highlight.js syntax highlighting for language "${lang}" is not supported.`, + ), ); } return hljs.highlightAuto(str).value; diff --git a/v2/lib/theme/Markdown/index.js b/v2/lib/theme/Markdown/index.js index 6eb0a378d1..b0716e6800 100644 --- a/v2/lib/theme/Markdown/index.js +++ b/v2/lib/theme/Markdown/index.js @@ -12,7 +12,7 @@ class MarkdownBlock extends React.Component { return ( ); @@ -31,14 +31,14 @@ class MarkdownBlock extends React.Component { renderMarkdown(source) { const alias = { - js: 'jsx' + js: 'jsx', }; const {siteConfig} = this.props; const md = new Markdown({ langPrefix: 'hljs css language-', highlight: highlight, html: true, - linkify: true + linkify: true, }); // Register anchors plugin @@ -64,9 +64,9 @@ class MarkdownBlock extends React.Component { {}, { version: '9.12.0', - theme: 'default' + theme: 'default', }, - siteConfig.highlight + siteConfig.highlight, ); // Use user-provided themeUrl if it exists, else construct one from version and theme. @@ -88,7 +88,7 @@ class MarkdownBlock extends React.Component { } MarkdownBlock.defaultProps = { - siteConfig: {} + siteConfig: {}, }; export default MarkdownBlock; diff --git a/v2/lib/theme/Markdown/toSlug.js b/v2/lib/theme/Markdown/toSlug.js index 13bf572596..b6598d8831 100644 --- a/v2/lib/theme/Markdown/toSlug.js +++ b/v2/lib/theme/Markdown/toSlug.js @@ -31,7 +31,7 @@ module.exports = (string, context = {}) => { .toLowerCase() // Handle accentuated characters .replace(new RegExp(`[${accents}]`, 'g'), c => - without.charAt(accents.indexOf(c)) + without.charAt(accents.indexOf(c)), ) // Replace `.`, `(` and `?` with blank string like Github does .replace(/\.|\(|\?/g, '') diff --git a/v2/lib/webpack/base.js b/v2/lib/webpack/base.js index 61e4220a7e..433ffb5c7f 100644 --- a/v2/lib/webpack/base.js +++ b/v2/lib/webpack/base.js @@ -16,7 +16,7 @@ module.exports = function createBaseConfig(props, isServer) { sourceToMetadata, versionedDir, translatedDir, - baseUrl + baseUrl, } = props; const config = new Config(); @@ -52,7 +52,7 @@ module.exports = function createBaseConfig(props, isServer) { .options({ babelrc: false, presets: ['env', 'react'], - plugins: [isServer ? 'dynamic-import-node' : 'syntax-dynamic-import'] + plugins: [isServer ? 'dynamic-import-node' : 'syntax-dynamic-import'], }); } @@ -83,7 +83,7 @@ module.exports = function createBaseConfig(props, isServer) { versionedDir, translatedDir, docsDir, - sourceToMetadata + sourceToMetadata, }); const cssRule = config.module.rule('css').test(/\.css$/); @@ -103,15 +103,15 @@ module.exports = function createBaseConfig(props, isServer) { importLoaders: 1, localIdentName: `[local]_[hash:base64:8]`, sourceMap: !isProd, - minimize: true + minimize: true, }); // mini-css-extract plugin config.plugin('extract-css').use(CSSExtractPlugin, [ { filename: isProd ? '[name].[chunkhash].css' : '[name].css', - chunkFilename: isProd ? '[id].[chunkhash].css' : '[id].css' - } + chunkFilename: isProd ? '[id].[chunkhash].css' : '[id].css', + }, ]); if (isProd) { @@ -122,10 +122,10 @@ module.exports = function createBaseConfig(props, isServer) { warnings: false, compress: false, ecma: 6, - mangle: true + mangle: true, }, - sourceMap: true - }) + sourceMap: true, + }), ]); } diff --git a/v2/lib/webpack/loader/markdown.js b/v2/lib/webpack/loader/markdown.js index e5893299a6..2f8a26dd05 100644 --- a/v2/lib/webpack/loader/markdown.js +++ b/v2/lib/webpack/loader/markdown.js @@ -8,7 +8,7 @@ module.exports = function(fileString) { versionedDir, docsDir, translatedDir, - sourceToMetadata + sourceToMetadata, } = options; /* Extract content of markdown (without frontmatter) */ diff --git a/v2/lib/webpack/server.js b/v2/lib/webpack/server.js index f6aacc1c22..160413e20c 100644 --- a/v2/lib/webpack/server.js +++ b/v2/lib/webpack/server.js @@ -18,17 +18,17 @@ module.exports = function createServerConfig(props) { // static site generator webpack plugin const docsLinks = Object.values(docsMetadatas).map(data => ({ - path: `${data.permalink}` + path: `${data.permalink}`, })); const paths = [...docsLinks, ...pagesMetadatas].map(data => data.path); config.plugin('siteGenerator').use(staticSiteGenerator, [ { entry: 'main', locals: { - baseUrl: siteConfig.baseUrl + baseUrl: siteConfig.baseUrl, }, - paths - } + paths, + }, ]); // show compilation progress bar and build time diff --git a/v2/lib/webpack/utils.js b/v2/lib/webpack/utils.js index 369bb5db87..abb0698e83 100644 --- a/v2/lib/webpack/utils.js +++ b/v2/lib/webpack/utils.js @@ -23,5 +23,5 @@ function applyChainWebpack(userChainWebpack, config, isServer) { module.exports = { applyConfigureWebpack, - applyChainWebpack + applyChainWebpack, }; diff --git a/v2/package.json b/v2/package.json index 0257afd7a8..0f70dd57d7 100644 --- a/v2/package.json +++ b/v2/package.json @@ -11,7 +11,6 @@ "start": "node bin/munseo start website", "build": "node bin/munseo build website", "eject": "node bin/munseo eject website", - "prettier": "prettier --config .prettierrc --write \"lib/**/*.js\" \"bin/**/*.js\" \"test/**/*.js\"", "lint": "eslint --cache \"lib/**/*.js\" \"bin/**/*.js\" \"test/**/*.js\"", "test": "jest --config test/jest.config.js" }, @@ -19,11 +18,7 @@ "type": "git", "url": "git+https://github.com/endiliey/munseo.git" }, - "keywords": [ - "blog", - "generator", - "react" - ], + "keywords": ["blog", "generator", "react"], "author": "endiliey", "license": "MIT", "bugs": { diff --git a/v2/test/__fixtures__/custom-site/siteConfig.js b/v2/test/__fixtures__/custom-site/siteConfig.js index 3c5b2a6f42..ec13fde0a7 100644 --- a/v2/test/__fixtures__/custom-site/siteConfig.js +++ b/v2/test/__fixtures__/custom-site/siteConfig.js @@ -3,5 +3,5 @@ module.exports = { tagline: 'This is not an ordinary site', organizationName: 'endiliey', projectName: 'sakura', - baseUrl: '/sakura/' + baseUrl: '/sakura/', }; diff --git a/v2/test/__fixtures__/simple-site/siteConfig.js b/v2/test/__fixtures__/simple-site/siteConfig.js index e64b9989cf..db81858cd9 100644 --- a/v2/test/__fixtures__/simple-site/siteConfig.js +++ b/v2/test/__fixtures__/simple-site/siteConfig.js @@ -3,5 +3,5 @@ module.exports = { tagline: 'Hello World', organizationName: 'endiliey', projectName: 'hello', - baseUrl: '/' + baseUrl: '/', }; diff --git a/v2/test/__fixtures__/translated-site/siteConfig.js b/v2/test/__fixtures__/translated-site/siteConfig.js index 661f59c981..ce9e264d72 100644 --- a/v2/test/__fixtures__/translated-site/siteConfig.js +++ b/v2/test/__fixtures__/translated-site/siteConfig.js @@ -4,5 +4,5 @@ module.exports = { organizationName: 'endiliey', projectName: 'hello', baseUrl: '/', - defaultLanguage: 'en' + defaultLanguage: 'en', }; diff --git a/v2/test/__fixtures__/transversioned-site/siteConfig.js b/v2/test/__fixtures__/transversioned-site/siteConfig.js index 661f59c981..ce9e264d72 100644 --- a/v2/test/__fixtures__/transversioned-site/siteConfig.js +++ b/v2/test/__fixtures__/transversioned-site/siteConfig.js @@ -4,5 +4,5 @@ module.exports = { organizationName: 'endiliey', projectName: 'hello', baseUrl: '/', - defaultLanguage: 'en' + defaultLanguage: 'en', }; diff --git a/v2/test/__fixtures__/versioned-site/siteConfig.js b/v2/test/__fixtures__/versioned-site/siteConfig.js index e64b9989cf..db81858cd9 100644 --- a/v2/test/__fixtures__/versioned-site/siteConfig.js +++ b/v2/test/__fixtures__/versioned-site/siteConfig.js @@ -3,5 +3,5 @@ module.exports = { tagline: 'Hello World', organizationName: 'endiliey', projectName: 'hello', - baseUrl: '/' + baseUrl: '/', }; diff --git a/v2/test/jest.config.js b/v2/test/jest.config.js index 7c7392384c..8b8076775e 100644 --- a/v2/test/jest.config.js +++ b/v2/test/jest.config.js @@ -6,7 +6,7 @@ module.exports = { testURL: 'http://localhost/', testEnvironment: 'node', moduleNameMapper: { - '^@lib/(.*)$': '/lib/$1' + '^@lib/(.*)$': '/lib/$1', }, - testPathIgnorePatterns: ['/node_modules/', '__fixtures__'] + testPathIgnorePatterns: ['/node_modules/', '__fixtures__'], }; diff --git a/v2/test/load/__fixtures__/bad-site/siteConfig.js b/v2/test/load/__fixtures__/bad-site/siteConfig.js index 2f57430423..ab2a89fa2a 100644 --- a/v2/test/load/__fixtures__/bad-site/siteConfig.js +++ b/v2/test/load/__fixtures__/bad-site/siteConfig.js @@ -1,4 +1,4 @@ module.exports = { title: 'Munseo', - baseUrl: '/' + baseUrl: '/', }; diff --git a/v2/test/load/__fixtures__/simple-site/siteConfig.js b/v2/test/load/__fixtures__/simple-site/siteConfig.js index e64b9989cf..db81858cd9 100644 --- a/v2/test/load/__fixtures__/simple-site/siteConfig.js +++ b/v2/test/load/__fixtures__/simple-site/siteConfig.js @@ -3,5 +3,5 @@ module.exports = { tagline: 'Hello World', organizationName: 'endiliey', projectName: 'hello', - baseUrl: '/' + baseUrl: '/', }; diff --git a/v2/test/load/__fixtures__/translated-site/siteConfig.js b/v2/test/load/__fixtures__/translated-site/siteConfig.js index 661f59c981..ce9e264d72 100644 --- a/v2/test/load/__fixtures__/translated-site/siteConfig.js +++ b/v2/test/load/__fixtures__/translated-site/siteConfig.js @@ -4,5 +4,5 @@ module.exports = { organizationName: 'endiliey', projectName: 'hello', baseUrl: '/', - defaultLanguage: 'en' + defaultLanguage: 'en', }; diff --git a/v2/test/load/__fixtures__/transversioned-site/siteConfig.js b/v2/test/load/__fixtures__/transversioned-site/siteConfig.js index 661f59c981..ce9e264d72 100644 --- a/v2/test/load/__fixtures__/transversioned-site/siteConfig.js +++ b/v2/test/load/__fixtures__/transversioned-site/siteConfig.js @@ -4,5 +4,5 @@ module.exports = { organizationName: 'endiliey', projectName: 'hello', baseUrl: '/', - defaultLanguage: 'en' + defaultLanguage: 'en', }; diff --git a/v2/test/load/__fixtures__/versioned-site/siteConfig.js b/v2/test/load/__fixtures__/versioned-site/siteConfig.js index e64b9989cf..db81858cd9 100644 --- a/v2/test/load/__fixtures__/versioned-site/siteConfig.js +++ b/v2/test/load/__fixtures__/versioned-site/siteConfig.js @@ -3,5 +3,5 @@ module.exports = { tagline: 'Hello World', organizationName: 'endiliey', projectName: 'hello', - baseUrl: '/' + baseUrl: '/', }; diff --git a/v2/test/load/__fixtures__/wrong-site/siteConfig.js b/v2/test/load/__fixtures__/wrong-site/siteConfig.js index 2da4230ac5..68322e2d6c 100644 --- a/v2/test/load/__fixtures__/wrong-site/siteConfig.js +++ b/v2/test/load/__fixtures__/wrong-site/siteConfig.js @@ -7,5 +7,5 @@ module.exports = { useLessField: 'what', superman: 'lol', admin: 'endi', - customFields: ['admin', 'superman'] + customFields: ['admin', 'superman'], }; diff --git a/v2/test/load/config.test.js b/v2/test/load/config.test.js index 0288acfe39..36ec146fa9 100644 --- a/v2/test/load/config.test.js +++ b/v2/test/load/config.test.js @@ -12,7 +12,7 @@ describe('loadConfig', () => { docsUrl: 'docs', projectName: 'hello', tagline: 'Hello World', - title: 'Hello' + title: 'Hello', }); expect(config).not.toEqual({}); }); @@ -22,7 +22,7 @@ describe('loadConfig', () => { expect(() => { loadConfig(siteDir); }).toThrowErrorMatchingInlineSnapshot( - `"tagline, organizationName, projectName fields are missing in siteConfig.js"` + `"tagline, organizationName, projectName fields are missing in siteConfig.js"`, ); }); @@ -31,7 +31,7 @@ describe('loadConfig', () => { expect(() => { loadConfig(siteDir); }).toThrowErrorMatchingInlineSnapshot( - `"useLessField fields are useless in siteConfig.js"` + `"useLessField fields are useless in siteConfig.js"`, ); }); @@ -40,7 +40,7 @@ describe('loadConfig', () => { expect(() => { loadConfig(siteDir); }).toThrowErrorMatchingInlineSnapshot( - `"title, tagline, organizationName, projectName, baseUrl fields are missing in siteConfig.js"` + `"title, tagline, organizationName, projectName, baseUrl fields are missing in siteConfig.js"`, ); }); }); diff --git a/v2/test/load/docs/metadata.test.js b/v2/test/load/docs/metadata.test.js index bf2a96640a..9fe717009a 100644 --- a/v2/test/load/docs/metadata.test.js +++ b/v2/test/load/docs/metadata.test.js @@ -17,7 +17,7 @@ describe('processMetadata', () => { permalink: '/docs/foo/bar', source: '@docs/foo/bar.md', title: 'Bar', - version: undefined + version: undefined, }); expect(dataB).toEqual({ id: 'hello', @@ -26,7 +26,7 @@ describe('processMetadata', () => { permalink: '/docs/hello', source: '@docs/hello.md', title: 'Hello, World !', - version: undefined + version: undefined, }); }); @@ -42,7 +42,7 @@ describe('processMetadata', () => { permalink: '/docs/endiliey/permalink', source: '@docs/permalink.md', title: 'Permalink', - version: undefined + version: undefined, }); }); @@ -61,7 +61,7 @@ describe('processMetadata', () => { permalink: '/docs/1.0.0/foo/bar', source: '@versioned_docs/version-1.0.0/foo/bar.md', title: 'Bar', - version: '1.0.0' + version: '1.0.0', }); expect(dataB).toEqual({ id: 'version-1.0.0-hello', @@ -70,7 +70,7 @@ describe('processMetadata', () => { permalink: '/docs/1.0.0/hello', source: '@versioned_docs/version-1.0.0/hello.md', title: 'Hello, World !', - version: '1.0.0' + version: '1.0.0', }); }); @@ -93,7 +93,7 @@ describe('processMetadata', () => { permalink: '/docs/ko/1.0.0/foo/bar', source: '@translated_docs/ko/version-1.0.0/foo/bar.md', title: 'Bar', - version: '1.0.0' + version: '1.0.0', }); expect(dataB).toEqual({ id: 'ko-version-1.0.0-hello', @@ -102,7 +102,7 @@ describe('processMetadata', () => { permalink: '/docs/ko/1.0.0/hello', source: '@translated_docs/ko/version-1.0.0/hello.md', title: 'Hello, World !', - version: '1.0.0' + version: '1.0.0', }); expect(dataC).toEqual({ id: 'ko-version-1.0.1-foo/bar', @@ -111,7 +111,7 @@ describe('processMetadata', () => { permalink: '/docs/ko/foo/bar', source: '@translated_docs/ko/version-1.0.1/foo/bar.md', title: 'Bar', - version: '1.0.1' + version: '1.0.1', }); expect(dataD).toEqual({ id: 'ko-version-1.0.1-hello', @@ -120,7 +120,7 @@ describe('processMetadata', () => { permalink: '/docs/ko/hello', source: '@translated_docs/ko/version-1.0.1/hello.md', title: 'Hello, World !', - version: '1.0.1' + version: '1.0.1', }); }); @@ -139,7 +139,7 @@ describe('processMetadata', () => { permalink: '/docs/ko/foo/bar', source: '@translated_docs/ko/foo/bar.md', title: 'Bar', - version: undefined + version: undefined, }); expect(dataB).toEqual({ id: 'ko-hello', @@ -148,7 +148,7 @@ describe('processMetadata', () => { permalink: '/docs/ko/hello', source: '@translated_docs/ko/hello.md', title: 'Hello, World !', - version: undefined + version: undefined, }); }); }); diff --git a/v2/test/load/docs/order.test.js b/v2/test/load/docs/order.test.js index 65b2d5388c..f37b93684b 100644 --- a/v2/test/load/docs/order.test.js +++ b/v2/test/load/docs/order.test.js @@ -5,75 +5,75 @@ describe('createOrder', () => { const result = createOrder({ docs: { Category1: ['doc1', 'doc2'], - Category2: ['doc3', 'doc4'] + Category2: ['doc3', 'doc4'], }, otherDocs: { - Category1: ['doc5'] - } + Category1: ['doc5'], + }, }); expect(result).toEqual({ doc1: { category: 'Category1', next: 'doc2', previous: undefined, - sidebar: 'docs' + sidebar: 'docs', }, doc2: { category: 'Category1', next: 'doc3', previous: 'doc1', - sidebar: 'docs' + sidebar: 'docs', }, doc3: { category: 'Category2', next: 'doc4', previous: 'doc2', - sidebar: 'docs' + sidebar: 'docs', }, doc4: { category: 'Category2', next: undefined, previous: 'doc3', - sidebar: 'docs' + sidebar: 'docs', }, doc5: { category: 'Category1', next: undefined, previous: undefined, - sidebar: 'otherDocs' - } + sidebar: 'otherDocs', + }, }); }); test('should resolve docs from older versions', () => { const result = createOrder({ docs: { - Category1: ['doc1'] + Category1: ['doc1'], }, 'version-1.2.3-docs': { Category1: ['version-1.2.3-doc2'], - Category2: ['version-1.2.3-doc1'] - } + Category2: ['version-1.2.3-doc1'], + }, }); expect(result).toEqual({ doc1: { category: 'Category1', next: undefined, previous: undefined, - sidebar: 'docs' + sidebar: 'docs', }, 'version-1.2.3-doc1': { category: 'Category2', next: undefined, previous: 'version-1.2.3-doc2', - sidebar: 'version-1.2.3-docs' + sidebar: 'version-1.2.3-docs', }, 'version-1.2.3-doc2': { category: 'Category1', next: 'version-1.2.3-doc1', previous: undefined, - sidebar: 'version-1.2.3-docs' - } + sidebar: 'version-1.2.3-docs', + }, }); }); diff --git a/v2/test/load/docs/sidebars.test.js b/v2/test/load/docs/sidebars.test.js index 6aebf8e966..75246179e1 100644 --- a/v2/test/load/docs/sidebars.test.js +++ b/v2/test/load/docs/sidebars.test.js @@ -21,8 +21,8 @@ describe('loadSidebars', () => { const env = { versioning: { enabled: true, - versions: ['1.0.1', '1.0.0'] - } + versions: ['1.0.1', '1.0.0'], + }, }; const siteDir = path.join(fixtures, 'versioned-site'); const result = loadSidebars({siteDir, env}); @@ -33,14 +33,14 @@ describe('loadSidebars', () => { const env = { versioning: { enabled: true, - versions: ['2.0.0'] - } + versions: ['2.0.0'], + }, }; const siteDir = path.join(fixtures, 'versioned-site'); expect(() => { loadSidebars({siteDir, env}); }).toThrowErrorMatchingInlineSnapshot( - `"Failed to load versioned_sidebars/version-2.0.0-sidebars.json. It does not exist."` + `"Failed to load versioned_sidebars/version-2.0.0-sidebars.json. It does not exist."`, ); }); }); diff --git a/v2/test/load/env.test.js b/v2/test/load/env.test.js index 7724bf9186..bb7e90b4b2 100644 --- a/v2/test/load/env.test.js +++ b/v2/test/load/env.test.js @@ -9,7 +9,7 @@ describe('loadEnv', () => { organizationName: 'endiliey', projectName: 'hello', tagline: 'Hello World', - title: 'Hello' + title: 'Hello', }; const env = loadEnv({siteDir, siteConfig}); expect(env.versioning.enabled).toBe(false); @@ -24,7 +24,7 @@ describe('loadEnv', () => { organizationName: 'endiliey', projectName: 'hello', tagline: 'Hello World', - title: 'Hello' + title: 'Hello', }; const env = loadEnv({siteDir, siteConfig}); expect(env.versioning.enabled).toBe(true); @@ -40,7 +40,7 @@ describe('loadEnv', () => { projectName: 'hello', tagline: 'Hello World', title: 'Hello', - defaultLanguage: 'en' + defaultLanguage: 'en', }; const env = loadEnv({siteDir, siteConfig}); expect(env.versioning.enabled).toBe(false); @@ -56,7 +56,7 @@ describe('loadEnv', () => { projectName: 'hello', tagline: 'Hello World', title: 'Hello', - defaultLanguage: 'en' + defaultLanguage: 'en', }; const env = loadEnv({siteDir, siteConfig}); expect(env.versioning.enabled).toBe(true); @@ -71,12 +71,12 @@ describe('loadEnv', () => { organizationName: 'endiliey', projectName: 'hello', tagline: 'Hello World', - title: 'Hello' + title: 'Hello', }; expect(() => { loadEnv({siteDir, siteConfig}); }).toThrowErrorMatchingInlineSnapshot( - `"Please at least enable one language in 'languages.js'"` + `"Please at least enable one language in 'languages.js'"`, ); }); @@ -87,12 +87,12 @@ describe('loadEnv', () => { organizationName: 'endiliey', projectName: 'hello', tagline: 'Hello World', - title: 'Hello' + title: 'Hello', }; expect(() => { loadEnv({siteDir, siteConfig}); }).toThrowErrorMatchingInlineSnapshot( - `"Please set a default language in 'siteConfig.js' which is enabled in 'languages.js'"` + `"Please set a default language in 'siteConfig.js' which is enabled in 'languages.js'"`, ); }); }); diff --git a/v2/test/load/pages.test.js b/v2/test/load/pages.test.js index 4f43cf2779..84d165430d 100644 --- a/v2/test/load/pages.test.js +++ b/v2/test/load/pages.test.js @@ -9,20 +9,20 @@ describe('loadPages', () => { expect(pagesMetadatas).toEqual([ { path: '/', - source: 'index.js' + source: 'index.js', }, { path: '/bar/baz', - source: 'bar/baz.js' + source: 'bar/baz.js', }, { path: '/foo', - source: 'foo.js' + source: 'foo.js', }, { path: '/foo/', - source: 'foo/index.js' - } + source: 'foo/index.js', + }, ]); expect(pagesMetadatas).not.toBeNull(); }); diff --git a/v2/test/load/utils.test.js b/v2/test/load/utils.test.js index 8264c71e7e..87f129f461 100644 --- a/v2/test/load/utils.test.js +++ b/v2/test/load/utils.test.js @@ -3,7 +3,7 @@ import { fileToPath, fileToComponentName, idx, - getSubFolder + getSubFolder, } from '@lib/load/utils'; describe('load utils', () => { @@ -18,7 +18,7 @@ describe('load utils', () => { 'docusaurus/index.js': 'JSDocusaurusIndex', '234.md': 'MD234', '2018-07-08-test.md': 'MD20180708Test', - '%asd.md': 'MDAsd' + '%asd.md': 'MDAsd', }; Object.keys(asserts).forEach(file => { expect(fileToComponentName(file)).toBe(asserts[file]); @@ -34,7 +34,7 @@ describe('load utils', () => { 'index.js': '/', 'hello/index.js': '/hello/', 'foo.js': '/foo', - 'foo/bar.js': '/foo/bar' + 'foo/bar.js': '/foo/bar', }; Object.keys(asserts).forEach(file => { expect(fileToPath(file)).toBe(asserts[file]); @@ -51,19 +51,19 @@ describe('load utils', () => { { enabled: true, name: 'English', - tag: 'en' + tag: 'en', }, { enabled: true, name: 'ζ—₯本θͺž', - tag: 'ja' - } - ] + tag: 'ja', + }, + ], }, versioning: { enabled: false, - versions: [] - } + versions: [], + }, }; const test = {arr: [1, 2, 3]}; const variable = 'enabledLanguages'; @@ -73,12 +73,12 @@ describe('load utils', () => { expect(idx(env, 'typo')).toBeUndefined(); expect(idx(env, 'versioning')).toEqual({ enabled: false, - versions: [] + versions: [], }); expect(idx(env, ['translation', 'enabled'])).toEqual(true); expect(idx(env, ['translation', variable]).map(lang => lang.tag)).toEqual([ 'en', - 'ja' + 'ja', ]); expect(idx(test, ['arr', 0])).toEqual(1); expect(idx(undefined)).toBeUndefined(); diff --git a/v2/test/webpack/utils.test.js b/v2/test/webpack/utils.test.js index 8ffd610fbe..87bf0277e2 100644 --- a/v2/test/webpack/utils.test.js +++ b/v2/test/webpack/utils.test.js @@ -10,8 +10,8 @@ describe('extending generated webpack config', () => { let config = { output: { path: __dirname, - filename: 'bundle.js' - } + filename: 'bundle.js', + }, }; /* eslint-disable */ @@ -20,7 +20,7 @@ describe('extending generated webpack config', () => { generatedConfig.entry = 'entry.js'; generatedConfig.output = { path: path.join(__dirname, 'dist'), - filename: 'new.bundle.js' + filename: 'new.bundle.js', }; } }; @@ -31,8 +31,8 @@ describe('extending generated webpack config', () => { entry: 'entry.js', output: { path: path.join(__dirname, 'dist'), - filename: 'new.bundle.js' - } + filename: 'new.bundle.js', + }, }); const errors = validate(config); @@ -45,8 +45,8 @@ describe('extending generated webpack config', () => { let config = { output: { path: __dirname, - filename: 'bundle.js' - } + filename: 'bundle.js', + }, }; /* eslint-disable */ @@ -54,8 +54,8 @@ describe('extending generated webpack config', () => { entry: 'entry.js', output: { path: path.join(__dirname, 'dist'), - filename: 'new.bundle.js' - } + filename: 'new.bundle.js', + }, }; /* eslint-enable */ @@ -64,8 +64,8 @@ describe('extending generated webpack config', () => { entry: 'entry.js', output: { path: path.join(__dirname, 'dist'), - filename: 'new.bundle.js' - } + filename: 'new.bundle.js', + }, }); const errors = validate(config); expect(errors.length).toBe(0); @@ -95,11 +95,11 @@ describe('extending generated webpack config', () => { expect(config).toEqual({ output: { path: path.join(__dirname, 'dist'), - filename: 'new.bundle.js' + filename: 'new.bundle.js', }, entry: { - main: ['./entry.js'] - } + main: ['./entry.js'], + }, }); const errors = validate(config); expect(errors.length).toBe(0); diff --git a/v2/website/components/Tictactoe/index.js b/v2/website/components/Tictactoe/index.js index 9c2051109e..66eaa066c5 100644 --- a/v2/website/components/Tictactoe/index.js +++ b/v2/website/components/Tictactoe/index.js @@ -10,11 +10,11 @@ class Game extends React.Component { this.state = { history: [ { - squares: Array(9).fill(null) - } + squares: Array(9).fill(null), + }, ], stepNumber: 0, - xIsNext: true + xIsNext: true, }; } @@ -27,7 +27,7 @@ class Game extends React.Component { [1, 4, 7], [2, 5, 8], [0, 4, 8], - [2, 4, 6] + [2, 4, 6], ]; for (let i = 0; i < lines.length; i++) { const [a, b, c] = lines[i]; @@ -53,18 +53,18 @@ class Game extends React.Component { this.setState({ history: history.concat([ { - squares: squares - } + squares: squares, + }, ]), stepNumber: history.length, - xIsNext: !this.state.xIsNext + xIsNext: !this.state.xIsNext, }); } jumpTo(step) { this.setState({ stepNumber: step, - xIsNext: step % 2 === 0 + xIsNext: step % 2 === 0, }); } diff --git a/v2/website/components/Todo/TodoItem.js b/v2/website/components/Todo/TodoItem.js index a6a68879d5..0a0c68df54 100644 --- a/v2/website/components/Todo/TodoItem.js +++ b/v2/website/components/Todo/TodoItem.js @@ -9,7 +9,7 @@ export default class TodoItem extends React.Component { constructor(props) { super(props); this.state = { - editText: props.todo.title + editText: props.todo.title, }; this.handleEdit = this.handleEdit.bind(this); this.handleSubmit = this.handleSubmit.bind(this); @@ -68,7 +68,7 @@ export default class TodoItem extends React.Component {
  • - Object.assign({}, todo, {completed: checked}) - ) + Object.assign({}, todo, {completed: checked}), + ), }); } @@ -96,17 +96,17 @@ class TodoApp extends React.Component { todos: this.state.todos.map(todo => { if (todo === todoToToggle) { return Object.assign({}, todo, { - completed: !todo.completed + completed: !todo.completed, }); } return todo; - }) + }), }); } destroy(passedTodo) { this.setState({ - todos: this.state.todos.filter(todo => todo !== passedTodo) + todos: this.state.todos.filter(todo => todo !== passedTodo), }); } @@ -119,12 +119,12 @@ class TodoApp extends React.Component { todos: this.state.todos.map(todo => { if (todo === todoToSave) { return Object.assign({}, todo, { - title: text + title: text, }); } return todo; }), - editing: null + editing: null, }); } @@ -134,7 +134,7 @@ class TodoApp extends React.Component { clearCompleted() { this.setState({ - todos: this.state.todos.filter(todo => !todo.completed) + todos: this.state.todos.filter(todo => !todo.completed), }); } @@ -144,7 +144,7 @@ class TodoApp extends React.Component { const activeTodoCount = todos.reduce( (accum, todo) => (todo.completed ? accum : accum + 1), - 0 + 0, ); if (todos.length) { diff --git a/v2/website/pages/youtube.js b/v2/website/pages/youtube.js index 04a7709620..2aeac31350 100644 --- a/v2/website/pages/youtube.js +++ b/v2/website/pages/youtube.js @@ -9,8 +9,8 @@ export default class Player extends React.Component { height: '390', width: '640', playerVars: { - autoplay: 1 - } + autoplay: 1, + }, }; return ( @@ -19,8 +19,8 @@ export default class Player extends React.Component { My Youtube

    - {/* this is a React-youtube component */ } - + {/* this is a React-youtube component */} +

    ); diff --git a/v2/website/siteConfig.js b/v2/website/siteConfig.js index 4c261d7b27..c238751164 100644 --- a/v2/website/siteConfig.js +++ b/v2/website/siteConfig.js @@ -3,5 +3,5 @@ module.exports = { tagline: 'πŸ“βš‘οΈ Transform your document (λ¬Έμ„œ) to a website', organizationName: 'endiliey', projectName: 'munseo', - baseUrl: '/' + baseUrl: '/', }; diff --git a/website/pages/en/versions.js b/website/pages/en/versions.js index b2f7d25120..95e5c8074b 100644 --- a/website/pages/en/versions.js +++ b/website/pages/en/versions.js @@ -95,7 +95,7 @@ function Versions(props) { - ) + ), )} diff --git a/website/static/js/code-blocks-buttons.js b/website/static/js/code-blocks-buttons.js index 0606b056ac..e4fb913d98 100644 --- a/website/static/js/code-blocks-buttons.js +++ b/website/static/js/code-blocks-buttons.js @@ -27,7 +27,7 @@ window.addEventListener('load', function() { addButtons( '.hljs', - button('Copy', 'Copy code to clipboard', copyIcon, 'btnClipboard') + button('Copy', 'Copy code to clipboard', copyIcon, 'btnClipboard'), ); const clipboard = new ClipboardJS('.btnClipboard', {