Skip to content

chore: Apply ESLint rule (object-shorthand) #7851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion apps/site/app/[locale]/next-data/api-data/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const GET = async () => {
const deflatedSource = deflateSync(cleanedContent).toString('base64');

return {
filename,
filename: filename,
pathname: getPathnameForApiFile(name, versionWithPrefix),
content: deflatedSource,
};
Expand Down
4 changes: 2 additions & 2 deletions apps/site/app/[locale]/next-data/page-data/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ export const GET = async () => {
const cleanedContent = parseRichTextIntoPlainText(matter(source).content);

// Deflates a String into a base64 string-encoded (zlib compressed)
const deflatedSource = deflateSync(cleanedContent).toString('base64');
const content = deflateSync(cleanedContent).toString('base64');

// Returns metadata of each page available on the Website
return {
filename,
pathname,
title,
description,
content: deflatedSource,
content,
};
});

Expand Down
8 changes: 4 additions & 4 deletions apps/site/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ const getPage: FC<DynamicParams> = async props => {

// Metadata and shared Context to be available through the lifecycle of the page
const sharedContext = {
frontmatter,
headings,
frontmatter: frontmatter,
headings: headings,
pathname: `/${pathname}`,
readingTime,
filename,
readingTime: readingTime,
filename: filename,
};

// Defines a shared Server Context for the Client-Side
Expand Down
6 changes: 3 additions & 3 deletions apps/site/components/withAvatarGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const WithAvatarGroup: FC<WithAvatarGroupProps> = ({
}) => (
<AvatarGroup
avatars={getAuthors({
usernames: usernames,
names: names,
clickable: clickable,
usernames,
names,
clickable,
})}
as={Link}
{...props}
Expand Down
4 changes: 3 additions & 1 deletion apps/site/components/withBreadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ const WithBreadcrumbs: FC<WithBreadcrumbsProps> = ({ navKeys = [] }) => {
// Goes deeper on the tree of items if there are any.
currentNode = items;

return label ? [...breadcrumbs, { label, href: link }] : breadcrumbs;
return label
? [...breadcrumbs, { label: label, href: link }]
: breadcrumbs;
}

return breadcrumbs;
Expand Down
5 changes: 4 additions & 1 deletion apps/site/components/withFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ const WithFooter: FC = () => {
// Add OpenJS link
updatedFooterLinks.push(footerLinks.at(-1)!);

const navigation = { socialLinks, footerLinks: updatedFooterLinks };
const navigation = {
socialLinks: socialLinks,
footerLinks: updatedFooterLinks,
};

return <Footer navigation={navigation} as={Link} pathname={pathname} />;
};
Expand Down
4 changes: 2 additions & 2 deletions apps/site/components/withNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ const WithNavBar: FC = () => {

<NavBar
navItems={navigationItems.map(([, { label, link, target }]) => ({
link,
link: link,
text: label,
target,
target: target,
}))}
pathname={pathname}
as={Link}
Expand Down
4 changes: 2 additions & 2 deletions apps/site/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FlatCompat } from '@eslint/eslintrc';
import importX from 'eslint-plugin-import-x';
import { flatConfigs } from 'eslint-plugin-import-x';
import * as mdx from 'eslint-plugin-mdx';
import react from 'eslint-plugin-react';
import tseslint from 'typescript-eslint';
Expand All @@ -25,7 +25,7 @@ export default tseslint.config(
extends: [
react.configs.flat['jsx-runtime'],
...tseslint.configs.recommended,
importX.flatConfigs.typescript,
flatConfigs.typescript,
...compatConfig,
],
files: ['**/*.{js,md,mdx,mjs,ts,tsx}'],
Expand Down
2 changes: 1 addition & 1 deletion apps/site/hooks/react-generic/useSiteNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const useSiteNavigation = () => {
] => [
key,
{
target,
target: target,
label: label ? getFormattedMessage(label, key) : '',
link: link ? replaceLinkWithContext(link, context[key]) : '',
items: items ? mapNavigationEntries(items, context) : [],
Expand Down
2 changes: 1 addition & 1 deletion apps/site/i18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default getRequestConfig(async ({ requestLocale }) => {
}

return {
locale,
locale: locale,
// This is the dictionary of messages to be loaded
messages: await loadLocaleDictionary(locale),
// We always define the App timezone as UTC
Expand Down
7 changes: 6 additions & 1 deletion apps/site/layouts/Blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ const getBlogCategory = (pathname: string) => {
Number(page)
);

return { category, posts, pagination, page: Number(page) };
return {
category: category,
posts: posts,
pagination: pagination,
page: Number(page),
};
};

const BlogLayout: FC = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('generateWebsiteFeeds', () => {
id: blogData.posts[0].slug,
title: blogData.posts[0].title,
guid: `${blogData.posts[0].slug}?${date.getTime()}`,
date,
date: date,
link: `${base}${blogData.posts[0].slug}`,
},
]);
Expand Down
11 changes: 9 additions & 2 deletions apps/site/next-data/generators/blogData.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ const getFrontMatter = (filename, source) => {
// this is the url used for the blog post it based on the category and filename
const slug = `/blog/${category}/${basename(filename, extname(filename))}`;

return { title, author, username, date: new Date(date), categories, slug };
return {
title: title,
author: author,
username: username,
date: new Date(date),
categories: categories,
slug: slug,
};
};

/**
Expand Down Expand Up @@ -103,7 +110,7 @@ const generateBlogData = async () => {
)
);

return { categories: [...blogCategories], posts };
return { categories: [...blogCategories], posts: posts };
};

export default generateBlogData;
8 changes: 4 additions & 4 deletions apps/site/next-data/generators/releaseData.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const generateReleaseData = async () => {
absolute: false,
});

const nodevuOutput = await nodevu({ fetch: fetch });
const nodevuOutput = await nodevu({ fetch });

const majors = Object.entries(nodevuOutput).filter(
([version, { support }]) => {
Expand Down Expand Up @@ -91,7 +91,7 @@ const generateReleaseData = async () => {

return {
...support,
status,
status: status,
major: latestVersion.semver.major,
version: latestVersion.semver.raw,
versionWithPrefix: `v${latestVersion.semver.raw}`,
Expand All @@ -101,8 +101,8 @@ const generateReleaseData = async () => {
v8: latestVersion.dependencies.v8,
releaseDate: latestVersion.releaseDate,
modules: latestVersion.modules.version || '',
releaseAnnounceLink,
minorVersions,
releaseAnnounceLink: releaseAnnounceLink,
minorVersions: minorVersions,
};
});
};
Expand Down
2 changes: 1 addition & 1 deletion apps/site/next-data/generators/websiteFeeds.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const generateWebsiteFeeds = ({ posts }) => {
id: post.slug,
title: post.title,
author: post.author,
date,
date: date,
link: `${canonicalUrl}${post.slug}`,
guid:
time > guidTimestampStartDate
Expand Down
4 changes: 2 additions & 2 deletions apps/site/next.calendar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export const getCalendarEvents = async (calendarId = '', maxResults = 20) => {
nextWeekDate.setDate(currentDate.getDate() + 7);

const calendarQueryParams = new URLSearchParams({
calendarId,
maxResults,
calendarId: calendarId,
maxResults: maxResults,
singleEvents: true,
timeZone: 'Etc/Utc',
key: SHARED_CALENDAR_KEY,
Expand Down
8 changes: 4 additions & 4 deletions apps/site/next.dynamic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const getPathname = (path = []) => path.join('/');
// we use a platform-specific separator to split the pathname
// since we're using filepaths here and not URL paths
const mapPathToRoute = (locale = defaultLocale.code, path = '') => ({
locale,
locale: locale,
path: path.split(sep),
});

Expand Down Expand Up @@ -122,7 +122,7 @@ const getDynamicRouter = async () => {
`${locale}${normalizedPathname}`
);

return { source: fileContent, filename };
return { source: fileContent, filename: filename };
}

// Attempts to read a file or simply (and silently) fail, as the file might
Expand All @@ -140,7 +140,7 @@ const getDynamicRouter = async () => {
fileLanguageContent
);

return { source: fileLanguageContent, filename };
return { source: fileLanguageContent, filename: filename };
}

// Prevent infinite loops as if at this point the file does not exist with the default locale
Expand All @@ -160,7 +160,7 @@ const getDynamicRouter = async () => {
// of the same locale for this file and improve read performance
cachedMarkdownFiles.set(`${locale}${normalizedPathname}`, fileContent);

return { source: fileContent, filename };
return { source: fileContent, filename: filename };
}

return { filename: '', source: '' };
Expand Down
10 changes: 5 additions & 5 deletions apps/site/next.mdx.use.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import WithNodeRelease from './components/withNodeRelease';
* @satisfies {import('mdx/types').MDXComponents}
*/
export const mdxComponents = {
DownloadReleasesTable: DownloadReleasesTable,
DownloadReleasesTable,
// HOC for getting Node.js Release Metadata
WithNodeRelease: WithNodeRelease,
WithNodeRelease,
// HOC for providing Banner Data
WithBanner: WithBanner,
WithBanner,
// HOC for providing Badge Data
WithBadgeGroup: WithBadgeGroup,
WithBadgeGroup,
// Renders an container for Upcoming Node.js Meetings
UpcomingMeetings: UpcomingMeetings,
UpcomingMeetings,
};
4 changes: 2 additions & 2 deletions apps/site/next.rewrites.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const redirects = async () => {
// We prevent permanent redirects as in general the redirects are safeguards
// of legacy or old pages or pages that moved, and in general we don't want permanent redirects
permanent: false,
destination,
destination: destination,
}));
};

Expand All @@ -40,7 +40,7 @@ const rewrites = async () => {
const mappedRewrites = siteRedirects.internal.map(
({ source, destination }) => ({
source: source.replace('/:locale', localesMatch),
destination,
destination: destination,
})
);

Expand Down
2 changes: 1 addition & 1 deletion apps/site/pages/en/learn/getting-started/fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async function streamOllamaCompletion(prompt) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ prompt, model: 'mistral' }),
body: JSON.stringify({ prompt: prompt, model: 'mistral' }),
});

