Skip to content

Commit

Permalink
Merge branch 'main' into jc/tag-version-route
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Apr 10, 2022
2 parents 726a687 + 7a61eed commit b2a2f94
Show file tree
Hide file tree
Showing 1,076 changed files with 34,434 additions and 27,347 deletions.
3 changes: 1 addition & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
],
"ignorePaths": [
"CHANGELOG.md",
"examples",
"packages/docusaurus-theme-translations/locales",
"__tests__",
"package.json",
"yarn.lock",
"project-words.txt",
"__snapshots__",
"website/src/data/users.tsx",
"website/src/data/tweets.tsx",
"*.xyz",
Expand Down
33 changes: 28 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
{
"name": "Docusaurus Dev Container",
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:14-buster",
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-20.04",
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
},
"extensions": ["dbaeumer.vscode-eslint", "orta.vscode-jest"],
"extensions": [
"dbaeumer.vscode-eslint",
"orta.vscode-jest",
"esbenp.prettier-vscode",
"streetsidesoftware.code-spell-checker"
],
"forwardPorts": [3000],
"postCreateCommand": "yarn install"
"containerUser": "vscode",
"postCreateCommand": "yarn install",
"waitFor": "postCreateCommand", // otherwise automated jest tests fail
"features": {
"node": {
"version": "14"
},
"github-cli": "latest"
}
}
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ packages/stylelint-copyright/lib/
copyUntypedFiles.mjs

