Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump docusaurus, use docusaurus/preset-classic #4960

Merged
merged 3 commits into from
May 16, 2022

Conversation

Josh-Cena
Copy link
Member

@Josh-Cena Josh-Cena commented May 11, 2022

PR Checklist

Overview

Since we are considering adding a blog (#4957), we will be enjoying all features that preset-classic provides by then. It will be sensible for us to use the preset instead, so we don't need to manage so many dependencies individually.

There are no breaking changes that impact us, but I've made a few little refactors.

@nx-cloud
Copy link

nx-cloud bot commented May 11, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 1d5b555. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 43 targets

Sent with 💌 from NxCloud.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Josh-Cena!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@netlify
Copy link

netlify bot commented May 11, 2022

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 1d5b555
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6281bcdf78f2510008dc4415
😎 Deploy Preview https://deploy-preview-4960--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Comment on lines +27 to +28
/** @type {import('@docusaurus/preset-classic').Options} */
({
Copy link
Member Author

@Josh-Cena Josh-Cena May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSDoc only works if you wrap the object literal with brackets. In the latest version, we've added actual JSDoc documentation to all APIs, so it's good if we can do it properly.

@@ -60,17 +61,7 @@ html[data-theme='dark']:root {
scrollbar-color: #454a4d #202324;

--docsearch-muted-color: #aaa;
}

.docusaurus-highlight-code-line {
Copy link
Member Author

@Josh-Cena Josh-Cena May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change: the class name has been removed in Docusaurus. We are using CSS vars instead. But AFAIK it won't impact us because it seems we are not using code line highlighting.

@@ -56,8 +56,8 @@ html[data-theme='dark'] {
--token-color-highlight: rgba(247, 235, 198, 0.2);
}

div[class*='codeBlockContainer'],
div[class*='codeBlockContainer'] pre {
.theme-code-block,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a more stable class name and is recommended.

Comment on lines +3 to +16
export default function prismIncludeLanguages(PrismObject) {
const {
themeConfig: { prism },
} = siteConfig;
const { additionalLanguages } = prism;
globalThis.Prism = PrismObject;

additionalLanguages.forEach(lang => {
require(`prismjs/components/prism-${lang}`); // eslint-disable-line
});
additionalLanguages.forEach(lang => {
require(`prismjs/components/prism-${lang}`); // eslint-disable-line
});

require(`../prism/language/jsonc`);
delete window.Prism;
}
};

export default prismIncludeLanguages;
require(`../prism/language/jsonc`);
delete globalThis.Prism;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backporting changes from upstream. By using globalThis, we can now support server-side rendering of custom languages as well.

@Josh-Cena Josh-Cena changed the title chore: bump docusaurus, use preset-classic chore: bump docusaurus, use docusaurus/preset-classic May 11, 2022
@codecov
Copy link

codecov bot commented May 11, 2022

Codecov Report

Merging #4960 (089d1cb) into main (77e15a9) will decrease coverage by 0.85%.
The diff coverage is n/a.

❗ Current head 089d1cb differs from pull request most recent head 1d5b555. Consider uploading reports for the commit 1d5b555 to get more accurate results

@@            Coverage Diff             @@
##             main    #4960      +/-   ##
==========================================
- Coverage   92.64%   91.78%   -0.86%     
==========================================
  Files         190      228      +38     
  Lines       10251    10633     +382     
  Branches     3249     3289      +40     
==========================================
+ Hits         9497     9760     +263     
- Misses        502      591      +89     
- Partials      252      282      +30     
Flag Coverage Δ
unittest 91.78% <ø> (-0.86%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/utils/src/ts-eslint-scope/index.ts 18.18% <0.00%> (ø)
...s/utils/src/eslint-utils/batchedSingleLineTests.ts 91.66% <0.00%> (ø)
...ckages/utils/src/eslint-utils/getParserServices.ts 20.00% <0.00%> (ø)
packages/utils/src/eslint-utils/applyDefault.ts 100.00% <0.00%> (ø)
packages/utils/src/ts-eslint-scope/analyze.ts 100.00% <0.00%> (ø)
packages/utils/src/ts-eslint/index.ts 11.11% <0.00%> (ø)
...utils/src/ast-utils/eslint-utils/PatternMatcher.ts 100.00% <0.00%> (ø)
packages/utils/src/eslint-utils/RuleTester.ts 11.62% <0.00%> (ø)
packages/visitor-keys/src/get-keys.ts 100.00% <0.00%> (ø)
packages/utils/src/eslint-utils/deepMerge.ts 89.47% <0.00%> (ø)
... and 28 more

@Josh-Cena
Copy link
Member Author

I think the reason why Cypress tests always fail on version bump PRs is because the cache is invalidated, causing yarn start to take longer than necessary.

@bradzacher bradzacher added the repo maintenance things to do with maintenance of the repo, and not with code/docs label May 11, 2022
background-color: var(--token-background);
.theme-code-block,
.theme-code-block pre {
color: var(--token-color) !important;
Copy link
Member Author

@Josh-Cena Josh-Cena May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to work around a Docusaurus bug: facebook/docusaurus#3678

I'd still recommend to use the theme-code-block class name, even if it means using !important...

if (typeof window !== 'undefined') {
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';

if (ExecutionEnvironment.canUseDOM) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha, I remember bumping into this discussion! Glad it's resolved 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except that ExecutionEnvironment.canUseDOM does exactly the same thing as typeof window !== 'undefined' (except doing a few more checks) 🤦‍♂️

It's now officially made its way to the docs, now that client modules are finalized and published: https://docusaurus.io/docs/advanced/client#:~:text=remember%20to%20check%20the%20execution%20environment

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic, thanks so much @Josh-Cena (as always)! 👏

@JoshuaKGoldberg JoshuaKGoldberg enabled auto-merge (squash) May 16, 2022 02:54
@JoshuaKGoldberg JoshuaKGoldberg merged commit 03577a6 into typescript-eslint:main May 16, 2022
@Josh-Cena Josh-Cena deleted the upgrade-docusaurus branch May 16, 2022 03:12
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
repo maintenance things to do with maintenance of the repo, and not with code/docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants