Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const config = {
baseUrl: "/",

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
onBrokenMarkdownLinks: "warn",

i18n: {
defaultLocale: "en",
Expand Down Expand Up @@ -60,6 +60,7 @@ const config = {
onInlineTags: "warn",
onInlineAuthors: "warn",
onUntruncatedBlogPosts: "warn",

},
theme: {
customCss: "./src/css/custom.css",
Expand Down Expand Up @@ -148,7 +149,7 @@ const config = {
plugins: [
[require.resolve("./src/plugins/blogGlobalData/index.js"), {}],
"docusaurus-plugin-sass",
"plugin-image-zoom",
"docusaurus-plugin-image-zoom",
[
"docusaurus-lunr-search",
{
Expand Down
43 changes: 36 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,54 @@
"lint": "markdownlint-cli2 --config .markdownlint.jsonc --fix \"**/*.md\" \"#node_modules\""
},
"dependencies": {
"@docusaurus/core": "3.7.0",
"@docusaurus/plugin-content-blog": "^3.7.0",
"@docusaurus/plugin-google-gtag": "^3.7.0",
"@docusaurus/preset-classic": "3.7.0",
"@ai-sdk/gateway": "1.0.39",
"@ai-sdk/react": "2.0.68",
"@algolia/autocomplete-core": "1.19.2",
"@algolia/autocomplete-plugin-algolia-insights": "1.19.2",
"@docsearch/css": "4.2.0",
"@docsearch/react": "4.2.0",
"@docusaurus/core": "3.9.1",
"@docusaurus/plugin-content-blog": "^3.9.1",
"@docusaurus/plugin-css-cascade-layers": "3.9.1",
"@docusaurus/plugin-debug": "3.9.1",
"@docusaurus/plugin-google-analytics": "3.9.1",
"@docusaurus/plugin-google-gtag": "3.9.1",
"@docusaurus/plugin-google-tag-manager": "3.9.1",
"@docusaurus/plugin-sitemap": "3.9.1",
"@docusaurus/plugin-svgr": "3.9.1",
"@docusaurus/preset-classic": "3.9.1",
"@docusaurus/theme-classic": "3.9.1",
"@docusaurus/theme-search-algolia": "3.9.1",
"@mdx-js/react": "^3.0.0",
"@node-rs/jieba": "^2.0.1",
"@opentelemetry/api": "1.9.0",
"@standard-schema/spec": "1.0.0",
"@vercel/oidc": "3.0.2",
"ai": "5.0.68",
"algoliasearch": "5.40.0",
"algoliasearch-helper": "3.26.0",
"clsx": "^2.0.0",
"docusaurus-lunr-search": "^3.6.0",
"docusaurus-plugin-image-zoom": "^3.0.1",
"docusaurus-plugin-sass": "^0.2.6",
"plugin-image-zoom": "flexanalytics/plugin-image-zoom",
"eventsource-parser": "3.0.6",
"json-schema": "0.4.0",
"marked": "16.4.0",
"prism-react-renderer": "^2.3.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-json-view-lite": "2.5.0",
"react-slick": "^0.30.3",
"reading-time": "^1.5.0",
"sass": "^1.84.0",
"slick-carousel": "^1.8.1"
"slick-carousel": "^1.8.1",
"swr": "2.3.6",
"throttleit": "2.1.0",
"use-sync-external-store": "1.6.0",
"zod": "4.1.12"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.7.0",
"@docusaurus/module-type-aliases": "3.9.1",
"@docusaurus/types": "3.7.0",
"markdownlint-cli2": "^0.18.1"
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/Blogs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function Blogs() {
</div>
<div className="right">
{blogPosts.slice(0, 3).map((item, index) => (
<div key={index} className="viewBlogContainer">
<div key={item.metadata.permalink} className="viewBlogContainer">/* Better to use unique identifer than index as key */

Choose a reason for hiding this comment

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

critical

An invalid C-style comment (/* ... */) has been added within the JSX. This will cause a syntax error and break the React application. Comments inside JSX should be enclosed in curly braces and asterisks like {/* this is a comment */}. Since this comment just explains a standard React practice, it's better to remove it entirely for cleaner code.

Suggested change
<div key={item.metadata.permalink} className="viewBlogContainer">/* Better to use unique identifer than index as key */
<div key={item.metadata.permalink} className="viewBlogContainer">

<h3 onClick={() => history.push(item.metadata.permalink)}>
{item.metadata.title}
</h3>
Expand All @@ -35,7 +35,7 @@ export default function Blogs() {
<div className="info">
<div className="author">
{(item.metadata?.authors || []).map((item) => (
<a href={item.url} target="_blank">
<a key={item.name} href={item.url} target="_blank" rel="noreferrer">
{item.name}
</a>
))}
Comment on lines 37 to 41

Choose a reason for hiding this comment

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

medium

There are a couple of improvements that can be made here for clarity and robustness:

  1. The variable item is being reused in the inner map function, which shadows the item variable from the outer map. This can make the code harder to read. It's better to use a more descriptive name like author.
  2. Using item.name as a key is good, but author names might not be unique within a single post. The item.url is more likely to be a unique identifier. Using a guaranteed unique value for the key is a React best practice.
Suggested change
{(item.metadata?.authors || []).map((item) => (
<a href={item.url} target="_blank">
<a key={item.name} href={item.url} target="_blank" rel="noreferrer">
{item.name}
</a>
))}
{(item.metadata?.authors || []).map((author) => (
<a key={author.url} href={author.url} target="_blank" rel="noreferrer">
{author.name}
</a>
))}

Copy link
Contributor

Choose a reason for hiding this comment

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

@Payel-Manna please modify your code to given suggested code by ai.

Expand Down
Loading