packages/create-docusaurus/lib/*
packages/create-docusaurus/templates/facebook/.eslintrc.js
packages/create-docusaurus/templates/facebook

website/_dogfooding/_swizzle_theme_tests
79 changes: 66 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
'plugin:jest/recommended',
'airbnb',
'plugin:@typescript-eslint/recommended',
'plugin:regexp/recommended',
'prettier',
],
settings: {
Expand All @@ -40,14 +41,15 @@ module.exports = {
},
},
reportUnusedDisableDirectives: true,
plugins: ['react-hooks', 'header', 'jest', '@typescript-eslint'],
plugins: ['react-hooks', 'header', 'jest', '@typescript-eslint', 'regexp'],
rules: {
'array-callback-return': WARNING,
camelcase: WARNING,
'class-methods-use-this': OFF, // It's a way of allowing private variables.
curly: [WARNING, 'all'],
'global-require': WARNING,
'lines-between-class-members': OFF,
'max-classes-per-file': OFF,
'max-len': [
WARNING,
{
Expand All @@ -61,6 +63,7 @@ module.exports = {
'no-await-in-loop': OFF,
'no-case-declarations': WARNING,
'no-console': OFF,
'no-continue': OFF,
'no-control-regex': WARNING,
'no-else-return': [WARNING, {allowElseIf: true}],
'no-empty': [WARNING, {allowEmptyCatch: true}],
Expand Down Expand Up @@ -166,7 +169,12 @@ module.exports = {
// selector:
// @ 'ExportDefaultDeclaration > Identifier, ExportNamedDeclaration[source=null] > ExportSpecifier',
// message: 'Export in one statement'
// }
// },
...['path', 'fs-extra', 'webpack', 'lodash'].map((m) => ({
selector: `ImportDeclaration[importKind=value]:has(Literal[value=${m}]) > ImportSpecifier[importKind=value]`,
message:
'Default-import this, both for readability and interoperability with ESM',
})),
],
'no-template-curly-in-string': WARNING,
'no-unused-expressions': [WARNING, {allowTaggedTemplates: true}],
Expand Down Expand Up @@ -194,15 +202,42 @@ module.exports = {
'import/no-unresolved': [
ERROR,
{
ignore: ['^@theme', '^@docusaurus', '^@generated', '^@site'],
ignore: [
'^@theme',
'^@docusaurus',
'^@generated',
'^@site',
'^@testing-utils',
],
},
],
'import/order': OFF,
'import/prefer-default-export': OFF,

'jest/prefer-expect-resolves': WARNING,
'jest/consistent-test-it': WARNING,
'jest/expect-expect': OFF,
'jest/valid-title': OFF,
'jest/no-large-snapshots': [
WARNING,
{maxSize: Infinity, inlineMaxSize: 10},
],
'jest/no-test-return-statement': ERROR,
'jest/prefer-expect-resolves': WARNING,
'jest/prefer-lowercase-title': [WARNING, {ignore: ['describe']}],
'jest/prefer-spy-on': WARNING,
'jest/prefer-to-be': WARNING,
'jest/prefer-to-have-length': WARNING,
'jest/require-top-level-describe': ERROR,
'jest/valid-title': [
ERROR,
{
mustNotMatch: {
it: [
'^should|\\.$',
'Titles should not begin with "should" or end with a full-stop',
],
},
},
],

'jsx-a11y/click-events-have-key-events': WARNING,
'jsx-a11y/no-noninteractive-element-interactions': WARNING,
Expand Down Expand Up @@ -234,6 +269,10 @@ module.exports = {
ERROR,
{'ts-expect-error': 'allow-with-description'},
],
'@typescript-eslint/consistent-indexed-object-style': [
WARNING,
'index-signature',
],
'@typescript-eslint/consistent-type-imports': [
WARNING,
{disallowTypeAnnotations: false},
Expand All @@ -248,6 +287,7 @@ module.exports = {
},
],
'@typescript-eslint/no-inferrable-types': OFF,
'@typescript-eslint/no-namespace': [WARNING, {allowDeclarations: true}],
'no-use-before-define': OFF,
'@typescript-eslint/no-use-before-define': [
ERROR,
Expand All @@ -259,14 +299,11 @@ module.exports = {
'no-shadow': OFF,
'@typescript-eslint/no-shadow': ERROR,
'no-unused-vars': OFF,
'@typescript-eslint/no-unused-vars': [
ERROR,
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
// We don't provide any escape hatches for this rule. Rest siblings and
// function placeholder params are always ignored, and any other unused
// locals must be justified with a disable comment.
'@typescript-eslint/no-unused-vars': [ERROR, {ignoreRestSiblings: true}],
'@typescript-eslint/prefer-optional-chain': ERROR,
},
overrides: [
{
Expand Down Expand Up @@ -312,5 +349,21 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': OFF,
},
},
{
// Internal files where extraneous deps don't matter much at long as
// they run
files: [
'*.test.ts',
'*.test.tsx',
'admin/**',
'jest/**',
'website/**',
'packages/docusaurus-theme-translations/update.mjs',
'packages/docusaurus-theme-translations/src/utils.ts',
],
rules: {
'import/no-extraneous-dependencies': OFF,
},
},
],
};
2 changes: 1 addition & 1 deletion .github/workflows/build-blog-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/build-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
Expand All @@ -27,6 +27,7 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
build-script: build:website:en
clean-script: clear:website # see https://github.com/facebook/docusaurus/pull/6838
pattern: '{website/build/assets/js/main*js,website/build/assets/css/styles*css,website/.docusaurus/globalData.json,website/build/index.html,website/build/blog/index.html,website/build/blog/**/introducing-docusaurus/*,website/build/docs/index.html,website/build/docs/installation/index.html,website/build/tests/docs/index.html,website/build/tests/docs/standalone/index.html}'
strip-hash: '\.([^;]\w{7})\.'
minimum-change-threshold: 30
Expand All @@ -36,7 +37,7 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
Expand All @@ -52,4 +53,4 @@ jobs:
- name: Build (warm cache)
run: yarn workspace website build --locale en
timeout-minutes: 2
# TODO post a Github comment with build with perf warnings?
# TODO post a GitHub comment with build with perf warnings?
2 changes: 1 addition & 1 deletion .github/workflows/canary-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Publish Canary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed to get the commit number with "git rev-list --count HEAD"
- name: Set up Node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lighthouse-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Lighthouse Report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Wait for the Netlify Preview
uses: jakepartusch/wait-for-netlify-action@v1
id: netlify
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/showcase-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
node: ['14', '16', '17']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
- variant: -st
nodeLinker: pnp
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
Expand All @@ -72,9 +72,6 @@ jobs:
- name: Install test-website project with Yarn Berry and nodeLinker = ${{ matrix.nodeLinker }}
run: |
yarn set version berry
# https://github.com/facebook/docusaurus/pull/6350#issuecomment-1013214763
# Remove this after Yarn 3.2
yarn set version canary
yarn config set nodeLinker ${{ matrix.nodeLinker }}
yarn config set npmRegistryServer http://localhost:4873
Expand Down Expand Up @@ -103,11 +100,11 @@ jobs:
working-directory: ../test-website

npm:
name: E2E — NPM
name: E2E — npm
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
Expand All @@ -117,7 +114,7 @@ jobs:
run: yarn
- name: Generate test-website project against main branch
run: yarn test:build:website -s
- name: Install test-website project with NPM
- name: Install test-website project with npm
run: npm install
working-directory: ../test-website
env:
Expand All @@ -132,11 +129,11 @@ jobs:
working-directory: ../test-website

pnpm:
name: E2E — PNPM
name: E2E — pnpm
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
Expand All @@ -146,7 +143,7 @@ jobs:
run: yarn
- name: Generate test-website project against main branch
run: yarn test:build:website -s
- name: Install test-website project with PNPM
- name: Install test-website project with pnpm
run: |
curl -f https://get.pnpm.io/v6.16.js | node - add --global pnpm
pnpm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-swizzle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
action: ['eject', 'wrap']
variant: ['js', 'ts']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- name: Support longpaths
run: git config --system core.longpaths true
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
Expand Down
Loading

0 comments on commit b2a2f94

Please sign in to comment.