Skip to content

Commit

Permalink
Apply biome formatting to the docs website (#6523)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alvinometric committed Mar 13, 2024
1 parent 422af36 commit 3ea9496
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 193 deletions.
24 changes: 6 additions & 18 deletions biome.json
Expand Up @@ -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"
]
Expand All @@ -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
},
Expand Down
2 changes: 1 addition & 1 deletion website/babel.config.js
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
55 changes: 21 additions & 34 deletions website/docusaurus.config.js
Expand Up @@ -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',
},
],
},
Expand All @@ -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',
Expand Down Expand Up @@ -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: [
[
Expand Down Expand Up @@ -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',
},
{
Expand Down Expand Up @@ -484,10 +487,7 @@ module.exports = {
to: '/reference/projects',
},
{
from: [
'/user_guide/rbac',
'/advanced/groups',
],
from: ['/user_guide/rbac', '/advanced/groups'],
to: '/reference/rbac',
},
{
Expand Down Expand Up @@ -612,10 +612,7 @@ module.exports = {
to: '/',
},
{
from: [
'/topics/feature-flags/tutorials',
'/tutorials',
],
from: ['/topics/feature-flags/tutorials', '/tutorials'],
to: '/feature-flag-tutorials',
},
{
Expand All @@ -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',
},
{
Expand All @@ -651,7 +645,7 @@ module.exports = {
},
{
from: '/developer-guide',
to: '/contributing'
to: '/contributing',
},
{
from: [
Expand Down Expand Up @@ -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',
},
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -867,7 +856,5 @@ module.exports = {
async: true,
},
],
clientModules: [
require.resolve('./global.js'),
],
clientModules: [require.resolve('./global.js')],
};
3 changes: 1 addition & 2 deletions website/global.js
@@ -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)}();
}

6 changes: 4 additions & 2 deletions website/remote-content/shared.js
Expand Up @@ -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) === '/'
Expand Down
32 changes: 18 additions & 14 deletions website/sidebars.js
Expand Up @@ -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: [
{
Expand All @@ -34,7 +33,7 @@ module.exports = {
id: 'welcome',
label: 'Docs',
className: 'show-when-collapsed',
}
},
],
documentation: [
'welcome',
Expand All @@ -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: [
Expand Down Expand Up @@ -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: [
Expand Down Expand Up @@ -150,7 +151,6 @@ module.exports = {
label: 'Next.js',
id: 'feature-flag-tutorials/nextjs/implementing-feature-flags',
},

],
},
{
Expand All @@ -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: [
Expand Down Expand Up @@ -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: [
Expand Down Expand Up @@ -269,9 +271,8 @@ module.exports = {
'reference/api/legacy/unleash/client/metrics',
'reference/api/legacy/unleash/client/register',
],

},
]
],
},
{
label: 'Application SDKs',
Expand Down Expand Up @@ -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: [
Expand All @@ -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'],
Expand Down Expand Up @@ -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',
},
},
Expand All @@ -439,7 +443,7 @@ module.exports = {
slug: '/how-to/sso',
},
},
]
],
},
{
type: 'category',
Expand Down Expand Up @@ -518,6 +522,6 @@ module.exports = {
id: 'unleash-academy/introduction',
label: 'Unleash Academy',
className: 'show-when-collapsed',
}
},
],
};

0 comments on commit 3ea9496

Please sign in to comment.