From 00e8ce68b561f765855253fd01d7b074a1465b96 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Mon, 17 Sep 2018 15:09:10 +0800 Subject: [PATCH 1/4] Prettify all JavaScript files --- .prettierignore | 1 - docusaurus-init/initialize.js | 36 +++++++++---------- package.json | 23 +++--------- v2/lib/commands/build.js | 4 +-- v2/lib/commands/start.js | 16 ++++----- v2/lib/core/App.js | 2 +- v2/lib/core/serverEntry.js | 2 +- v2/lib/index.js | 2 +- v2/lib/load/config.js | 6 ++-- v2/lib/load/docs/index.js | 8 ++--- v2/lib/load/docs/order.js | 2 +- v2/lib/load/env.js | 6 ++-- v2/lib/load/index.js | 6 ++-- v2/lib/load/pages.js | 4 +-- v2/lib/load/utils.js | 2 +- v2/lib/theme/Docs/index.js | 2 +- v2/lib/theme/Layout/index.js | 2 +- v2/lib/theme/Markdown/index.js | 10 +++--- v2/lib/webpack/base.js | 18 +++++----- v2/lib/webpack/loader/markdown.js | 2 +- v2/lib/webpack/server.js | 8 ++--- v2/lib/webpack/utils.js | 2 +- .../__fixtures__/custom-site/siteConfig.js | 2 +- .../__fixtures__/simple-site/siteConfig.js | 2 +- .../translated-site/siteConfig.js | 2 +- .../transversioned-site/siteConfig.js | 2 +- .../__fixtures__/versioned-site/siteConfig.js | 2 +- v2/test/jest.config.js | 4 +-- .../load/__fixtures__/bad-site/siteConfig.js | 2 +- .../__fixtures__/simple-site/siteConfig.js | 2 +- .../translated-site/siteConfig.js | 2 +- .../transversioned-site/siteConfig.js | 2 +- .../__fixtures__/versioned-site/siteConfig.js | 2 +- .../__fixtures__/wrong-site/siteConfig.js | 2 +- v2/test/load/config.test.js | 2 +- v2/test/load/docs/metadata.test.js | 22 ++++++------ v2/test/load/docs/order.test.js | 32 ++++++++--------- v2/test/load/docs/sidebars.test.js | 8 ++--- v2/test/load/env.test.js | 12 +++---- v2/test/load/pages.test.js | 10 +++--- v2/test/load/utils.test.js | 22 ++++++------ v2/test/webpack/utils.test.js | 28 +++++++-------- v2/website/components/Tictactoe/index.js | 16 ++++----- v2/website/components/Todo/TodoItem.js | 4 +-- v2/website/components/Todo/index.js | 34 +++++++++--------- v2/website/pages/youtube.js | 8 ++--- v2/website/siteConfig.js | 2 +- 47 files changed, 187 insertions(+), 203 deletions(-) delete mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 8494ac270647..000000000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -v2 \ No newline at end of file diff --git a/docusaurus-init/initialize.js b/docusaurus-init/initialize.js index 942d469405a8..a08af04936a9 100644 --- a/docusaurus-init/initialize.js +++ b/docusaurus-init/initialize.js @@ -7,19 +7,19 @@ * 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." ); @@ -28,32 +28,32 @@ if (fs.existsSync(CWD + "/website")) { 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/package.json b/package.json index fd0931bfb7eb..a92ad618131f 100644 --- a/package.json +++ b/package.json @@ -3,28 +3,17 @@ "description": "Easy to Maintain Open Source Documentation Websites", "version": "1.4.0", "license": "MIT", - "keywords": [ - "documentation", - "websites", - "open source", - "docusaurus" - ], + "keywords": ["documentation", "websites", "open source", "docusaurus"], "repository": { "type": "git", "url": "https://github.com/facebook/Docusaurus.git" }, "scripts": { "ci-check": "yarn lint && yarn prettier:diff", - "format:source": "prettier --config .prettierrc --write \"lib/**/*.js\"", - "format:examples": "prettier --config .prettierrc --write \"examples/**/*.js\"", - "format:website": "prettier --config .prettierrc --write \"website/**/*.js\"", "lint": "eslint --cache \"lib/**/*.js\" \"examples/**/*.js\" \"website/**/*.js\"", - "nit:source": "prettier --config .prettierrc --list-different \"lib/**/*.js\"", - "nit:examples": "prettier --config .prettierrc --list-different \"examples/**/*.js\"", - "nit:website": "prettier --config .prettierrc --list-different \"website/**/*.js\"", "precommit": "lint-staged", - "prettier": "yarn format:source && yarn format:examples && yarn format:website", - "prettier:diff": "yarn nit:source && yarn nit:examples && yarn nit:website", + "prettier": "prettier --config .prettierrc --write \"**/*.js\"", + "prettier:diff": "prettier --config .prettierrc --list-different \"**/*.js\"", "test": "jest", "start": "cd website && yarn start", "postinstall": "opencollective postinstall" @@ -39,11 +28,7 @@ } }, "jest": { - "testPathIgnorePatterns": [ - "/node_modules/", - "__fixtures__", - "v2" - ], + "testPathIgnorePatterns": ["/node_modules/", "__fixtures__", "v2"], "testURL": "http://localhost/" }, "bin": { diff --git a/v2/lib/commands/build.js b/v2/lib/commands/build.js index a2da9b3ddaa9..f2d05abb2e90 100644 --- a/v2/lib/commands/build.js +++ b/v2/lib/commands/build.js @@ -42,7 +42,7 @@ module.exports = async function build(siteDir, cliOptions = {}) { // apply user webpack config const { - siteConfig: {configureWebpack} + siteConfig: {configureWebpack}, } = props; clientConfig = applyConfigureWebpack(configureWebpack, clientConfig, false); serverConfig = applyConfigureWebpack(configureWebpack, serverConfig, true); @@ -58,7 +58,7 @@ module.exports = async function build(siteDir, cliOptions = {}) { const {outDir} = props; const staticDir = path.resolve(siteDir, 'static'); const staticFiles = await globby(['**'], { - cwd: staticDir + cwd: staticDir, }); await Promise.all( staticFiles.map(async source => { diff --git a/v2/lib/commands/start.js b/v2/lib/commands/start.js index bc4a35052028..0625944dbdca 100644 --- a/v2/lib/commands/start.js +++ b/v2/lib/commands/start.js @@ -44,7 +44,7 @@ module.exports = async function start(siteDir, cliOptions = {}) { [`../${docsRelativeDir}/**/*.md`, 'blog/**/*.md', 'siteConfig.js'], { cwd: siteDir, - ignoreInitial: true + ignoreInitial: true, } ); fsWatcher.on('add', reload); @@ -69,14 +69,14 @@ module.exports = async function start(siteDir, cliOptions = {}) { hash: true, template: path.resolve(__dirname, '../core/devTemplate.ejs'), filename: 'index.html', - title: siteConfig.title - } + title: siteConfig.title, + }, ]); config = config.toConfig(); // apply user webpack config const { - siteConfig: {configureWebpack} + siteConfig: {configureWebpack}, } = props; config = applyConfigureWebpack(configureWebpack, config, false); @@ -90,11 +90,11 @@ module.exports = async function start(siteDir, cliOptions = {}) { compiler, open: true, devMiddleware: { - logLevel: 'silent' + logLevel: 'silent', }, hotClient: { port: hotPort, - logLevel: 'error' + logLevel: 'error', }, logLevel: 'error', port, @@ -113,11 +113,11 @@ module.exports = async function start(siteDir, cliOptions = {}) { app.use( convert( history({ - rewrites: [{from: /\.html$/, to: '/'}] + rewrites: [{from: /\.html$/, to: '/'}], }) ) ); - } + }, } ); }, 1000); diff --git a/v2/lib/core/App.js b/v2/lib/core/App.js index 4fabf192dc63..6023181b948f 100644 --- a/v2/lib/core/App.js +++ b/v2/lib/core/App.js @@ -11,5 +11,5 @@ export default () => docsMetadatas, docsSidebars, pagesMetadatas, - siteConfig + siteConfig, }); diff --git a/v2/lib/core/serverEntry.js b/v2/lib/core/serverEntry.js index 1bd7dab1803a..9c71629dc43d 100644 --- a/v2/lib/core/serverEntry.js +++ b/v2/lib/core/serverEntry.js @@ -24,7 +24,7 @@ export default function render(locals) { const metaStrings = [ helmet.title.toString(), helmet.meta.toString(), - helmet.link.toString() + helmet.link.toString(), ]; const metaHtml = metaStrings.filter(Boolean).join('\n '); diff --git a/v2/lib/index.js b/v2/lib/index.js index 03c0a0dab087..5f5bb5b265bc 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 890b92ddfbcf..c164c08027df 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,7 +26,7 @@ module.exports = function loadConfig(siteDir, deleteCache = true) { 'configureWebpack', 'chainWebpack', 'docsUrl', - 'customFields' + 'customFields', ]; const missingFields = requiredFields.filter(field => !config[field]); if (missingFields && missingFields.length > 0) { @@ -38,7 +38,7 @@ module.exports = function loadConfig(siteDir, deleteCache = true) { /* Fill default value */ const defaultConfig = { customDocsPath: 'docs', - docsUrl: 'docs' + docsUrl: 'docs', }; Object.keys(defaultConfig).forEach(field => { if (!config[field]) { diff --git a/v2/lib/load/docs/index.js b/v2/lib/load/docs/index.js index fd7e6aa74842..328a5c5f26a6 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 => { @@ -57,7 +57,7 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { 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 => { @@ -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 => { @@ -122,7 +122,7 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { return { docsSidebars, - docsMetadatas + docsMetadatas, }; } diff --git a/v2/lib/load/docs/order.js b/v2/lib/load/docs/order.js index 5f9f6c347832..52c8ca9a7e46 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/env.js b/v2/lib/load/env.js index 41d45fcd68bd..ecdb6e322640 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'); @@ -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 2dd0bd4ff367..426b55c9e417 100644 --- a/v2/lib/load/index.js +++ b/v2/lib/load/index.js @@ -24,7 +24,7 @@ module.exports = async function load(siteDir) { siteDir, docsDir, env, - siteConfig + siteConfig, }); await generate( 'docsMetadatas.js', @@ -42,7 +42,7 @@ module.exports = async function load(siteDir) { sourceToMetadata[source] = { version, permalink, - language + language, }; } ); @@ -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 5c1b46f6da07..266cd38a2499 100644 --- a/v2/lib/load/pages.js +++ b/v2/lib/load/pages.js @@ -3,13 +3,13 @@ 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/utils.js b/v2/lib/load/utils.js index 060bcea9ac92..58699e1f6d58 100644 --- a/v2/lib/load/utils.js +++ b/v2/lib/load/utils.js @@ -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 8d4217d37fba..3588c3d09f25 100644 --- a/v2/lib/theme/Docs/index.js +++ b/v2/lib/theme/Docs/index.js @@ -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 d96ab6d10c37..7e15ca32de0e 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 => diff --git a/v2/lib/theme/Markdown/index.js b/v2/lib/theme/Markdown/index.js index 6eb0a378d1f4..29f8fd7ea78d 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,7 +64,7 @@ class MarkdownBlock extends React.Component { {}, { version: '9.12.0', - theme: 'default' + theme: 'default', }, siteConfig.highlight ); @@ -88,7 +88,7 @@ class MarkdownBlock extends React.Component { } MarkdownBlock.defaultProps = { - siteConfig: {} + siteConfig: {}, }; export default MarkdownBlock; diff --git a/v2/lib/webpack/base.js b/v2/lib/webpack/base.js index 61e4220a7e7c..433ffb5c7feb 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 e5893299a67c..2f8a26dd055c 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 f6aacc1c22b7..160413e20c5c 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 369bb5db8779..abb0698e83df 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/test/__fixtures__/custom-site/siteConfig.js b/v2/test/__fixtures__/custom-site/siteConfig.js index 3c5b2a6f4299..ec13fde0a700 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 e64b9989cf7a..db81858cd9b4 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 661f59c98134..ce9e264d72e4 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 661f59c98134..ce9e264d72e4 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 e64b9989cf7a..db81858cd9b4 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 7c7392384c02..8b8076775e33 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 2f574304238f..ab2a89fa2a10 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 e64b9989cf7a..db81858cd9b4 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 661f59c98134..ce9e264d72e4 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 661f59c98134..ce9e264d72e4 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 e64b9989cf7a..db81858cd9b4 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 2da4230ac578..68322e2d6c0c 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 0288acfe3975..94eaf64d4e46 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({}); }); diff --git a/v2/test/load/docs/metadata.test.js b/v2/test/load/docs/metadata.test.js index bf2a96640a71..9fe717009a72 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 65b2d5388c22..f37b93684b9f 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 6aebf8e966eb..1548c589e1af 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,8 +33,8 @@ describe('loadSidebars', () => { const env = { versioning: { enabled: true, - versions: ['2.0.0'] - } + versions: ['2.0.0'], + }, }; const siteDir = path.join(fixtures, 'versioned-site'); expect(() => { diff --git a/v2/test/load/env.test.js b/v2/test/load/env.test.js index 7724bf9186de..54295a7a1585 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,7 +71,7 @@ describe('loadEnv', () => { organizationName: 'endiliey', projectName: 'hello', tagline: 'Hello World', - title: 'Hello' + title: 'Hello', }; expect(() => { loadEnv({siteDir, siteConfig}); @@ -87,7 +87,7 @@ describe('loadEnv', () => { organizationName: 'endiliey', projectName: 'hello', tagline: 'Hello World', - title: 'Hello' + title: 'Hello', }; expect(() => { loadEnv({siteDir, siteConfig}); diff --git a/v2/test/load/pages.test.js b/v2/test/load/pages.test.js index 4f43cf2779cf..84d165430d63 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 8264c71e7e4b..87f129f46181 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 8ffd610fbe4e..87bf0277e200 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 9c2051109ede..66eaa066c5d6 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 a6a68879d586..0a0c68df54f3 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}) - ) + ), }); } @@ -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), }); } diff --git a/v2/website/pages/youtube.js b/v2/website/pages/youtube.js index 04a7709620f3..2aeac3135025 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 4c261d7b2749..c23875116425 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: '/', }; From 8e47158a59027b420b22812fcc1e3c9d8ae6d07d Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Mon, 17 Sep 2018 15:25:04 +0800 Subject: [PATCH 2/4] Make trailingComma all --- .prettierrc | 2 +- docusaurus-init/initialize.js | 6 +-- examples/basics/pages/en/help.js | 2 +- examples/versions/pages/en/versions.js | 2 +- lib/__tests__/build-files.test.js | 8 ++-- lib/build-files.js | 2 +- lib/copy-examples.js | 56 ++++++++++++------------ lib/core/BlogPageLayout.js | 2 +- lib/core/BlogPost.js | 4 +- lib/core/Doc.js | 4 +- lib/core/DocsLayout.js | 6 +-- lib/core/Head.js | 8 ++-- lib/core/Site.js | 2 +- lib/core/__tests__/anchors.test.js | 24 +++++----- lib/core/__tests__/toc.test.js | 4 +- lib/core/__tests__/utils.test.js | 18 ++++---- lib/core/nav/HeaderNav.js | 12 ++--- lib/core/nav/SideNav.js | 2 +- lib/core/toSlug.js | 2 +- lib/publish-gh-pages.js | 10 ++--- lib/rename-version.js | 24 +++++----- lib/server/__tests__/blog.test.js | 6 +-- lib/server/__tests__/docs.test.js | 14 +++--- lib/server/__tests__/start.test.js | 2 +- lib/server/__tests__/utils.test.js | 10 ++--- lib/server/blog.js | 4 +- lib/server/docs.js | 8 ++-- lib/server/env.js | 2 +- lib/server/generate.js | 34 +++++++------- lib/server/liveReloadServer.js | 2 +- lib/server/readCategories.js | 2 +- lib/server/readMetadata.js | 12 ++--- lib/server/routing.js | 2 +- lib/server/server.js | 28 ++++++------ lib/server/translate-plugin.js | 6 +-- lib/server/translate.js | 4 +- lib/server/utils.js | 2 +- lib/server/versionFallback.js | 30 ++++++------- lib/start-server.js | 2 +- lib/version.js | 14 +++--- lib/write-translations.js | 16 +++---- v2/.prettierrc | 8 ---- v2/bin/munseo.js | 6 +-- v2/lib/commands/build.js | 6 +-- v2/lib/commands/eject.js | 4 +- v2/lib/commands/start.js | 8 ++-- v2/lib/core/clientEntry.js | 2 +- v2/lib/core/prerender.js | 2 +- v2/lib/core/serverEntry.js | 6 +-- v2/lib/load/config.js | 6 +-- v2/lib/load/docs/index.js | 12 ++--- v2/lib/load/docs/metadata.js | 4 +- v2/lib/load/docs/sidebars.js | 2 +- v2/lib/load/env.js | 4 +- v2/lib/load/index.js | 10 ++--- v2/lib/load/pages.js | 2 +- v2/lib/load/theme.js | 2 +- v2/lib/load/utils.js | 2 +- v2/lib/theme/Docs/index.js | 2 +- v2/lib/theme/Layout/index.js | 2 +- v2/lib/theme/Markdown/highlight.js | 4 +- v2/lib/theme/Markdown/index.js | 2 +- v2/lib/theme/Markdown/toSlug.js | 2 +- v2/test/load/config.test.js | 6 +-- v2/test/load/docs/sidebars.test.js | 2 +- v2/test/load/env.test.js | 4 +- v2/website/components/Todo/index.js | 4 +- website/pages/en/versions.js | 2 +- website/static/js/code-blocks-buttons.js | 2 +- 69 files changed, 255 insertions(+), 263 deletions(-) delete mode 100644 v2/.prettierrc diff --git a/.prettierrc b/.prettierrc index a9f52d15309e..3eff994f47a6 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 a08af04936a9..7b6c10d35f2d 100644 --- a/docusaurus-init/initialize.js +++ b/docusaurus-init/initialize.js @@ -21,7 +21,7 @@ if (shell.which('yarn')) { 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); } @@ -35,13 +35,13 @@ console.log(chalk.green('Website folder created!\n')); 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'}}; fs.writeFileSync( CWD + '/website/package.json', - JSON.stringify(packageContent, null, 2) + '\n' + JSON.stringify(packageContent, null, 2) + '\n', ); if (useYarn) { diff --git a/examples/basics/pages/en/help.js b/examples/basics/pages/en/help.js index f50dbbb94c83..512e335a99cb 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 d0895688fa67..286464fc177c 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 e2b5b7ed0c59..0260e582490f 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 83ed4ceaa9ed..cd003b49aeaf 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 c766676b7910..3fbc67b8b823 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 25098e6eec73..a63d4c3d4054 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 da61433d71a5..bad8435d9dc0 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 9c15e9542b6c..b3d3e1e3030e 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 3f47790a0763..9fc259935a77 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/load/config.js b/v2/lib/load/config.js index c164c08027df..09688e3417ca 100644 --- a/v2/lib/load/config.js +++ b/v2/lib/load/config.js @@ -31,7 +31,7 @@ module.exports = function loadConfig(siteDir, deleteCache = true) { 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`, ); } @@ -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 328a5c5f26a6..b1d6165f327f 100644 --- a/v2/lib/load/docs/index.js +++ b/v2/lib/load/docs/index.js @@ -47,10 +47,10 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { docsDir, env, order, - siteConfig + siteConfig, ); docsMetadatas[metadata.id] = metadata; - }) + }), ); /* metadata for non-default-language docs */ @@ -79,10 +79,10 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { translatedDir, env, order, - siteConfig + siteConfig, ); docsMetadatas[metadata.id] = metadata; - }) + }), ); } @@ -99,10 +99,10 @@ async function loadDocs({siteDir, docsDir, env, siteConfig}) { versionedDir, env, order, - siteConfig + siteConfig, ); docsMetadatas[metadata.id] = metadata; - }) + }), ); } diff --git a/v2/lib/load/docs/metadata.js b/v2/lib/load/docs/metadata.js index 9a8c2687dcbe..45c0ff86bf66 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/sidebars.js b/v2/lib/load/docs/sidebars.js index fd27c22177b6..ac901ab1950a 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 ecdb6e322640..530321bc4641 100644 --- a/v2/lib/load/env.js +++ b/v2/lib/load/env.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; diff --git a/v2/lib/load/index.js b/v2/lib/load/index.js index 426b55c9e417..3b2f86dff744 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 @@ -28,11 +28,11 @@ module.exports = async function load(siteDir) { }); 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 */ @@ -44,7 +44,7 @@ module.exports = async function load(siteDir) { permalink, 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 diff --git a/v2/lib/load/pages.js b/v2/lib/load/pages.js index 266cd38a2499..7af30239c078 100644 --- a/v2/lib/load/pages.js +++ b/v2/lib/load/pages.js @@ -10,7 +10,7 @@ async function loadPages(pagesDir) { pagesFiles.map(async source => ({ path: encodePath(fileToPath(source)), source, - })) + })), ); return pagesMetadatas; } diff --git a/v2/lib/load/theme.js b/v2/lib/load/theme.js index a4643feb5c28..3a5b6cfc4a0f 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 58699e1f6d58..08708810e7be 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]; diff --git a/v2/lib/theme/Docs/index.js b/v2/lib/theme/Docs/index.js index 3588c3d09f25..3aff930ce506 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 = diff --git a/v2/lib/theme/Layout/index.js b/v2/lib/theme/Layout/index.js index 7e15ca32de0e..775f1ae2792d 100644 --- a/v2/lib/theme/Layout/index.js +++ b/v2/lib/theme/Layout/index.js @@ -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 643856b5500d..111de59b2596 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 29f8fd7ea78d..b0716e6800ad 100644 --- a/v2/lib/theme/Markdown/index.js +++ b/v2/lib/theme/Markdown/index.js @@ -66,7 +66,7 @@ class MarkdownBlock extends React.Component { version: '9.12.0', theme: 'default', }, - siteConfig.highlight + siteConfig.highlight, ); // Use user-provided themeUrl if it exists, else construct one from version and theme. diff --git a/v2/lib/theme/Markdown/toSlug.js b/v2/lib/theme/Markdown/toSlug.js index 13bf5725961c..b6598d883137 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/test/load/config.test.js b/v2/test/load/config.test.js index 94eaf64d4e46..36ec146fa99b 100644 --- a/v2/test/load/config.test.js +++ b/v2/test/load/config.test.js @@ -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/sidebars.test.js b/v2/test/load/docs/sidebars.test.js index 1548c589e1af..75246179e140 100644 --- a/v2/test/load/docs/sidebars.test.js +++ b/v2/test/load/docs/sidebars.test.js @@ -40,7 +40,7 @@ describe('loadSidebars', () => { 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 54295a7a1585..bb7e90b4b2e0 100644 --- a/v2/test/load/env.test.js +++ b/v2/test/load/env.test.js @@ -76,7 +76,7 @@ describe('loadEnv', () => { expect(() => { loadEnv({siteDir, siteConfig}); }).toThrowErrorMatchingInlineSnapshot( - `"Please at least enable one language in 'languages.js'"` + `"Please at least enable one language in 'languages.js'"`, ); }); @@ -92,7 +92,7 @@ describe('loadEnv', () => { 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/website/components/Todo/index.js b/v2/website/components/Todo/index.js index b5cd31f58202..a827eb499445 100644 --- a/v2/website/components/Todo/index.js +++ b/v2/website/components/Todo/index.js @@ -86,7 +86,7 @@ class TodoApp extends React.Component { const {checked} = event.target; this.setState({ todos: this.state.todos.map(todo => - Object.assign({}, todo, {completed: checked}) + Object.assign({}, todo, {completed: checked}), ), }); } @@ -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/website/pages/en/versions.js b/website/pages/en/versions.js index b2f7d2512001..95e5c8074b7b 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 0606b056ac85..e4fb913d9870 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', { From 56bf5e7f1614236d21cdf282f06a4384db3e13ee Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Mon, 17 Sep 2018 15:26:17 +0800 Subject: [PATCH 3/4] Delete v2/.prettierignore --- v2/.prettierignore | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 v2/.prettierignore diff --git a/v2/.prettierignore b/v2/.prettierignore deleted file mode 100644 index 9eb5d6bb2009..000000000000 --- a/v2/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -generated -__fixtures__ -dist \ No newline at end of file From ad840b9f1a45a1964c4ef1357a0f835831eb7f89 Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Mon, 17 Sep 2018 15:30:22 +0800 Subject: [PATCH 4/4] Remove v2 Prettier commands in package.json --- v2/package.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/v2/package.json b/v2/package.json index 0257afd7a8a7..0f70dd57d7f7 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": {