1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02: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", "node_modules",
"docker", "docker",
"bundle.js", "bundle.js",
"website/blog",
"website/build", "website/build",
"website/core", "website/global.js",
"website/docs",
"website/i18n/*.js",
"website/pages",
"website/translated_docs",
"website",
"setupJest.js", "setupJest.js",
"dist", "dist",
"build", "build",
"src/migrations/*.js", "src/migrations/*.js",
"src/test/examples/*.json", "src/test/examples/*.json",
"website/**/*.js", ".docusaurus",
"coverage", "coverage",
"CHANGELOG.md" "CHANGELOG.md"
] ]
@ -68,22 +62,16 @@
"node_modules", "node_modules",
"docker", "docker",
"bundle.js", "bundle.js",
"website/blog",
"website/build",
"website/core",
"website/docs",
"website/i18n/*.js",
"website/pages",
"website/translated_docs",
"website",
"setupJest.js", "setupJest.js",
"dist", "dist",
"build", "build",
"src/migrations/*.js", "src/migrations/*.js",
"src/migrations/*.json", "src/migrations/*.json",
"src/test/examples/*.json", "src/test/examples/*.json",
"website/**/*.js", "coverage",
"coverage" "website/build",
"website/global.js",
".docusaurus"
], ],
"indentWidth": 4 "indentWidth": 4
}, },

View File

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

View File

