diff --git a/.eslintrc.js b/.eslintrc.js index 251595e0b7..1e4e616f8a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -57,6 +57,7 @@ module.exports = { 'react/prop-types': OFF, 'react/destructuring-assignment': OFF, // Too many lines. 'react/prefer-stateless-function': WARNING, + 'react/jsx-props-no-spreading': OFF, 'react-hooks/rules-of-hooks': ERROR, }, }; diff --git a/babel.config.js b/babel.config.js index 49dba51c32..9b67d9a9f0 100644 --- a/babel.config.js +++ b/babel.config.js @@ -21,5 +21,7 @@ module.exports = { plugins: [ '@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-object-rest-spread', + '@babel/plugin-proposal-nullish-coalescing-operator', + '@babel/plugin-proposal-optional-chaining', ], }; diff --git a/package.json b/package.json index 1d1665a2f7..a6c7559f7c 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,8 @@ }, "devDependencies": { "@babel/core": "^7.7.2", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", + "@babel/plugin-proposal-optional-chaining": "^7.6.0", "@babel/preset-typescript": "^7.7.2", "@types/cross-spawn": "^6.0.1", "@types/express": "^4.17.1", @@ -41,30 +43,25 @@ "@types/webpack": "^4.32.0", "@types/webpack-dev-server": "^3.1.5", "@types/webpack-merge": "^4.1.5", - "babel-eslint": "8", - "enzyme": "^3.9.0", - "enzyme-adapter-react-16": "^1.12.1", - "eslint": "4.x", - "eslint-config-airbnb": "17.1.0", - "eslint-config-prettier": "^2.9.0", + "babel-eslint": "^10.0.3", + "enzyme": "^3.10.0", + "enzyme-adapter-react-16": "^1.15.1", + "eslint": "^6.6.0", + "eslint-config-airbnb": "^18.0.1", + "eslint-config-prettier": "^6.5.0", "eslint-plugin-header": "^3.0.0", - "eslint-plugin-import": "^2.14.0", - "eslint-plugin-jsx-a11y": "^6.0.3", - "eslint-plugin-react": "^7.11.1", - "eslint-plugin-react-hooks": "^0.0.0", - "filepath": "^1.1.0", - "front-matter": "^2.3.0", - "glob-promise": "^3.3.0", - "husky": "^1.3.1", + "eslint-plugin-import": "^2.18.2", + "eslint-plugin-jsx-a11y": "^6.2.3", + "eslint-plugin-react": "^7.16.0", + "eslint-plugin-react-hooks": "^2.2.0", + "husky": "^3.0.9", "jest": "^24.9.0", "lerna": "^3.18.1", "lerna-changelog": "^0.8.2", "lint-staged": "^7.2.0", - "picomatch": "^2.1.0", - "prettier": "^1.18.2", + "prettier": "^1.19.0", "react": "^16.8.4", "react-dom": "^16.8.4", - "rimraf": "^2.6.3", "typescript": "^3.7.2" }, "lint-staged": { diff --git a/packages/docusaurus-1.x/.eslintrc.js b/packages/docusaurus-1.x/.eslintrc.js index a7464f1fda..97fb7fa8e3 100644 --- a/packages/docusaurus-1.x/.eslintrc.js +++ b/packages/docusaurus-1.x/.eslintrc.js @@ -33,6 +33,10 @@ module.exports = { 'react/button-has-type': OFF, // 1 'react/forbid-prop-types': OFF, // 1 'react/require-default-props': OFF, // 1 + 'jsx-a11y/control-has-associated-label': OFF, // 1 + 'react/jsx-props-no-spreading': OFF, // 2 + 'max-classes-per-file': OFF, // 2 + 'prefer-object-spread': OFF, // 5 'jsx-a11y/anchor-is-valid': OFF, // 9 'import/no-unresolved': OFF, // 15 'react/prefer-stateless-function': OFF, // 22 diff --git a/packages/docusaurus-1.x/lib/server/readMetadata.js b/packages/docusaurus-1.x/lib/server/readMetadata.js index 70ded9b2ba..b44f36e6d9 100644 --- a/packages/docusaurus-1.x/lib/server/readMetadata.js +++ b/packages/docusaurus-1.x/lib/server/readMetadata.js @@ -375,9 +375,7 @@ function generateMetadataBlog(config = siteConfig) { // Extract, YYYY, MM, DD from the file name const filePathDateArr = path.basename(file).split('-'); metadata.date = new Date( - `${filePathDateArr[0]}-${filePathDateArr[1]}-${ - filePathDateArr[2] - }T06:00:00.000Z`, + `${filePathDateArr[0]}-${filePathDateArr[1]}-${filePathDateArr[2]}T06:00:00.000Z`, ); // allow easier sorting of blog by providing seconds since epoch metadata.seconds = Math.round(metadata.date.getTime() / 1000); diff --git a/packages/docusaurus-1.x/package.json b/packages/docusaurus-1.x/package.json index dedbb34e2b..d82d11f58c 100644 --- a/packages/docusaurus-1.x/package.json +++ b/packages/docusaurus-1.x/package.json @@ -75,5 +75,11 @@ "tiny-lr": "^1.1.1", "tree-node-cli": "^1.2.5", "truncate-html": "^1.0.3" + }, + "devDependencies": { + "filepath": "^1.1.0", + "front-matter": "^2.3.0", + "glob-promise": "^3.3.0", + "rimraf": "^2.6.3" } } diff --git a/packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts b/packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts index ccb51d2529..9dfe8f9327 100644 --- a/packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts +++ b/packages/docusaurus-plugin-content-blog/src/__tests__/index.test.ts @@ -32,9 +32,9 @@ describe('loadBlog', () => { ); const {blogPosts} = await plugin.loadContent(); const noDateSource = path.join('@site', pluginPath, 'no date.md'); - const noDateSourceBirthTime = (await fs.stat( - noDateSource.replace('@site', siteDir), - )).birthtime; + const noDateSourceBirthTime = ( + await fs.stat(noDateSource.replace('@site', siteDir)) + ).birthtime; const noDatePermalink = `/blog/${noDateSourceBirthTime .toISOString() .substr(0, '2019-01-01'.length) diff --git a/packages/docusaurus-plugin-content-docs/package.json b/packages/docusaurus-plugin-content-docs/package.json index 4192661429..0860493e23 100644 --- a/packages/docusaurus-plugin-content-docs/package.json +++ b/packages/docusaurus-plugin-content-docs/package.json @@ -11,7 +11,8 @@ }, "license": "MIT", "devDependencies": { - "@docusaurus/types": "^2.0.0-alpha.33" + "@docusaurus/types": "^2.0.0-alpha.33", + "picomatch": "^2.1.0" }, "dependencies": { "@docusaurus/mdx-loader": "^2.0.0-alpha.33", diff --git a/packages/docusaurus-plugin-content-docs/src/__tests__/order.test.ts b/packages/docusaurus-plugin-content-docs/src/__tests__/order.test.ts index 7cdc265dbd..d870608cf2 100644 --- a/packages/docusaurus-plugin-content-docs/src/__tests__/order.test.ts +++ b/packages/docusaurus-plugin-content-docs/src/__tests__/order.test.ts @@ -30,7 +30,10 @@ describe('createOrder', () => { { type: 'category', label: 'Category2', - items: [{type: 'doc', id: 'doc3'}, {type: 'doc', id: 'doc4'}], + items: [ + {type: 'doc', id: 'doc3'}, + {type: 'doc', id: 'doc4'}, + ], }, ], otherDocs: [ @@ -75,12 +78,18 @@ describe('createOrder', () => { { type: 'category', label: 'Category1', - items: [{type: 'doc', id: 'doc1'}, {type: 'doc', id: 'doc2'}], + items: [ + {type: 'doc', id: 'doc1'}, + {type: 'doc', id: 'doc2'}, + ], }, { type: 'category', label: 'Category2', - items: [{type: 'doc', id: 'doc3'}, {type: 'doc', id: 'doc4'}], + items: [ + {type: 'doc', id: 'doc3'}, + {type: 'doc', id: 'doc4'}, + ], }, ], otherDocs: [ @@ -188,7 +197,10 @@ describe('createOrder', () => { { type: 'category', label: 'Category2', - items: [{type: 'doc', id: 'doc3'}, {type: 'ref', id: 'doc4'}], + items: [ + {type: 'doc', id: 'doc3'}, + {type: 'ref', id: 'doc4'}, + ], }, ], otherDocs: [ @@ -225,7 +237,10 @@ describe('createOrder', () => { { type: 'category', label: 'Category1', - items: [{type: 'endi', id: 'doc1'}, {type: 'doc', id: 'doc2'}], + items: [ + {type: 'endi', id: 'doc1'}, + {type: 'doc', id: 'doc2'}, + ], }, ], otherDocs: [ diff --git a/packages/docusaurus-theme-classic/src/theme/Layout/index.js b/packages/docusaurus-theme-classic/src/theme/Layout/index.js index 5c8e6abc30..864d14ea1f 100644 --- a/packages/docusaurus-theme-classic/src/theme/Layout/index.js +++ b/packages/docusaurus-theme-classic/src/theme/Layout/index.js @@ -37,7 +37,7 @@ function Layout(props) { const metaImageUrl = siteUrl + useBaseUrl(metaImage); const faviconUrl = useBaseUrl(favicon); return ( - + <> @@ -63,7 +63,7 @@ function Layout(props) {
{children}
{!noFooter &&