1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00

Apply biome formatting to the docs website (#6523)

The docs were ignored by biome, this fixes it. 
With this change
- The docs are no longer ignored by the formatter and the linter
- Custom components in the docs were updated to satisfy the linter
- All the files in the docs were formatted.

There is no new feature or change.
This commit is contained in:
Alvin Bryan 2024-03-13 11:30:40 +00:00 committed by GitHub
parent 422af36d2d
commit 3ea9496a8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 79 additions and 193 deletions

View File

@ -41,20 +41,14 @@
"node_modules",
"docker",
"bundle.js",
"website/blog",
"website/build",
"website/core",
"website/docs",
"website/i18n/*.js",
"website/pages",
"website/translated_docs",
"website",
"website/global.js",
"setupJest.js",
"dist",
"build",
"src/migrations/*.js",
"src/test/examples/*.json",
"website/**/*.js",
".docusaurus",
"coverage",
"CHANGELOG.md"
]
@ -68,22 +62,16 @@
"node_modules",
"docker",
"bundle.js",
"website/blog",
"website/build",
"website/core",
"website/docs",
"website/i18n/*.js",
"website/pages",
"website/translated_docs",
"website",
"setupJest.js",
"dist",
"build",
"src/migrations/*.js",
"src/migrations/*.json",
"src/test/examples/*.json",
"website/**/*.js",
"coverage"
"coverage",
"website/build",
"website/global.js",
".docusaurus"
],
"indentWidth": 4
},

View File

@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

View File