@ -1,4 +1,3 @@
if(typeof document !== 'undefined') { 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 generationTime = new Date();
const processedFilename = (() => { const processedFilename = (() => {
const constructed = const constructed = `${path.join(
path.join(filePath(data) ?? '', data.slugName) + '.md'; filePath(data) ?? '',
data.slugName,
)}.md`;
// ensure the file path does *not* start with a leading / // ensure the file path does *not* start with a leading /
return constructed.charAt(0) === '/' return constructed.charAt(0) === '/'

View File

@ -12,7 +12,6 @@
// TODO: Add warning to legacy API docs - but generated items // TODO: Add warning to legacy API docs - but generated items
// TODO: Continue to clean URLs & redirects - but wait for SEO results first // TODO: Continue to clean URLs & redirects - but wait for SEO results first
module.exports = { module.exports = {
academy: [ academy: [
{ {
@ -34,7 +33,7 @@ module.exports = {
id: 'welcome', id: 'welcome',
label: 'Docs', label: 'Docs',
className: 'show-when-collapsed', className: 'show-when-collapsed',
} },
], ],
documentation: [ documentation: [
'welcome', 'welcome',
@ -46,7 +45,8 @@ module.exports = {
link: { link: {
type: 'generated-index', type: 'generated-index',
title: 'Feature Flag Best Practices', 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', slug: '/topics',
}, },
items: [ items: [
@ -96,7 +96,8 @@ module.exports = {
link: { link: {
type: 'generated-index', type: 'generated-index',
title: 'Feature Flag Tutorials', 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', slug: 'feature-flag-tutorials',
}, },
items: [ items: [
@ -150,7 +151,6 @@ module.exports = {
label: 'Next.js', label: 'Next.js',
id: 'feature-flag-tutorials/nextjs/implementing-feature-flags', id: 'feature-flag-tutorials/nextjs/implementing-feature-flags',
}, },
], ],
}, },
{ {
@ -160,7 +160,8 @@ module.exports = {
link: { link: {
type: 'generated-index', type: 'generated-index',
title: 'Understanding Unleash', 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', slug: 'understanding-unleash',
}, },
items: [ items: [
@ -226,7 +227,8 @@ module.exports = {
link: { link: {
type: 'generated-index', type: 'generated-index',
title: 'Using Unleash', 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', slug: '/using-unleash',
}, },
items: [ items: [
@ -269,9 +271,8 @@ module.exports = {
'reference/api/legacy/unleash/client/metrics', 'reference/api/legacy/unleash/client/metrics',
'reference/api/legacy/unleash/client/register', 'reference/api/legacy/unleash/client/register',
], ],
}, },
] ],
}, },
{ {
label: 'Application SDKs', label: 'Application SDKs',
@ -343,7 +344,8 @@ module.exports = {
link: { link: {
type: 'generated-index', type: 'generated-index',
title: 'How-to: Unleash API', 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', slug: '/how-to/api',
}, },
items: [ items: [
@ -362,7 +364,8 @@ module.exports = {
link: { link: {
type: 'generated-index', type: 'generated-index',
title: 'How-to: The Unleash Proxy', 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', slug: '/how-to/proxy',
}, },
items: ['how-to/how-to-run-the-unleash-proxy'], items: ['how-to/how-to-run-the-unleash-proxy'],
@ -417,7 +420,8 @@ module.exports = {
link: { link: {
type: 'generated-index', type: 'generated-index',
title: 'How-to: users and permissions', 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', slug: '/how-to/users-and-permissions',
}, },
}, },
@ -439,7 +443,7 @@ module.exports = {
slug: '/how-to/sso', slug: '/how-to/sso',
}, },
}, },
] ],
}, },
{ {
type: 'category', type: 'category',
@ -518,6 +522,6 @@ module.exports = {
id: 'unleash-academy/introduction', id: 'unleash-academy/introduction',
label: 'Unleash Academy', label: 'Unleash Academy',
className: 'show-when-collapsed', 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. types, for instance.
**/ **/
import React from 'react'; import React from 'react';
import Tabs from '@theme/Tabs'; import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem'; import TabItem from '@theme/TabItem';
@ -85,19 +84,19 @@ http ${verbUpper} \\
).trim(); ).trim();
return ( return (
<Tabs groupId="api-request"> <Tabs groupId='api-request'>
<TabItem value="http" label="HTTP"> <TabItem value='http' label='HTTP'>
<CodeBlock language="http" title={title}> <CodeBlock language='http' title={title}>
{httpBlock} {httpBlock}
</CodeBlock> </CodeBlock>
</TabItem> </TabItem>
<TabItem value="curl" label="cURL"> <TabItem value='curl' label='cURL'>
<CodeBlock language="bash" title={title}> <CodeBlock language='bash' title={title}>
{curlBlock} {curlBlock}
</CodeBlock> </CodeBlock>
</TabItem> </TabItem>
<TabItem value="httpie" label="HTTPie"> <TabItem value='httpie' label='HTTPie'>
<CodeBlock language="bash" title={title}> <CodeBlock language='bash' title={title}>
{httpieBlock} {httpieBlock}
</CodeBlock> </CodeBlock>
</TabItem> </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 React from 'react';
import useBaseUrl from '@docusaurus/useBaseUrl'; 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 React from 'react';
import Admonition from '@theme/Admonition'; import Admonition from '@theme/Admonition';
@ -12,9 +13,8 @@ const Component = ({ videoUrls }) => {
height='auto' height='auto'
src={url} src={url}
title='YouTube video player' title='YouTube video player'
frameBorder='0'
allowFullScreen allowFullScreen
></iframe> />
)) ))
) : ( ) : (
<Admonition type='danger'> <Admonition type='danger'>

View File

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

View File

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

View File

@ -1,10 +1,12 @@
// biome-ignore lint: Docusaurus doesn't work without the React import
import React from 'react'; import React from 'react';
import Link from '@docusaurus/Link'; import Link from '@docusaurus/Link';
const LinkBox = ({ level, header, description, link }) => { const LinkBox = ({ level, header, description, link }) => {
return ( return (
<article className={`${level.toLowerCase()} unleash-academy-level-container`}> <article
className={`${level.toLowerCase()} unleash-academy-level-container`}
>
<div className='header'> <div className='header'>
<span className='unleash-academy-level-badge'>{level}</span> <span className='unleash-academy-level-badge'>{level}</span>
<h3>{header}</h3> <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 React from 'react';
import styles from './styles.module.css'; import styles from './styles.module.css';
const svg = () => ( const svg = () => (
<svg <svg
className={styles['icon']} className={styles.icon}
viewBox="0 0 12 12" viewBox='0 0 12 12'
xmlns="http://www.w3.org/2000/svg" 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> </svg>
); );