// You can read about HTTP status codes here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ import { Readable } from 'node:stream';
// Create a custom Readable stream
const myReadableStream = new Readable({
objectMode: true,
read(size) {
read: function (size) {
// Push some data onto the stream
this.push({ message: 'Hello, world!' });
this.push(null); // Mark the end of the stream
Expand Down
10 changes: 5 additions & 5 deletions apps/site/pages/en/learn/modules/how-to-use-streams.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ To create a new transform stream, we can pass an `options` object to the `Transf
const { Transform } = require('node:stream');

const upper = new Transform({
transform: function (data, enc, cb) {
transform(data, enc, cb) {
this.push(data.toString().toUpperCase());
cb();
},
Expand All @@ -393,7 +393,7 @@ const upper = new Transform({
import { Transform } from 'node:stream';

const upper = new Transform({
transform: function (data, enc, cb) {
transform(data, enc, cb) {
this.push(data.toString().toUpperCase());
cb();
},
Expand Down Expand Up @@ -456,7 +456,7 @@ import { Transform } from 'node:stream';

let errorCount = 0;
const upper = new Transform({
transform: function (data, enc, cb) {
transform(data, enc, cb) {
if (errorCount === 10) {
return cb(new Error('BOOM!'));
}
Expand Down Expand Up @@ -549,7 +549,7 @@ import { Transform, pipeline } from 'node:stream';

let errorCount = 0;
const upper = new Transform({
transform: function (data, enc, cb) {
transform(data, enc, cb) {
if (errorCount === 10) {
return cb(new Error('BOOM!'));
}
Expand Down Expand Up @@ -671,7 +671,7 @@ import { Readable } from 'node:stream';

const readable = Readable({
objectMode: true,
read() {
read: function () {
this.push({ hello: 'world' });
this.push(null);
},
Expand Down
11 changes: 6 additions & 5 deletions apps/site/reducers/releaseReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ export const releaseState: Types.ReleaseState = {
export const getActions = (
dispatch: Dispatch<Types.ReleaseAction>
): Types.ReleaseDispatchActions => ({
setVersion: payload => dispatch({ type: 'SET_VERSION', payload }),
setOS: payload => dispatch({ type: 'SET_OS', payload }),
setPlatform: payload => dispatch({ type: 'SET_PLATFORM', payload }),
setVersion: payload => dispatch({ type: 'SET_VERSION', payload: payload }),
setOS: payload => dispatch({ type: 'SET_OS', payload: payload }),
setPlatform: payload => dispatch({ type: 'SET_PLATFORM', payload: payload }),
setInstallMethod: payload =>
dispatch({ type: 'SET_INSTALL_METHOD', payload }),
setPackageManager: payload => dispatch({ type: 'SET_MANAGER', payload }),
dispatch({ type: 'SET_INSTALL_METHOD', payload: payload }),
setPackageManager: payload =>
dispatch({ type: 'SET_MANAGER', payload: payload }),
});

const reducer = (
Expand Down
2 changes: 1 addition & 1 deletion apps/site/scripts/orama-search/get-documents.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const siteContent = [...pageData, ...apiData]
const path = `${pathname}#${slug(section.pageSectionTitle)}`;

return {
path,
path: path,
siteSection: uppercaseFirst(siteSection),
pageTitle: title,
...section,
Expand Down
Loading
Loading