@ -101,7 +101,7 @@ module.exports = {
{
type: 'doc',
docId: 'unleash-academy/managing-unleash-for-devops',
label: 'Managing Unleash for DevOps/Admins'
label: 'Managing Unleash for DevOps/Admins',
},
],
},
@ -112,18 +112,18 @@ module.exports = {
html: '<span class="hide-at-small-sizes">Unleash </span>Certification',
items: [
{
label: 'Foundational Unleash',
href: 'https://docs.google.com/forms/d/1iPUk2I0k5xMzicn9aLMcPF3b9ub3ZwdVjRxCxWxV7js/viewform',
label: 'Foundational Unleash',
href: 'https://docs.google.com/forms/d/1iPUk2I0k5xMzicn9aLMcPF3b9ub3ZwdVjRxCxWxV7js/viewform',
},
{
label: 'Advanced Unleash for Developers',
href: 'https://docs.google.com/forms/d/1NUL9hyO8Ys916TB6fPV3-jkvD97OmPXZ8_TO84Wjqgc/viewform',
label: 'Advanced Unleash for Developers',
href: 'https://docs.google.com/forms/d/1NUL9hyO8Ys916TB6fPV3-jkvD97OmPXZ8_TO84Wjqgc/viewform',
},
{
label: 'Managing Unleash for DevOps/Admins',
href: 'https://docs.google.com/forms/d/1JlIqmXI3P7dj0n-OiUs2IYsYXgmqw23BChaemlSgHJA/viewform',
label: 'Managing Unleash for DevOps/Admins',
href: 'https://docs.google.com/forms/d/1JlIqmXI3P7dj0n-OiUs2IYsYXgmqw23BChaemlSgHJA/viewform',
},
],
],
},
{
type: 'html',
@ -224,9 +224,9 @@ module.exports = {
// Optional medium-zoom options at
// https://www.npmjs.com/package/medium-zoom#options
options: {
background: 'var(--ifm-background-color)'
background: 'var(--ifm-background-color)',
},
}
},
},
presets: [
[
@ -364,7 +364,10 @@ module.exports = {
to: '/reference/integrations/slack',
},
{
from: ['/addons/slack-app', '/reference/addons/slack-app'],
from: [
'/addons/slack-app',
'/reference/addons/slack-app',
],
to: '/reference/integrations/slack-app',
},
{
@ -484,10 +487,7 @@ module.exports = {
to: '/reference/projects',
},
{
from: [
'/user_guide/rbac',
'/advanced/groups',
],
from: ['/user_guide/rbac', '/advanced/groups'],
to: '/reference/rbac',
},
{
@ -612,10 +612,7 @@ module.exports = {
to: '/',
},
{
from: [
'/topics/feature-flags/tutorials',
'/tutorials',
],
from: ['/topics/feature-flags/tutorials', '/tutorials'],
to: '/feature-flag-tutorials',
},
{
@ -631,10 +628,7 @@ module.exports = {
to: '/feature-flag-tutorials/nextjs/implementing-feature-flags',
},
{
from: [
'/tutorials/academy',
'/unleash-academy',
],
from: ['/tutorials/academy', '/unleash-academy'],
to: '/unleash-academy/introduction',
},
{
@ -651,7 +645,7 @@ module.exports = {
},
{
from: '/developer-guide',
to: '/contributing'
to: '/contributing',
},
{
from: [
@ -710,10 +704,7 @@ module.exports = {
to: '/using-unleash/troubleshooting/feature-not-available',
},
{
from: [
'/reference/deploy',
'/deploy',
],
from: ['/reference/deploy', '/deploy'],
to: '/using-unleash/deploy',
},
{
@ -793,10 +784,8 @@ module.exports = {
],
to: '/how-to/how-to-environment-import-export',
},
].map(addDocsRoutePrefix), // add /docs prefixes
createRedirects: function (toPath) {
createRedirects: (toPath) => {
if (
toPath.indexOf('/docs/') === -1 &&
toPath.indexOf('index.html') === -1
@ -867,7 +856,5 @@ module.exports = {
async: true,
},
],
clientModules: [
require.resolve('./global.js'),
],
clientModules: [require.resolve('./global.js')],
};

View File

@ -1,4 +1,3 @@
if(typeof document !== 'undefined') {
!function(){var e,t,n;e="5fe670e3422303a",t=function(){Reo.init({clientID:"5fe670e3422303a"})},(n=document.createElement("script")).src="https://static.reo.dev/"+e+"/reo.js",n.async=!0,n.onload=t,document.head.appendChild(n)}();
!function(){var e,t,n;e="5fe670e3422303a",t=function(){Reo.init({clientID:"5fe670e3422303a"})},(n=document.createElement("script")).src="https://static.reo.dev/"+e+"/reo.js",n.async=!0,n.onload=t,document.head.appendChild(n)}();
}

View File

@ -93,8 +93,10 @@ module.exports.modifyContent =
const generationTime = new Date();
const processedFilename = (() => {
const constructed =
path.join(filePath(data) ?? '', data.slugName) + '.md';
const constructed = `${path.join(
filePath(data) ?? '',
data.slugName,
)}.md`;
// ensure the file path does *not* start with a leading /
return constructed.charAt(0) === '/'

View File

@ -12,7 +12,6 @@
// TODO: Add warning to legacy API docs - but generated items
// TODO: Continue to clean URLs & redirects - but wait for SEO results first
module.exports = {
academy: [
{
@ -34,7 +33,7 @@ module.exports = {
id: 'welcome',
label: 'Docs',
className: 'show-when-collapsed',
}
},
],
documentation: [
'welcome',
@ -46,7 +45,8 @@ module.exports = {
link: {
type: 'generated-index',
title: 'Feature Flag Best Practices',
description: 'Principles and recommendations for best practices of using feature flags.',
description:
'Principles and recommendations for best practices of using feature flags.',
slug: '/topics',
},
items: [
@ -96,7 +96,8 @@ module.exports = {
link: {
type: 'generated-index',
title: 'Feature Flag Tutorials',
description: 'Tutorials to implement feature flags with your framework.',
description:
'Tutorials to implement feature flags with your framework.',
slug: 'feature-flag-tutorials',
},
items: [
@ -150,7 +151,6 @@ module.exports = {
label: 'Next.js',
id: 'feature-flag-tutorials/nextjs/implementing-feature-flags',
},
],
},
{
@ -160,7 +160,8 @@ module.exports = {
link: {
type: 'generated-index',
title: 'Understanding Unleash',
description: 'Documentation on how Unleash works, high-level architecture and important concepts.',
description:
'Documentation on how Unleash works, high-level architecture and important concepts.',
slug: 'understanding-unleash',
},
items: [
@ -226,7 +227,8 @@ module.exports = {
link: {
type: 'generated-index',
title: 'Using Unleash',
description: 'Documentation on how to accomplish specific tasks when building with Unleash, including API and SDK documentation.',
description:
'Documentation on how to accomplish specific tasks when building with Unleash, including API and SDK documentation.',
slug: '/using-unleash',
},
items: [
@ -269,9 +271,8 @@ module.exports = {
'reference/api/legacy/unleash/client/metrics',
'reference/api/legacy/unleash/client/register',
],
},
]
],
},
{
label: 'Application SDKs',
@ -343,7 +344,8 @@ module.exports = {
link: {
type: 'generated-index',
title: 'How-to: Unleash API',
description: 'Learn how to work with the Unleash API',
description:
'Learn how to work with the Unleash API',
slug: '/how-to/api',
},
items: [
@ -362,7 +364,8 @@ module.exports = {
link: {
type: 'generated-index',
title: 'How-to: The Unleash Proxy',
description: 'Learn how to work with the Unleash Proxy',
description:
'Learn how to work with the Unleash Proxy',
slug: '/how-to/proxy',
},
items: ['how-to/how-to-run-the-unleash-proxy'],
@ -417,7 +420,8 @@ module.exports = {
link: {
type: 'generated-index',
title: 'How-to: users and permissions',
description: 'Users and permission how-to guides.',
description:
'Users and permission how-to guides.',
slug: '/how-to/users-and-permissions',
},
},
@ -439,7 +443,7 @@ module.exports = {
slug: '/how-to/sso',
},
},
]
],
},
{
type: 'category',
@ -518,6 +522,6 @@ module.exports = {
id: 'unleash-academy/introduction',
label: 'Unleash Academy',
className: 'show-when-collapsed',
}
},
],
};

View File

@ -1,70 +0,0 @@
import React from 'react';
import Component from './index';
import Layout from '@theme/Layout';
import { BrowserRouter } from 'react-router-dom';
export default {
title: 'API request component',
component: Component,
};
const Template = (args) => (
<BrowserRouter>
<Layout>
<Component {...args} />
</Layout>
</BrowserRouter>
);
export const GET = Template.bind({});
GET.args = {
verb: 'get',
url: 'api/admin/segments',
title: 'List all segments (example).',
};
export const POST = Template.bind({});
POST.args = {
verb: 'post',
payload: { name: '<feature-toggle-name>', impressionData: true },
url: 'api/admin/projects/<project-id>/features',
title: 'Create a feature toggle with impression data enabled. (example)',
};
export const POSTWithoutPayload = Template.bind({});
POSTWithoutPayload.args = {
verb: 'post',
url: 'api/admin/projects/<projectId>/features/<featureName>/environments/<environment>/on',
title: 'Disable a toggle in an env.',
};
export const PUT = Template.bind({});
PUT.args = {
verb: 'put',
payload: { name: '<feature-toggle-name>', impressionData: true },
url: 'api/admin/projects/<project-id>/features/<feature-id>',
title: 'Create a feature toggle with impression data enabled (example).',
};
export const PATCH = Template.bind({});
PATCH.args = {
verb: 'patch',
payload: [{ op: 'replace', path: '/impressionData', value: true }],
url: 'api/admin/projects/<project-id>/features/<feature-toggle-name>',
title: 'Enable impression data on an existing toggle (example).',
};
export const DELETE = Template.bind({});
DELETE.args = {
verb: 'delete',
url: 'api/admin/projects/<project-id>/features/<feature-toggle-id>',
title: 'Create a feature toggle with impression data enabled.',
};
export const GETProxy = Template.bind({});
GETProxy.args = {
verb: 'get',
url: 'proxy',
title: 'Request toggles from the Unleash Proxy',
endpointType: 'Proxy API',
};

View File

@ -9,7 +9,6 @@
types, for instance.
**/
import React from 'react';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
@ -85,19 +84,19 @@ http ${verbUpper} \\
).trim();
return (
<Tabs groupId="api-request">
<TabItem value="http" label="HTTP">
<CodeBlock language="http" title={title}>
<Tabs groupId='api-request'>
<TabItem value='http' label='HTTP'>
<CodeBlock language='http' title={title}>
{httpBlock}
</CodeBlock>
</TabItem>
<TabItem value="curl" label="cURL">
<CodeBlock language="bash" title={title}>
<TabItem value='curl' label='cURL'>
<CodeBlock language='bash' title={title}>
{curlBlock}
</CodeBlock>
</TabItem>
<TabItem value="httpie" label="HTTPie">
<CodeBlock language="bash" title={title}>
<TabItem value='httpie' label='HTTPie'>
<CodeBlock language='bash' title={title}>
{httpieBlock}
</CodeBlock>
</TabItem>

View File

@ -1,30 +0,0 @@
import React from 'react';
import Component from './Figure';
import Layout from '@theme/Layout';
import { BrowserRouter } from 'react-router-dom';
export default {
title: 'Figure',
component: Component,
};
const Template = (args) => (
<BrowserRouter>
<Layout>
<Component {...args} />
</Layout>
</BrowserRouter>
);
export const WithCaption = Template.bind({});
WithCaption.args = {
img: '/img/anatomy-of-unleash-constraint.png',
caption: 'This explanatory caption is visible to everyone.',
};
export const WithCaptionAndAlt = Template.bind({});
WithCaption.args = {
img: '/img/anatomy-of-unleash-constraint.png',
caption: 'This explanatory caption is visible to everyone.',
alt: "This alt text is read out by screen readers and displayed if the image doesn't load",
};

View File

@ -62,7 +62,6 @@
**/
import React from 'react';
import useBaseUrl from '@docusaurus/useBaseUrl';

View File

@ -1,3 +1,4 @@
// biome-ignore lint: Docusaurus doesn't work without the React import
import React from 'react';
import Admonition from '@theme/Admonition';
@ -12,9 +13,8 @@ const Component = ({ videoUrls }) => {
height='auto'
src={url}
title='YouTube video player'
frameBorder='0'
allowFullScreen
></iframe>
/>
))
) : (
<Admonition type='danger'>

View File

@ -1,3 +1,4 @@
// biome-ignore lint: Docusaurus doesn't work without the React import
import React from 'react';
const Component = () => {
@ -12,7 +13,7 @@ const Component = () => {
<li>100% Free & online</li>
<li>Valuable certification</li>
</ul>
<div className='small-logo'></div>
<div className='small-logo' />
<a
href='https://docs.google.com/forms/d/1iPUk2I0k5xMzicn9aLMcPF3b9ub3ZwdVjRxCxWxV7js/viewform'
className='unleash-action-button'
@ -20,7 +21,7 @@ const Component = () => {
Get certified
</a>
</div>
<div className='big-logo'></div>
<div className='big-logo' />
</div>
);
};

View File

@ -1,11 +1,14 @@
// biome-ignore lint: Docusaurus doesn't work without the React import
import React from 'react';
const Component = ({ level, description }) => {
return (
<div className={ `unleash-academy-banner course-banner-container unleash-academy-level-container ${level.toLowerCase()}`}>
<div
className={`unleash-academy-banner course-banner-container unleash-academy-level-container ${level.toLowerCase()}`}
>
<span className='unleash-academy-level-badge'>{level}</span>
<p className="academy-banner-main-text">{description}</p>
<ul className="unleash-academy-banner-list">
<p className='academy-banner-main-text'>{description}</p>
<ul className='unleash-academy-banner-list'>
<li>100% Free & online</li>
<li>Valuable certification</li>
</ul>

View File

@ -1,10 +1,12 @@
// biome-ignore lint: Docusaurus doesn't work without the React import
import React from 'react';
import Link from '@docusaurus/Link';
const LinkBox = ({ level, header, description, link }) => {
return (
<article className={`${level.toLowerCase()} unleash-academy-level-container`}>
<article
className={`${level.toLowerCase()} unleash-academy-level-container`}
>
<div className='header'>
<span className='unleash-academy-level-badge'>{level}</span>
<h3>{header}</h3>

View File

@ -1,13 +1,15 @@
// biome-ignore lint: Docusaurus doesn't work without the React import
import React from 'react';
import styles from './styles.module.css';
const svg = () => (
<svg
className={styles['icon']}
viewBox="0 0 12 12"
xmlns="http://www.w3.org/2000/svg"
className={styles.icon}
viewBox='0 0 12 12'
xmlns='http://www.w3.org/2000/svg'
>
<path d="m6 5.293 4.789-4.79.707.708-4.79 4.79 4.79 4.789-.707.707-4.79-4.79-4.789 4.79-.707-.707L5.293 6 .502 1.211 1.21.504 6 5.294z" />
<title>Close Icon</title>
<path d='m6 5.293 4.789-4.79.707.708-4.79 4.79 4.79 4.789-.707.707-4.79-4.79-4.789 4.79-.707-.707L5.293 6 .502 1.211 1.21.504 6 5.294z' />
</svg>
);