Skip to content

Commit

Permalink
Merge branch 'main' into jc/breadcrumb-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Mar 7, 2022
2 parents d502f59 + 7fc134b commit 7365954
Show file tree
Hide file tree
Showing 712 changed files with 22,841 additions and 14,850 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ copyUntypedFiles.mjs

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

website/_dogfooding/_swizzle_theme_tests
104 changes: 79 additions & 25 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,74 @@ module.exports = {
'no-param-reassign': [WARNING, {props: false}],
'no-prototype-builtins': WARNING,
'no-restricted-exports': OFF,
'no-restricted-imports': [
'no-restricted-properties': [
ERROR,
{
paths: [
{
name: 'lodash',
importNames: [
// TODO: TS doesn't make Boolean a narrowing function yet,
// so filter(Boolean) is problematic type-wise
// 'compact',
'filter',
'flatten',
'flatMap',
'map',
'reduce',
'take',
'takeRight',
'head',
'tail',
'initial',
],
message: 'These APIs have their ES counterparts.',
},
],
},
...[
// TODO: TS doesn't make Boolean a narrowing function yet,
// so filter(Boolean) is problematic type-wise
// ['compact', 'Array#filter(Boolean)'],
['concat', 'Array#concat'],
['drop', 'Array#slice(n)'],
['dropRight', 'Array#slice(0, -n)'],
['fill', 'Array#fill'],
['filter', 'Array#filter'],
['find', 'Array#find'],
['findIndex', 'Array#findIndex'],
['first', 'foo[0]'],
['flatten', 'Array#flat'],
['flattenDeep', 'Array#flat(Infinity)'],
['flatMap', 'Array#flatMap'],
['fromPairs', 'Object.fromEntries'],
['head', 'foo[0]'],
['indexOf', 'Array#indexOf'],
['initial', 'Array#slice(0, -1)'],
['join', 'Array#join'],
// Unfortunately there's no great alternative to _.last yet
// Candidates: foo.slice(-1)[0]; foo[foo.length - 1]
// Array#at is ES2022; could replace _.nth as well
// ['last'],
['map', 'Array#map'],
['reduce', 'Array#reduce'],
['reverse', 'Array#reverse'],
['slice', 'Array#slice'],
['take', 'Array#slice(0, n)'],
['takeRight', 'Array#slice(-n)'],
['tail', 'Array#slice(1)'],
].map(([property, alternative]) => ({
object: '_',
property,
message: `Use ${alternative} instead.`,
})),
...[
'readdirSync',
'readFileSync',
'statSync',
'lstatSync',
'existsSync',
'pathExistsSync',
'realpathSync',
'mkdirSync',
'mkdirpSync',
'mkdirsSync',
'writeFileSync',
'writeJsonSync',
'outputFileSync',
'outputJsonSync',
'moveSync',
'copySync',
'copyFileSync',
'ensureFileSync',
'ensureDirSync',
'ensureLinkSync',
'ensureSymlinkSync',
'unlinkSync',
'removeSync',
'emptyDirSync',
].map((property) => ({
object: 'fs',
property,
message: 'Do not use sync fs methods.',
})),
],
'no-restricted-syntax': [
WARNING,
Expand All @@ -118,6 +161,12 @@ module.exports = {
message:
"Export all does't work well if imported in ESM due to how they are transpiled, and they can also lead to unexpected exposure of internal methods.",
},
// TODO make an internal plugin to ensure this
// {
// selector:
// @ 'ExportDefaultDeclaration > Identifier, ExportNamedDeclaration[source=null] > ExportSpecifier',
// message: 'Export in one statement'
// }
],
'no-template-curly-in-string': WARNING,
'no-unused-expressions': [WARNING, {allowTaggedTemplates: true}],
Expand Down Expand Up @@ -173,6 +222,7 @@ module.exports = {
],
'react/jsx-filename-extension': OFF,
'react/jsx-key': [ERROR, {checkFragmentShorthand: true}],
'react/jsx-no-useless-fragment': [ERROR, {allowExpressions: true}],
'react/jsx-props-no-spreading': OFF,
'react/no-array-index-key': OFF, // We build a static site, and nearly all components don't change.
'react/no-unstable-nested-components': [WARNING, {allowAsProps: true}],
Expand Down Expand Up @@ -211,7 +261,11 @@ module.exports = {
'no-unused-vars': OFF,
'@typescript-eslint/no-unused-vars': [
ERROR,
{argsIgnorePattern: '^_', ignoreRestSiblings: true},
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
},
overrides: [
Expand Down
3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

46 changes: 25 additions & 21 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ body:
value: |
## Please help us help you!
Make it obvious to understand and reproduce this bug. Ideally, we should be able to understand it without running any code.
Before filing your issue, ask yourself:
- Is this clearly a Docusaurus defect?
- Do I have basic ideas about where it goes wrong? (For example, if there are stack traces, are they pointing to one file?)
- Could it be because of my own mistakes?
**The GitHub issue tracker is not a support forum**. If you are not sure whether it could be your mistakes, ask in the [Discord server](https://discord.gg/docusaurus) or [GitHub discussions](https://github.com/facebook/docusaurus/discussions) first. The quickest way to verify whether it's a Docusaurus defect is through a **reproduction**, starting with a fresh installation and making changes until the bug is reproduced.
Make the bug obvious. Ideally, we should be able to understand it without running any code.
Bugs are fixed faster if you include:
- A repro repository to inspect the code
Expand Down Expand Up @@ -41,21 +48,34 @@ body:
validations:
required: true

- type: input
attributes:
label: Reproducible demo
description: |
Paste the link to an example repo, including a `docusaurus.config.js`, and exact instructions to reproduce the issue. It can either be a playground link created from https://new.docusaurus.io, or a git repository.
> **What happens if you skip this step?** Someone will read your bug report, and maybe will be able to help you, but it’s unlikely that it will get much attention from the team. Eventually, the issue will likely get closed in favor of issues that have reproducible demos.
Please remember that:
- Issues without reproducible demos have a very low priority.
- The person fixing the bug would have to do that anyway. Please be respectful of their time.
- You might figure out the issues yourself as you work on extracting it.
Thanks for helping us help you!
- type: textarea
attributes:
label: Steps to reproduce
description: Use https://new.docusaurus.io to create a CodeSandbox reproducible demo of the bug.
description: Write down the steps to reproduce the bug. You should start with a fresh installation, or your git repository linked above.
placeholder: |
Write your steps here.
1. Step 1...
2. Step 2...
3. Step 3...
validations:
required: true

- type: textarea

attributes:
label: Expected behavior
description: |
Expand Down Expand Up @@ -87,22 +107,6 @@ body:
- Environment name and version (e.g. Chrome 89, Node.js 16.4):
- Operating system and version (e.g. Ubuntu 20.04.2 LTS):
- type: input
attributes:
label: Reproducible demo
description: |
Paste the link to an example repo, including a `docusaurus.config.js`, and exact instructions to reproduce the issue. Use https://new.docusaurus.io to create a CodeSandbox reproducible demo of the bug.
> **What happens if you skip this step?** Someone will read your bug report, and maybe will be able to help you, but it’s unlikely that it will get much attention from the team. Eventually, the issue will likely get closed in favor of issues that have reproducible demos.
Please remember that:
- Issues without reproducible demos have a very low priority.
- The person fixing the bug would have to do that anyway. Please be respectful of their time.
- You might figure out the issues yourself as you work on extracting it.
Thanks for helping us help you!
- type: checkboxes
attributes:
label: Self-service
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-blog-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
- uses: preactjs/compressed-size-action@v2
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 @@ -37,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
cache: yarn
- name: Installation
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/canary-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
fetch-depth: 0 # Needed to get the commit number with "git rev-list --count HEAD"
- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
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 @@ -19,7 +19,7 @@ jobs:
max_timeout: 600
- name: Audit URLs using Lighthouse
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@8.2.0
uses: treosh/lighthouse-ci-action@9.3.0
with:
urls: |
https://deploy-preview-$PR_NUMBER--docusaurus-2.netlify.app/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
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 @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '16'
cache: yarn
Expand Down
Loading

0 comments on commit 7365954

Please sign in to comment.