From 56425a00f3b6fd2c40941c1be7175ec8266547d9 Mon Sep 17 00:00:00 2001 From: Yurii Palamarchuk Date: Tue, 24 Mar 2026 11:53:45 +0100 Subject: [PATCH] Add prettier and fix lint of js/jsx/css files --- babel.config.js | 2 +- docusaurus.config.js | 208 ++++++++------ eslint.config.mjs | 114 ++++---- package.json | 5 +- pnpm-lock.yaml | 77 +++++ prettier.config.mjs | 9 + src/components/AskQuestionForm/index.jsx | 33 ++- .../AskQuestionForm/styles.module.css | 4 +- src/components/SwaggerUI/index.js | 29 +- src/components/SwaggerUI/styles.module.css | 79 ++++-- src/css/custom.css | 45 ++- src/css/footer.css | 7 +- src/css/header.css | 4 +- src/pages/index.jsx | 264 +++++++++--------- src/theme/DocSidebar/index.jsx | 16 +- src/theme/DocSidebar/index.module.css | 33 +-- src/theme/Footer/LinkItem/index.jsx | 57 ++-- 17 files changed, 598 insertions(+), 388 deletions(-) create mode 100644 prettier.config.mjs diff --git a/babel.config.js b/babel.config.js index 5c94bb7884..47399b1332 100644 --- a/babel.config.js +++ b/babel.config.js @@ -18,5 +18,5 @@ */ module.exports = { - presets: [require.resolve('@docusaurus/core/lib/babel/preset')], + presets: [require.resolve('@docusaurus/core/lib/babel/preset')] }; diff --git a/docusaurus.config.js b/docusaurus.config.js index be70bdf939..f1bd034330 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -22,14 +22,15 @@ import Ajv from 'ajv'; -const {themes} = require('prism-react-renderer'); +const { themes } = require('prism-react-renderer'); const lightCodeTheme = themes.github; const darkCodeTheme = themes.dracula; /** @type {import('@docusaurus/types').Config} */ const config = { title: 'Apache Ozone', - tagline: 'Scalable, reliable, distributed storage system optimized for data analytics and object store workloads.', + tagline: + 'Scalable, reliable, distributed storage system optimized for data analytics and object store workloads.', // Set the production URL of the website. Must be updated when the final site is deployed. // This must match the URL the website is hosted at for social media previews to work. // If you are testing the social media image (themeConfig.image) locally, set this to http://localhost:3001. @@ -50,7 +51,7 @@ const config = { // to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', - locales: ['en'], + locales: ['en'] }, /* @@ -64,37 +65,37 @@ const config = { rel: 'icon', href: 'favicon.ico', sizes: '32x32' - }, + } }, { tagName: 'link', attributes: { rel: 'icon', href: 'favicon.svg', - type: "image/svg+xml" - }, + type: 'image/svg+xml' + } }, { tagName: 'link', attributes: { rel: 'apple-touch-icon', - href: 'apple-touch-icon.png', - }, + href: 'apple-touch-icon.png' + } }, { tagName: 'meta', attributes: { name: 'google-site-verification', - content: 'fXhAWQ_Jb1fOk6QlN9a7Zs_Xsj-E2U0Q8oFqTNVclaE', - }, + content: 'fXhAWQ_Jb1fOk6QlN9a7Zs_Xsj-E2U0Q8oFqTNVclaE' + } }, { tagName: 'meta', attributes: { name: 'algolia-site-verification', - content: 'A2998EF969F36A0D', - }, - }, + content: 'A2998EF969F36A0D' + } + } ], markdown: { @@ -117,8 +118,15 @@ const config = { const isValid = validate(result.frontMatter); if (!isValid) { - console.error('Front matter validation error in', params.filePath + ':\n', validate.errors); - console.error('Front matter validation failed against JSON schema', schemaPath); + console.error( + 'Front matter validation error in', + params.filePath + ':\n', + validate.errors + ); + console.error( + 'Front matter validation failed against JSON schema', + schemaPath + ); process.exit(1); } @@ -130,8 +138,10 @@ const config = { Docusaurus can resolve links without these. See https://docusaurus.io/docs/api/docusaurus-config#markdown for reference. */ - preprocessor: (/** @type {{filePath: string, fileContent: string}} */ params) => { - const {filePath, fileContent} = params; + preprocessor: ( + /** @type {{filePath: string, fileContent: string}} */ params + ) => { + const { filePath, fileContent } = params; // Strip HTML comments and fenced code blocks to avoid false positives. // Replace non-newline characters with spaces to preserve line numbers. @@ -141,7 +151,8 @@ const config = { // Match markdown links but exclude images (which start with !) // Uses negative lookbehind (? -> ./ozone-manager.md) const linkPath = matches[2].replace(/^<|>$/g, ''); @@ -164,7 +177,8 @@ const config = { // Skip absolute paths to pages/static (e.g., /download, /foo.pdf) since they are not versioned // Only check absolute paths to /docs/ which breaks versioning - const isAbsoluteNonDocsPath = linkPath.startsWith('/') && !linkPath.startsWith('/docs/'); + const isAbsoluteNonDocsPath = + linkPath.startsWith('/') && !linkPath.startsWith('/docs/'); if (isAbsoluteNonDocsPath) { continue; } @@ -188,7 +202,9 @@ const config = { } // Check reference link definitions: [ref]: url - while ((matches = refLinkDefPattern.exec(contentForValidation)) !== null) { + while ( + (matches = refLinkDefPattern.exec(contentForValidation)) !== null + ) { const linkText = matches[1]; const linkPath = matches[2].replace(/^<|>$/g, ''); @@ -198,7 +214,8 @@ const config = { const pathWithoutFragment = linkPath.split('#')[0]; - const isAbsoluteNonDocsPath = linkPath.startsWith('/') && !linkPath.startsWith('/docs/'); + const isAbsoluteNonDocsPath = + linkPath.startsWith('/') && !linkPath.startsWith('/docs/'); if (isAbsoluteNonDocsPath) { continue; } @@ -211,24 +228,32 @@ const config = { invalidLinks.push({ text: linkText, path: linkPath, - line: contentForValidation.substring(0, matches.index).split('\n').length + line: contentForValidation.substring(0, matches.index).split('\n') + .length }); } } if (invalidLinks.length > 0) { - const errorMsg = invalidLinks.map(link => - ` Line ${link.line}: [${link.text}](${link.path})` - ).join('\n'); - - console.error('Invalid internal links found in', filePath + ':\n' + errorMsg); - console.error('\nInternal links should not include absolute paths to docs, number prefixes, or route file extensions (.md, .mdx, .js, .jsx, .tsx).'); - console.error('Example: use \'./ozone-manager#persisted-state\' instead of \'./02-ozone-manager.md#persisted-state\''); + const errorMsg = invalidLinks + .map((link) => ` Line ${link.line}: [${link.text}](${link.path})`) + .join('\n'); + + console.error( + 'Invalid internal links found in', + filePath + ':\n' + errorMsg + ); + console.error( + '\nInternal links should not include absolute paths to docs, number prefixes, or route file extensions (.md, .mdx, .js, .jsx, .tsx).' + ); + console.error( + "Example: use './ozone-manager#persisted-state' instead of './02-ozone-manager.md#persisted-state'" + ); process.exit(1); } return fileContent; - }, + } }, presets: [ @@ -238,26 +263,21 @@ const config = { ({ docs: { sidebarPath: undefined, - editUrl: - 'https://github.com/apache/ozone-site/tree/master', + editUrl: 'https://github.com/apache/ozone-site/tree/master', // TODO: The following sections are currently hidden. Ensure that a section contains a few pages // of publishable quality before enabling visibility for that section. - exclude: [ - '**/06-troubleshooting/**', - '**/07-system-internals/**', - ] + exclude: ['**/06-troubleshooting/**', '**/07-system-internals/**'] }, blog: { showReadingTime: true, - editUrl: - 'https://github.com/apache/ozone-site/tree/master/', + editUrl: 'https://github.com/apache/ozone-site/tree/master/' }, theme: { customCss: [ require.resolve('./src/css/custom.css'), require.resolve('./src/css/header.css'), - require.resolve('./src/css/footer.css'), - ], + require.resolve('./src/css/footer.css') + ] }, sitemap: { /* @@ -265,22 +285,30 @@ const config = { See https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-sitemap#ex-config for reference. */ createSitemapItems: async (params) => { - const {defaultCreateSitemapItems, ...rest} = params; + const { defaultCreateSitemapItems, ...rest } = params; const items = await defaultCreateSitemapItems(rest); - const validUrlRegex = /^https:\/\/ozone\.apache\.org\/([a-z0-9][a-z0-9./-]*[a-z0-9/])?$/; + const validUrlRegex = + /^https:\/\/ozone\.apache\.org\/([a-z0-9][a-z0-9./-]*[a-z0-9/])?$/; items.forEach((item) => { if (!validUrlRegex.test(item.url)) { - console.error('Generated URL', item.url, 'does not match the allowed RegEx:', validUrlRegex); - console.error('All URLs should use kebab case and lowercase letters.'); - process.exit(1); + console.error( + 'Generated URL', + item.url, + 'does not match the allowed RegEx:', + validUrlRegex + ); + console.error( + 'All URLs should use kebab case and lowercase letters.' + ); + process.exit(1); } }); return items; - }, - }, - }), - ], + } + } + }) + ] ], plugins: [ @@ -291,10 +319,10 @@ const config = { { tagName: 'link', rel: 'manifest', - href: 'pwa/manifest.json', - }, - ], - }, + href: 'pwa/manifest.json' + } + ] + } ] ], @@ -304,7 +332,7 @@ const config = { ({ colorMode: { defaultMode: 'light', - respectPrefersColorScheme: true, // Automatically use dark mode when the user's system prefers it + respectPrefersColorScheme: true // Automatically use dark mode when the user's system prefers it }, // Optional: Add an announcement bar to the top of the website. // announcementBar: { @@ -320,7 +348,7 @@ const config = { title: 'Apache Ozone', logo: { alt: 'Ozone Logo', - src: 'img/ozone-logo.svg', + src: 'img/ozone-logo.svg' }, items: [ { @@ -329,27 +357,27 @@ const config = { items: [ { label: 'Latest Docs', - to: 'docs', + to: 'docs' }, { label: 'Docs 2.0.0 (Archived)', href: '/docs/2.0.0/', - target: '_blank' + target: '_blank' }, { label: 'Docs 1.4.1 (Archived)', href: '/docs/1.4.1/', - target: '_blank' - }, - ], + target: '_blank' + } + ] }, { to: 'download', - label: 'Download', + label: 'Download' }, { to: 'roadmap', - label: 'Roadmap', + label: 'Roadmap' }, // TODO: The FAQ section is currently hidden. Ensure that the FAQ page // is of publishable quality before enabling visibility for this section. @@ -359,35 +387,35 @@ const config = { // }, { to: '/blog', - label: 'Blog', + label: 'Blog' }, { label: 'Community', items: [ { to: 'community/communication-channels', - label: 'Communication Channels', + label: 'Communication Channels' }, { to: 'community/who-uses-ozone', - label: 'Who Uses Ozone?', + label: 'Who Uses Ozone?' }, { to: 'community/report-an-issue', - label: 'Report An Issue', + label: 'Report An Issue' }, { to: 'community/ask-a-question', - label: 'Ask a Question', + label: 'Ask a Question' }, { to: 'community/how-to-contribute', - label: 'How to Contribute', + label: 'How to Contribute' }, { to: 'community/events-and-media', - label: 'Events and Media', - }, + label: 'Events and Media' + } ] }, // TODO: Enable if multiple languages are supported. See https://issues.apache.org/jira/browse/HDDS-9571 @@ -399,9 +427,9 @@ const config = { href: 'https://github.com/apache/ozone', position: 'right', className: 'header-github-link', - 'aria-label': 'GitHub Repo', - }, - ], + 'aria-label': 'GitHub Repo' + } + ] }, footer: { links: [ @@ -435,7 +463,7 @@ const config = { { label: 'Thanks', href: 'https://www.apache.org/foundation/thanks.html' - }, + } ] }, { @@ -464,30 +492,30 @@ const config = { { label: 'Twitter', href: 'https://twitter.com/ApacheOzone' - }, - ], + } + ] }, { title: 'Repositories', items: [ { label: 'Ozone', - to: 'https://github.com/apache/ozone', + to: 'https://github.com/apache/ozone' }, { label: 'Website', - to: 'https://github.com/apache/ozone-site', + to: 'https://github.com/apache/ozone-site' }, { label: 'Docker Image', - to: 'https://github.com/apache/ozone-docker', + to: 'https://github.com/apache/ozone-docker' }, { label: 'Docker Runner Image', - to: 'https://github.com/apache/ozone-docker-runner', - }, - ], - }, + to: 'https://github.com/apache/ozone-docker-runner' + } + ] + } ], copyright: `
@@ -495,21 +523,21 @@ const config = {

The Apache Software Foundation, Apache Ozone, Ozone, Apache, the Apache Feather, and the Apache Ozone project logo are either registered trademarks or trademarks of the Apache Software Foundation.

-
`, + ` }, prism: { theme: lightCodeTheme, darkTheme: darkCodeTheme, - additionalLanguages: ['bash'], + additionalLanguages: ['bash'] }, algolia: { - appId: "YQWKI4BIJ7", - apiKey: "47cd671112fb5e0363a4d9724beeb9d4", - indexName: "Apache Ozone website", + appId: 'YQWKI4BIJ7', + apiKey: '47cd671112fb5e0363a4d9724beeb9d4', + indexName: 'Apache Ozone website', searchParameters: {} } }), - scripts: ['/script/matomo.js'], + scripts: ['/script/matomo.js'] }; module.exports = config; diff --git a/eslint.config.mjs b/eslint.config.mjs index 73218773a8..09aeaaaaa1 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -17,102 +17,106 @@ * under the License. */ -import pluginDocusaurus from "@docusaurus/eslint-plugin"; -import css from "@eslint/css"; -import js from "@eslint/js"; -import { defineConfig } from "eslint/config"; -import pluginImport from "eslint-plugin-import-x"; -import pluginReact from "eslint-plugin-react"; -import pluginUnusedImports from "eslint-plugin-unused-imports"; -import globals from "globals"; +import pluginDocusaurus from '@docusaurus/eslint-plugin'; +import css from '@eslint/css'; +import js from '@eslint/js'; +import { defineConfig } from 'eslint/config'; +import pluginImport from 'eslint-plugin-import-x'; +import pluginPrettier from 'eslint-plugin-prettier/recommended'; +import pluginReact from 'eslint-plugin-react'; +import pluginUnusedImports from 'eslint-plugin-unused-imports'; +import globals from 'globals'; export default defineConfig([ // General { ignores: [ - "static/**", - "node_modules/**", - "build/**", - ".docusaurus/**", - ".github/**", - ], + 'static/**', + 'node_modules/**', + 'build/**', + '.docusaurus/**', + '.github/**' + ] }, + // Prettier integration + pluginPrettier, + // JS { - files: ["**/*.{js,mjs,cjs,jsx}"], + files: ['**/*.{js,mjs,cjs,jsx}'], ...js.configs.recommended, languageOptions: { globals: { ...globals.browser, ...globals.node } }, plugins: { - "unused-imports": pluginUnusedImports, - import: pluginImport, + 'unused-imports': pluginUnusedImports, + import: pluginImport }, rules: { - "unused-imports/no-unused-imports": "error", + 'unused-imports/no-unused-imports': 'error', // unused vars (but ignore underscore-prefixed) - "unused-imports/no-unused-vars": [ - "error", + 'unused-imports/no-unused-vars': [ + 'error', { - vars: "all", - varsIgnorePattern: "^_", - args: "after-used", - argsIgnorePattern: "^_", - }, + vars: 'all', + varsIgnorePattern: '^_', + args: 'after-used', + argsIgnorePattern: '^_' + } ], - "import/no-duplicates": "error", - "import/order": [ - "error", + 'import/no-duplicates': 'error', + 'import/order': [ + 'error', { groups: [ - "builtin", // Node built-ins (path, fs, etc.) - "external", // npm packages (react, @docusaurus/*, etc.) - "internal", // paths configured as internal (e.g. @site/*) - ["parent", "sibling", "index"], // relative imports + 'builtin', // Node built-ins (path, fs, etc.) + 'external', // npm packages (react, @docusaurus/*, etc.) + 'internal', // paths configured as internal (e.g. @site/*) + ['parent', 'sibling', 'index'] // relative imports ], - alphabetize: { order: "asc", caseInsensitive: true }, - }, + alphabetize: { order: 'asc', caseInsensitive: true } + } ], - "no-unused-vars": "off", - }, + 'no-unused-vars': 'off' + } }, // React { - files: ["**/*.{js,jsx}"], + files: ['**/*.{js,jsx}'], ...pluginReact.configs.flat.recommended, settings: { - react: { version: "detect" }, + react: { version: 'detect' } }, rules: { - "react/prop-types": "off", - "react/react-in-jsx-scope": "off", - "react/jsx-uses-vars": "error", - }, + 'react/prop-types': 'off', + 'react/react-in-jsx-scope': 'off', + 'react/jsx-uses-vars': 'error' + } }, // CSS { - files: ["**/*.css"], + files: ['**/*.css'], plugins: { css }, - language: "css/css", - extends: ["css/recommended"], + language: 'css/css', + extends: ['css/recommended'], rules: { - "css/no-invalid-properties": "off", - "css/no-important": "off", - "css/use-baseline": "off", - }, + 'css/no-invalid-properties': 'off', + 'css/no-important': 'off', + 'css/use-baseline': 'off' + } }, // Docusaurus { - files: ["**/*.{js,mjs,cjs,jsx}"], - plugins: { "@docusaurus": pluginDocusaurus }, + files: ['**/*.{js,mjs,cjs,jsx}'], + plugins: { '@docusaurus': pluginDocusaurus }, rules: { ...pluginDocusaurus.configs.recommended.rules, - "@docusaurus/no-html-links": "error", - "@docusaurus/prefer-docusaurus-heading": "error", + '@docusaurus/no-html-links': 'error', + '@docusaurus/prefer-docusaurus-heading': 'error' // for i18n // "@docusaurus/no-untranslated-text": ["warn", { ignoredStrings: [] }] - }, - }, + } + } ]); diff --git a/package.json b/package.json index 5c6db07908..d39eed21be 100644 --- a/package.json +++ b/package.json @@ -42,11 +42,14 @@ "ajv-cli": "^5.0.0", "cspell": "^8.17.5", "eslint": "^10.0.2", + "eslint-config-prettier": "^10.1.8", "eslint-plugin-import-x": "^4.16.2", + "eslint-plugin-prettier": "^5.5.5", "eslint-plugin-react": "^7.37.5", "eslint-plugin-unused-imports": "^4.4.1", "globals": "^17.4.0", - "markdownlint-cli": "^0.39.0" + "markdownlint-cli": "^0.39.0", + "prettier": "^3.8.1" }, "browserslist": { "production": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ab35c84b55..6d7cb68cf0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,9 +78,15 @@ importers: eslint: specifier: ^10.0.2 version: 10.0.2(jiti@1.21.7) + eslint-config-prettier: + specifier: ^10.1.8 + version: 10.1.8(eslint@10.0.2(jiti@1.21.7)) eslint-plugin-import-x: specifier: ^4.16.2 version: 4.16.2(eslint-import-resolver-node@0.3.9)(eslint@10.0.2(jiti@1.21.7)) + eslint-plugin-prettier: + specifier: ^5.5.5 + version: 5.5.5(@types/eslint@9.6.1)(eslint-config-prettier@10.1.8(eslint@10.0.2(jiti@1.21.7)))(eslint@10.0.2(jiti@1.21.7))(prettier@3.8.1) eslint-plugin-react: specifier: ^7.37.5 version: 7.37.5(eslint@10.0.2(jiti@1.21.7)) @@ -93,6 +99,9 @@ importers: markdownlint-cli: specifier: ^0.39.0 version: 0.39.0 + prettier: + specifier: ^3.8.1 + version: 3.8.1 packages: @@ -1587,6 +1596,10 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} + '@pkgr/core@0.2.9': + resolution: {integrity: sha512-QNqXyfVS2wm9hweSYD2O7F0G06uurj9kZ96TRQE5Y9hU7+tgdZwIkbAKc5Ocy1HxEY2kuDQa6cQ1WRs/O5LFKA==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + '@pnpm/config.env-replace@1.1.0': resolution: {integrity: sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w==} engines: {node: '>=12.22.0'} @@ -3480,6 +3493,12 @@ packages: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} engines: {node: '>=12'} + eslint-config-prettier@10.1.8: + resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + eslint-import-context@0.1.9: resolution: {integrity: sha512-K9Hb+yRaGAGUbwjhFNHvSmmkZs9+zbuoe3kFQ4V1wYjrepUFYM2dZAfNtjbbj3qsPfUfsA68Bx/ICWQMi+C8Eg==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} @@ -3505,6 +3524,20 @@ packages: eslint-import-resolver-node: optional: true + eslint-plugin-prettier@5.5.5: + resolution: {integrity: sha512-hscXkbqUZ2sPithAuLm5MXL+Wph+U7wHngPBv9OMWwlP8iaflyxpjTYZkmdgB4/vPIhemRlBEoLrH7UC1n7aUw==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + '@types/eslint': '>=8.0.0' + eslint: '>=8.0.0' + eslint-config-prettier: '>= 7.0.0 <10.0.0 || >=10.1.0' + prettier: '>=3.0.0' + peerDependenciesMeta: + '@types/eslint': + optional: true + eslint-config-prettier: + optional: true + eslint-plugin-react@7.37.5: resolution: {integrity: sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==} engines: {node: '>=4'} @@ -3645,6 +3678,9 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + fast-diff@1.3.0: + resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} + fast-equals@5.2.2: resolution: {integrity: sha512-V7/RktU11J3I36Nwq2JnZEM7tNm17eBJz+u25qdxBZeCKiX6BkVSZQjwWIr+IobgnZy+ag73tTZgZi7tr0LrBw==} engines: {node: '>=6.0.0'} @@ -5770,6 +5806,15 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-linter-helpers@1.0.1: + resolution: {integrity: sha512-SxToR7P8Y2lWmv/kTzVLC1t/GDI2WGjMwNhLLE9qtH8Q13C+aEmuRlzDst4Up4s0Wc8sF2M+J57iB3cMLqftfg==} + engines: {node: '>=6.0.0'} + + prettier@3.8.1: + resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} + engines: {node: '>=14'} + hasBin: true + pretty-bytes@5.6.0: resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} engines: {node: '>=6'} @@ -6584,6 +6629,10 @@ packages: react: '>=16.8.0 <20' react-dom: '>=16.8.0 <20' + synckit@0.11.12: + resolution: {integrity: sha512-Bh7QjT8/SuKUIfObSXNHNSK6WHo6J1tHCqJsuaFDP7gP0fkzSfTxI8y85JrppZ0h8l0maIgc2tfuZQ6/t3GtnQ==} + engines: {node: ^14.18.0 || >=16.0.0} + tapable@1.1.3: resolution: {integrity: sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==} engines: {node: '>=6'} @@ -9565,6 +9614,8 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true + '@pkgr/core@0.2.9': {} + '@pnpm/config.env-replace@1.1.0': {} '@pnpm/network.ca-file@1.0.2': @@ -12045,6 +12096,10 @@ snapshots: escape-string-regexp@5.0.0: {} + eslint-config-prettier@10.1.8(eslint@10.0.2(jiti@1.21.7)): + dependencies: + eslint: 10.0.2(jiti@1.21.7) + eslint-import-context@0.1.9(unrs-resolver@1.11.1): dependencies: get-tsconfig: 4.13.6 @@ -12079,6 +12134,16 @@ snapshots: transitivePeerDependencies: - supports-color + eslint-plugin-prettier@5.5.5(@types/eslint@9.6.1)(eslint-config-prettier@10.1.8(eslint@10.0.2(jiti@1.21.7)))(eslint@10.0.2(jiti@1.21.7))(prettier@3.8.1): + dependencies: + eslint: 10.0.2(jiti@1.21.7) + prettier: 3.8.1 + prettier-linter-helpers: 1.0.1 + synckit: 0.11.12 + optionalDependencies: + '@types/eslint': 9.6.1 + eslint-config-prettier: 10.1.8(eslint@10.0.2(jiti@1.21.7)) + eslint-plugin-react@7.37.5(eslint@10.0.2(jiti@1.21.7)): dependencies: array-includes: 3.1.9 @@ -12292,6 +12357,8 @@ snapshots: fast-deep-equal@3.1.3: {} + fast-diff@1.3.0: {} + fast-equals@5.2.2: {} fast-glob@3.3.3: @@ -14879,6 +14946,12 @@ snapshots: prelude-ls@1.2.1: {} + prettier-linter-helpers@1.0.1: + dependencies: + fast-diff: 1.3.0 + + prettier@3.8.1: {} + pretty-bytes@5.6.0: {} pretty-error@4.0.0: @@ -15931,6 +16004,10 @@ snapshots: - '@types/react' - debug + synckit@0.11.12: + dependencies: + '@pkgr/core': 0.2.9 + tapable@1.1.3: {} tapable@2.2.1: {} diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 0000000000..6c247f1efd --- /dev/null +++ b/prettier.config.mjs @@ -0,0 +1,9 @@ +export default { + bracketSpacing: true, + arrowParens: 'always', + trailingComma: 'none', + tabWidth: 2, + endOfLine: 'lf', + semi: true, + singleQuote: true +}; diff --git a/src/components/AskQuestionForm/index.jsx b/src/components/AskQuestionForm/index.jsx index 77d85a386a..c85d9137e1 100644 --- a/src/components/AskQuestionForm/index.jsx +++ b/src/components/AskQuestionForm/index.jsx @@ -17,8 +17,8 @@ * under the License. */ -import { useState } from 'react'; import Heading from '@theme/Heading'; +import { useState } from 'react'; import styles from './styles.module.css'; export default function AskQuestionForm() { @@ -27,15 +27,15 @@ export default function AskQuestionForm() { const handleSubmit = (e) => { e.preventDefault(); - + // Create the GitHub Discussions URL with query parameters const baseUrl = 'https://github.com/apache/ozone/discussions/new'; const category = 'faq '; const titleEncoded = encodeURIComponent(title); const bodyEncoded = encodeURIComponent(question); - + const redirectUrl = `${baseUrl}?category=${category}&title=${titleEncoded}&body=${bodyEncoded}`; - + // Redirect to GitHub Discussions with the pre-filled question window.location.href = redirectUrl; }; @@ -45,11 +45,16 @@ export default function AskQuestionForm() { Ask a Question -

Have a question about Apache Ozone? Fill out this form and we'll redirect you to GitHub Discussions with your question pre-filled.

- +

+ Have a question about Apache Ozone? Fill out this form and we'll + redirect you to GitHub Discussions with your question pre-filled. +

+
- +
- +
- +