The Node.js® Website

feat: new eslint rules (#5929)

* feat: new eslint rules

* chore: formatted files

authored by Claudio W and committed by GitHub 29533f48 2bff5f41

+26 -4
.eslintrc.json
··· 20 20 }, 21 21 { 22 22 "files": ["**/*.ts?(x)"], 23 - "plugins": ["@typescript-eslint", "no-relative-import-paths"], 24 - "extends": "plugin:@typescript-eslint/recommended", 23 + "plugins": ["@typescript-eslint", "no-relative-import-paths", "import"], 24 + "extends": [ 25 + "plugin:@typescript-eslint/recommended", 26 + "plugin:import/recommended", 27 + "plugin:import/typescript" 28 + ], 25 29 "parser": "@typescript-eslint/parser", 26 30 "rules": { 27 31 "@typescript-eslint/consistent-type-imports": "error", 28 32 "no-relative-import-paths/no-relative-import-paths": [ 29 33 "warn", 30 34 { "allowSameFolder": true, "prefix": "@" } 35 + ], 36 + "import/order": [ 37 + "error", 38 + { 39 + "groups": [ 40 + "builtin", 41 + "external", 42 + "internal", 43 + ["sibling", "parent"], 44 + "index", 45 + "unknown" 46 + ], 47 + "newlines-between": "always", 48 + "alphabetize": { 49 + "order": "asc", 50 + "caseInsensitive": true 51 + } 52 + } 31 53 ] 32 54 } 33 55 }, ··· 39 61 { 40 62 "files": ["**/*.{mdx,tsx}"], 41 63 "rules": { 64 + "@typescript-eslint/consistent-type-definitions": ["error", "type"], 42 65 "react/function-component-definition": [ 43 66 "error", 44 67 { ··· 56 79 "selector": "ImportDeclaration[source.value='react'] :matches(ImportNamespaceSpecifier)", 57 80 "message": "Named * React import is not allowed. Please import what you need from React with Named Imports" 58 81 } 59 - ], 60 - "@typescript-eslint/consistent-type-definitions": ["error", "type"] 82 + ] 61 83 } 62 84 } 63 85 ]
+2 -1
app/en/feed/[feed]/route.ts
··· 1 1 import { NextResponse } from 'next/server'; 2 + 3 + import { generateWebsiteFeeds } from '@/next.data.mjs'; 2 4 import { blogData } from '@/next.json.mjs'; 3 - import { generateWebsiteFeeds } from '@/next.data.mjs'; 4 5 5 6 // loads all the data from the blog-posts-data.json file 6 7 const websiteFeeds = generateWebsiteFeeds(blogData);
+4 -3
app/sitemap.ts
··· 1 - import { allPaths } from '@/next.dynamic.mjs'; 2 - import { defaultLocale } from '@/next.locales.mjs'; 1 + import type { MetadataRoute } from 'next'; 2 + 3 3 import { 4 4 STATIC_ROUTES_IGNORES, 5 5 DYNAMIC_GENERATED_ROUTES, ··· 7 7 BASE_URL, 8 8 EXTERNAL_LINKS_SITEMAP, 9 9 } from '@/next.constants.mjs'; 10 - import type { MetadataRoute } from 'next'; 10 + import { allPaths } from '@/next.dynamic.mjs'; 11 + import { defaultLocale } from '@/next.locales.mjs'; 11 12 12 13 // This is the combination of the Application Base URL and Base PATH 13 14 const baseUrlAndPath = `${BASE_URL}${BASE_PATH}`;
+5 -4
components/Common/ActiveLocalizedLink/index.tsx
··· 1 + import classNames from 'classnames'; 2 + import type Link from 'next/link'; 1 3 import { useRouter } from 'next/router'; 2 - import { useState, useEffect, type FC } from 'react'; 3 - import classNames from 'classnames'; 4 + import { useState, useEffect } from 'react'; 5 + import type { ComponentProps, FC } from 'react'; 6 + 4 7 import LocalizedLink from '@/components/LocalizedLink'; 5 - import type Link from 'next/link'; 6 - import type { ComponentProps } from 'react'; 7 8 8 9 type ActiveLocalizedLinkProps = ComponentProps<typeof Link> & { 9 10 activeClassName: string;
+2 -1
components/Common/Badge/index.stories.tsx
··· 1 + import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + 1 3 import Badge from './'; 2 - import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 3 4 4 5 type Story = StoryObj<typeof Badge>; 5 6 type Meta = MetaObj<typeof Badge>;
+3 -2
components/Common/Badge/index.tsx
··· 1 1 import ArrowRightIcon from '@heroicons/react/24/solid/ArrowRightIcon'; 2 + import type Link from 'next/link'; 3 + import type { ComponentProps, FC, PropsWithChildren } from 'react'; 4 + 2 5 import LocalizedLink from '@/components/LocalizedLink'; 3 - import type { ComponentProps, FC, PropsWithChildren } from 'react'; 4 - import type Link from 'next/link'; 5 6 6 7 import styles from './index.module.css'; 7 8
+1
components/Common/Banner/index.stories.tsx
··· 1 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + 2 3 import Banner from './'; 3 4 4 5 type Story = StoryObj<typeof Banner>;
+2 -1
components/Common/Banner/index.tsx
··· 1 - import LocalizedLink from '@/components/LocalizedLink'; 2 1 import { ArrowUpRightIcon } from '@heroicons/react/24/outline'; 3 2 import type { FC } from 'react'; 3 + 4 + import LocalizedLink from '@/components/LocalizedLink'; 4 5 5 6 import styles from './index.module.css'; 6 7
+2 -1
components/Common/Blockquote/index.stories.tsx
··· 1 + import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + 1 3 import Blockquote from './'; 2 - import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 3 4 4 5 type Story = StoryObj<typeof Blockquote>; 5 6 type Meta = MetaObj<typeof Blockquote>;
+1
components/Common/Button/index.stories.tsx
··· 1 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + 2 3 import Button from './'; 3 4 4 5 type Story = StoryObj<typeof Button>;
+1
components/Common/CrossLink/index.stories.tsx
··· 1 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + 2 3 import CrossLink from './index'; 3 4 4 5 type Story = StoryObj<typeof CrossLink>;
+6 -4
components/Common/CrossLink/index.tsx
··· 1 - import styles from './index.module.css'; 2 1 import classNames from 'classnames'; 3 - import LocalizedLink from '@/components/LocalizedLink'; 4 - import PrevNextArrow from '@/components/Common/PrevNextArrow'; 2 + import type { FC } from 'react'; 5 3 import { FormattedMessage } from 'react-intl'; 6 - import type { FC } from 'react'; 4 + 5 + import PrevNextArrow from '@/components/Common/PrevNextArrow'; 6 + import LocalizedLink from '@/components/LocalizedLink'; 7 + 8 + import styles from './index.module.css'; 7 9 8 10 type CrossLinkProps = { 9 11 type: 'previous' | 'next';
+2 -1
components/Downloads/DownloadList.tsx
··· 1 + import type { FC } from 'react'; 1 2 import { FormattedMessage } from 'react-intl'; 3 + 2 4 import LocalizedLink from '@/components/LocalizedLink'; 3 5 import { useNavigation } from '@/hooks/useNavigation'; 4 6 import type { NodeRelease } from '@/types'; 5 - import type { FC } from 'react'; 6 7 7 8 const DownloadList: FC<NodeRelease> = ({ versionWithPrefix }) => { 8 9 const { getSideNavigation } = useNavigation();
+4 -3
components/Downloads/DownloadReleasesTable.tsx
··· 1 + import type { FC } from 'react'; 1 2 import { FormattedMessage } from 'react-intl'; 3 + 4 + import { useNodeReleases } from '@/hooks/useNodeReleases'; 5 + import { getNodeApiLink } from '@/util/getNodeApiLink'; 2 6 import { getNodejsChangelog } from '@/util/getNodeJsChangelog'; 3 - import { getNodeApiLink } from '@/util/getNodeApiLink'; 4 - import { useNodeReleases } from '@/hooks/useNodeReleases'; 5 - import type { FC } from 'react'; 6 7 7 8 const DownloadReleasesTable: FC = () => { 8 9 const { releases } = useNodeReleases();
+2 -1
components/Downloads/PrimaryDownloadMatrix.tsx
··· 1 1 import classNames from 'classnames'; 2 + import type { FC } from 'react'; 2 3 import semVer from 'semver'; 4 + 3 5 import LocalizedLink from '@/components/LocalizedLink'; 4 6 import { useDetectOS } from '@/hooks/useDetectOS'; 5 7 import { useLayoutContext } from '@/hooks/useLayoutContext'; 6 8 import { DIST_URL } from '@/next.constants.mjs'; 7 9 import type { LegacyDownloadsFrontMatter, NodeRelease } from '@/types'; 8 - import type { FC } from 'react'; 9 10 10 11 // @TODO: Instead of using a static list it should be created dynamically. This is done on `nodejs.dev` 11 12 // since this is a temporary solution and going to be fixed in the future.
+5 -3
components/Downloads/SecondaryDownloadMatrix.tsx
··· 1 - import DownloadList from './DownloadList'; 1 + import type { FC } from 'react'; 2 + 2 3 import { useLayoutContext } from '@/hooks/useLayoutContext'; 3 - import { WithNodeRelease } from '@/providers/withNodeRelease'; 4 4 import { DIST_URL } from '@/next.constants.mjs'; 5 + import { WithNodeRelease } from '@/providers/withNodeRelease'; 5 6 import type { LegacyDownloadsFrontMatter, NodeRelease } from '@/types'; 6 - import type { FC } from 'react'; 7 + 8 + import DownloadList from './DownloadList'; 7 9 8 10 // @TODO: Instead of using a static list it should be created dynamically. This is done on `nodejs.dev` 9 11 // since this is a temporary solution and going to be fixed in the future.
+1 -1
components/Footer.tsx
··· 1 - import { FormattedMessage } from 'react-intl'; 2 1 import type { FC } from 'react'; 2 + import { FormattedMessage } from 'react-intl'; 3 3 4 4 type FooterProps = { className?: string }; 5 5
+6 -4
components/Header.tsx
··· 1 - import { useIntl } from 'react-intl'; 1 + import classNames from 'classnames'; 2 2 import Image from 'next/image'; 3 - import classNames from 'classnames'; 4 - import LocalizedLink from './LocalizedLink'; 5 - import { useNavigation } from '@/hooks/useNavigation'; 3 + import { useIntl } from 'react-intl'; 4 + 6 5 import { useLocale } from '@/hooks/useLocale'; 6 + import { useNavigation } from '@/hooks/useNavigation'; 7 7 import { useRouter } from '@/hooks/useRouter'; 8 + 9 + import LocalizedLink from './LocalizedLink'; 8 10 9 11 const Header = () => { 10 12 const { availableLocales, isCurrentLocaleRoute } = useLocale();
+4 -3
components/Home/HomeDownloadButton.tsx
··· 1 + import type { FC } from 'react'; 2 + 1 3 import LocalizedLink from '@/components/LocalizedLink'; 2 4 import { useDetectOS } from '@/hooks/useDetectOS'; 3 5 import { useLayoutContext } from '@/hooks/useLayoutContext'; 6 + import { DIST_URL } from '@/next.constants.mjs'; 7 + import type { NodeRelease } from '@/types'; 4 8 import { downloadUrlByOS } from '@/util/downloadUrlByOS'; 5 9 import { getNodejsChangelog } from '@/util/getNodeJsChangelog'; 6 - import { DIST_URL } from '@/next.constants.mjs'; 7 - import type { FC } from 'react'; 8 - import type { NodeRelease } from '@/types'; 9 10 10 11 const HomeDownloadButton: FC<NodeRelease> = ({ 11 12 major,
+4 -3
components/HtmlHead.tsx
··· 1 1 import Head from 'next/head'; 2 + import type { FC } from 'react'; 3 + 4 + import { useLocale } from '@/hooks/useLocale'; 5 + import { useRouter } from '@/hooks/useRouter'; 2 6 import { useSiteConfig } from '@/hooks/useSiteConfig'; 3 - import { useRouter } from '@/hooks/useRouter'; 4 - import { useLocale } from '@/hooks/useLocale'; 5 7 import { BASE_URL, BASE_PATH } from '@/next.constants.mjs'; 6 8 import type { LegacyFrontMatter } from '@/types'; 7 - import type { FC } from 'react'; 8 9 9 10 // This is the combination of the Application Base URL and Base PATH 10 11 const baseUrlAndPath = `${BASE_URL}${BASE_PATH}`;
+3 -2
components/LocalizedLink.tsx
··· 1 + import Link from 'next/link'; 1 2 import { useMemo } from 'react'; 2 - import Link from 'next/link'; 3 + import type { FC, ComponentProps, HTMLAttributes } from 'react'; 4 + 3 5 import { useLocale } from '@/hooks/useLocale'; 4 6 import { linkWithLocale } from '@/util/linkWithLocale'; 5 - import type { FC, ComponentProps, HTMLAttributes } from 'react'; 6 7 7 8 // This is a wrapper on HTML's `a` tag 8 9 const HtmlLink: FC<HTMLAttributes<HTMLAnchorElement>> = ({
+2 -1
components/Pagination.tsx
··· 1 + import type { FC } from 'react'; 1 2 import { FormattedMessage } from 'react-intl'; 3 + 2 4 import LocalizedLink from './LocalizedLink'; 3 - import type { FC } from 'react'; 4 5 5 6 type PaginationProps = { prevSlug?: number; nextSlug?: number }; 6 7
+4 -2
components/SideNavigation.tsx
··· 1 1 import classNames from 'classnames'; 2 - import LocalizedLink from './LocalizedLink'; 2 + import type { FC } from 'react'; 3 + 3 4 import { useLocale } from '@/hooks/useLocale'; 4 5 import { useNavigation } from '@/hooks/useNavigation'; 5 6 import type { NavigationKeys } from '@/types'; 6 - import type { FC } from 'react'; 7 + 8 + import LocalizedLink from './LocalizedLink'; 7 9 8 10 type SideNavigationProps = { 9 11 navigationKey: NavigationKeys;
+1 -1
components/__design__/hex-logos.stories.tsx
··· 1 - import Image from 'next/image'; 2 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + import Image from 'next/image'; 3 3 4 4 export const HexLogos: StoryObj = {}; 5 5
+1 -1
components/__design__/horizontal-logos.stories.tsx
··· 1 - import Image from 'next/image'; 2 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + import Image from 'next/image'; 3 3 4 4 export const HorizontalLogos: StoryObj = {}; 5 5
+1 -1
components/__design__/js-logos.stories.tsx
··· 1 - import Image from 'next/image'; 2 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + import Image from 'next/image'; 3 3 4 4 export const JSLogos: StoryObj = {}; 5 5
+1 -1
components/__design__/platform-logos.stories.tsx
··· 1 - import Image from 'next/image'; 2 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + import Image from 'next/image'; 3 3 4 4 export const PlatformLogos: StoryObj = {}; 5 5
+1 -1
components/__design__/social-logos.stories.tsx
··· 1 - import Image from 'next/image'; 2 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + import Image from 'next/image'; 3 3 4 4 export const SocialLogos: StoryObj = {}; 5 5
+1 -1
components/__design__/stacked-logos.stories.tsx
··· 1 - import Image from 'next/image'; 2 1 import type { Meta as MetaObj, StoryObj } from '@storybook/react'; 2 + import Image from 'next/image'; 3 3 4 4 export const StackedLogos: StoryObj = {}; 5 5
+3 -1
hooks/useBlogData.ts
··· 1 1 import { useCallback, useContext, useMemo } from 'react'; 2 - import { useRouter } from './useRouter'; 2 + 3 3 import { BlogDataContext } from '@/providers/blogDataProvider'; 4 + 5 + import { useRouter } from './useRouter'; 4 6 5 7 export const useBlogData = () => { 6 8 const { asPath } = useRouter();
+2 -1
hooks/useDetectOS.ts
··· 1 1 import { useEffect, useState } from 'react'; 2 + 3 + import type { UserOS } from '@/types/userOS'; 2 4 import { detectOS } from '@/util/detectOS'; 3 5 import { getBitness } from '@/util/getBitness'; 4 - import type { UserOS } from '@/types/userOS'; 5 6 6 7 type UserOSState = { 7 8 os: UserOS;
+1
hooks/useLayoutContext.ts
··· 1 1 import { useContext } from 'react'; 2 + 2 3 import { LayoutContext } from '@/providers/layoutProvider'; 3 4 4 5 export const useLayoutContext = () => useContext(LayoutContext);
+3 -1
hooks/useLocale.ts
··· 1 1 import { useContext } from 'react'; 2 - import { useRouter } from './useRouter'; 2 + 3 3 import { LocaleContext } from '@/providers/localeProvider'; 4 4 import { linkWithLocale } from '@/util/linkWithLocale'; 5 + 6 + import { useRouter } from './useRouter'; 5 7 6 8 export const useLocale = () => { 7 9 const { asPath } = useRouter();
+1
hooks/useNavigation.tsx
··· 1 1 import { FormattedMessage } from 'react-intl'; 2 + 2 3 import { siteNavigation } from '@/next.json.mjs'; 3 4 import type { NavigationEntry, NavigationKeys } from '@/types'; 4 5
+1
hooks/useNodeReleases.ts
··· 1 1 import { useCallback, useContext } from 'react'; 2 + 2 3 import { NodeReleasesContext } from '@/providers/nodeReleasesProvider'; 3 4 import type { NodeReleaseStatus } from '@/types'; 4 5
+3 -2
hooks/useRouter.ts
··· 1 - import { useMemo } from 'react'; 2 1 import { useRouter as useNextRouter } from 'next/router'; 2 + import type { NextRouter } from 'next/router'; 3 + import { useMemo } from 'react'; 4 + 3 5 import { 4 6 availableLocales, 5 7 getCurrentLocale, 6 8 defaultLocale, 7 9 } from '@/next.locales.mjs'; 8 - import type { NextRouter } from 'next/router'; 9 10 10 11 // Maps all available locales by only their Language Code 11 12 const mappedLocalesByCode = availableLocales.map(l => l.code);
+1
hooks/useSiteConfig.ts
··· 1 1 import { useContext } from 'react'; 2 + 2 3 import { SiteContext } from '@/providers/siteProvider'; 3 4 4 5 export const useSiteConfig = () => {
+4 -2
layouts/AboutLayout.tsx
··· 1 - import BaseLayout from './BaseLayout'; 2 - import SideNavigation from '@/components/SideNavigation'; 3 1 import type { FC, PropsWithChildren } from 'react'; 2 + 3 + import SideNavigation from '@/components/SideNavigation'; 4 + 5 + import BaseLayout from './BaseLayout'; 4 6 5 7 const AboutLayout: FC<PropsWithChildren> = ({ children }) => ( 6 8 <BaseLayout>
+2 -1
layouts/BaseLayout.tsx
··· 1 + import type { FC, PropsWithChildren } from 'react'; 2 + 1 3 import Footer from '@/components/Footer'; 2 4 import Header from '@/components/Header'; 3 - import type { FC, PropsWithChildren } from 'react'; 4 5 5 6 const BaseLayout: FC<PropsWithChildren> = ({ children }) => ( 6 7 <>
+5 -3
layouts/BlogIndexLayout.tsx
··· 1 1 import { useMemo } from 'react'; 2 + import type { FC, PropsWithChildren } from 'react'; 2 3 import { FormattedMessage } from 'react-intl'; 3 - import BaseLayout from './BaseLayout'; 4 + 4 5 import { Time } from '@/components/Common/Time'; 5 - import Pagination from '@/components/Pagination'; 6 6 import LocalizedLink from '@/components/LocalizedLink'; 7 + import Pagination from '@/components/Pagination'; 7 8 import { useBlogData } from '@/hooks/useBlogData'; 8 - import type { FC, PropsWithChildren } from 'react'; 9 9 import type { BlogPost } from '@/types'; 10 + 11 + import BaseLayout from './BaseLayout'; 10 12 11 13 const BlogIndexLayout: FC<PropsWithChildren> = ({ children }) => { 12 14 const { getPagination, getPostsByYear, currentCategory } = useBlogData();
+4 -2
layouts/BlogPostLayout.tsx
··· 1 + import type { FC, PropsWithChildren } from 'react'; 1 2 import { FormattedMessage } from 'react-intl'; 2 - import BaseLayout from './BaseLayout'; 3 + 3 4 import { Time } from '@/components/Common/Time'; 4 5 import { useLayoutContext } from '@/hooks/useLayoutContext'; 5 - import type { FC, PropsWithChildren } from 'react'; 6 6 import type { LegacyBlogFrontMatter } from '@/types'; 7 + 8 + import BaseLayout from './BaseLayout'; 7 9 8 10 const BlogPostLayout: FC<PropsWithChildren> = ({ children }) => { 9 11 const { frontMatter } = useLayoutContext();
+5 -3
layouts/CategoryIndexLayout.tsx
··· 1 1 import { useMemo } from 'react'; 2 - import BaseLayout from './BaseLayout'; 2 + import type { FC, PropsWithChildren } from 'react'; 3 + 3 4 import { Time } from '@/components/Common/Time'; 4 5 import LocalizedLink from '@/components/LocalizedLink'; 5 - import { useLayoutContext } from '@/hooks/useLayoutContext'; 6 6 import { useBlogData } from '@/hooks/useBlogData'; 7 - import type { FC, PropsWithChildren } from 'react'; 7 + import { useLayoutContext } from '@/hooks/useLayoutContext'; 8 8 import type { BlogPost } from '@/types'; 9 + 10 + import BaseLayout from './BaseLayout'; 9 11 10 12 const CategoryIndexLayout: FC<PropsWithChildren> = ({ children }) => { 11 13 const { frontMatter } = useLayoutContext();
+4 -2
layouts/ContributeLayout.tsx
··· 1 - import BaseLayout from './BaseLayout'; 2 - import SideNavigation from '@/components/SideNavigation'; 3 1 import type { FC, PropsWithChildren } from 'react'; 2 + 3 + import SideNavigation from '@/components/SideNavigation'; 4 + 5 + import BaseLayout from './BaseLayout'; 4 6 5 7 const ContributeLayout: FC<PropsWithChildren> = ({ children }) => ( 6 8 <BaseLayout>
+2 -1
layouts/DefaultLayout.tsx
··· 1 + import type { FC, PropsWithChildren } from 'react'; 2 + 1 3 import BaseLayout from './BaseLayout'; 2 - import type { FC, PropsWithChildren } from 'react'; 3 4 4 5 const DefaultLayout: FC<PropsWithChildren> = ({ children }) => ( 5 6 <BaseLayout>
+4 -2
layouts/DocsLayout.tsx
··· 1 1 import { useMemo } from 'react'; 2 - import BaseLayout from './BaseLayout'; 2 + import type { FC, PropsWithChildren } from 'react'; 3 + 3 4 import SideNavigation from '@/components/SideNavigation'; 4 5 import { useNodeReleases } from '@/hooks/useNodeReleases'; 5 - import type { FC, PropsWithChildren } from 'react'; 6 + 7 + import BaseLayout from './BaseLayout'; 6 8 7 9 const DocsLayout: FC<PropsWithChildren> = ({ children }) => { 8 10 const { getReleaseByStatus } = useNodeReleases();
+4 -2
layouts/DownloadCurrentLayout.tsx
··· 1 - import BaseLayout from './BaseLayout'; 1 + import type { FC, PropsWithChildren } from 'react'; 2 + 2 3 import PrimaryDownloadMatrix from '@/components/Downloads/PrimaryDownloadMatrix'; 3 4 import SecondaryDownloadMatrix from '@/components/Downloads/SecondaryDownloadMatrix'; 4 5 import { useLayoutContext } from '@/hooks/useLayoutContext'; 5 6 import { WithNodeRelease } from '@/providers/withNodeRelease'; 6 - import type { FC, PropsWithChildren } from 'react'; 7 7 import type { LegacyDownloadsFrontMatter } from '@/types'; 8 + 9 + import BaseLayout from './BaseLayout'; 8 10 9 11 const DownloadCurrentLayout: FC<PropsWithChildren> = ({ children }) => { 10 12 const { frontMatter } = useLayoutContext();
+4 -2
layouts/DownloadLayout.tsx
··· 1 - import BaseLayout from './BaseLayout'; 1 + import type { FC, PropsWithChildren } from 'react'; 2 + 2 3 import PrimaryDownloadMatrix from '@/components/Downloads/PrimaryDownloadMatrix'; 3 4 import SecondaryDownloadMatrix from '@/components/Downloads/SecondaryDownloadMatrix'; 4 5 import { useLayoutContext } from '@/hooks/useLayoutContext'; 5 6 import { WithNodeRelease } from '@/providers/withNodeRelease'; 6 - import type { FC, PropsWithChildren } from 'react'; 7 7 import type { LegacyDownloadsFrontMatter } from '@/types'; 8 + 9 + import BaseLayout from './BaseLayout'; 8 10 9 11 const DownloadLayout: FC<PropsWithChildren> = ({ children }) => { 10 12 const { frontMatter } = useLayoutContext();
+5 -3
layouts/DownloadReleasesLayout.tsx
··· 1 1 import { useMemo } from 'react'; 2 - import BaseLayout from './BaseLayout'; 3 - import { useLayoutContext } from '@/hooks/useLayoutContext'; 4 - import DownloadReleasesTable from '@/components/Downloads/DownloadReleasesTable'; 5 2 import type { FC, PropsWithChildren } from 'react'; 3 + 4 + import DownloadReleasesTable from '@/components/Downloads/DownloadReleasesTable'; 5 + import { useLayoutContext } from '@/hooks/useLayoutContext'; 6 6 import type { LegacyDownloadsReleasesFrontMatter } from '@/types'; 7 + 8 + import BaseLayout from './BaseLayout'; 7 9 8 10 const DownloadReleasesLayout: FC<PropsWithChildren> = ({ children }) => { 9 11 const { frontMatter } = useLayoutContext();
+4 -2
layouts/IndexLayout.tsx
··· 1 - import BaseLayout from './BaseLayout'; 1 + import type { FC, PropsWithChildren } from 'react'; 2 + 2 3 import Banner from '@/components/Home/Banner'; 3 4 import HomeDownloadButton from '@/components/Home/HomeDownloadButton'; 4 5 import { useDetectOS } from '@/hooks/useDetectOS'; 5 6 import { useLayoutContext } from '@/hooks/useLayoutContext'; 6 7 import { WithNodeRelease } from '@/providers/withNodeRelease'; 7 - import type { FC, PropsWithChildren } from 'react'; 8 8 import type { UserOS } from '@/types/userOS'; 9 + 10 + import BaseLayout from './BaseLayout'; 9 11 10 12 const getDownloadHeadTextOS = (os: UserOS, bitness: number) => { 11 13 switch (os) {
+2 -1
middleware.ts
··· 1 1 import { NextResponse } from 'next/server'; 2 + import type { NextRequest } from 'next/server'; 3 + 2 4 import { availableLocales } from './next.locales.mjs'; 3 - import type { NextRequest } from 'next/server'; 4 5 5 6 // This Middleware is responsible for handling automatic language detection from a user's Browser 6 7 // This middleware should only run on "/" requests coming to the Website
+2 -1
pages/404.tsx
··· 1 + import type { GetStaticProps } from 'next'; 1 2 import { FormattedMessage } from 'react-intl'; 3 + 2 4 import Theme from '@/theme'; 3 - import type { GetStaticProps } from 'next'; 4 5 5 6 const NotFound = () => ( 6 7 <Theme>
+9 -7
pages/[...path].tsx
··· 1 1 import { sep } from 'node:path'; 2 - import Theme from '@/theme'; 3 - import { 4 - getMarkdownFile, 5 - generateStaticProps, 6 - allPaths, 7 - } from '@/next.dynamic.mjs'; 2 + 3 + import type { GetStaticPaths, GetStaticProps } from 'next'; 4 + 8 5 import { 9 6 ENABLE_STATIC_EXPORT, 10 7 STATIC_ROUTES_IGNORES, ··· 12 9 DYNAMIC_ROUTES_REWRITES, 13 10 DYNAMIC_GENERATED_ROUTES, 14 11 } from '@/next.constants.mjs'; 15 - import type { GetStaticPaths, GetStaticProps } from 'next'; 12 + import { 13 + getMarkdownFile, 14 + generateStaticProps, 15 + allPaths, 16 + } from '@/next.dynamic.mjs'; 17 + import Theme from '@/theme'; 16 18 import type { DynamicStaticProps } from '@/types'; 17 19 18 20 type DynamicStaticPaths = { path: string[] };
+6 -5
pages/_app.tsx
··· 1 + import { Analytics } from '@vercel/analytics/react'; 2 + import type { AppProps } from 'next/app'; 1 3 import { Source_Sans_3 } from 'next/font/google'; 2 - import { Analytics } from '@vercel/analytics/react'; 3 - import { SiteProvider } from '@/providers/siteProvider'; 4 + 5 + import { VERCEL_ENV } from '@/next.constants.mjs'; 6 + import { BlogDataProvider } from '@/providers/blogDataProvider'; 4 7 import { LocaleProvider } from '@/providers/localeProvider'; 5 - import { BlogDataProvider } from '@/providers/blogDataProvider'; 6 8 import { NodeReleasesProvider } from '@/providers/nodeReleasesProvider'; 7 - import { VERCEL_ENV } from '@/next.constants.mjs'; 8 - import type { AppProps } from 'next/app'; 9 + import { SiteProvider } from '@/providers/siteProvider'; 9 10 10 11 import '@/styles/old/index.css'; 11 12
+2 -1
pages/_document.tsx
··· 1 + import { Html, Head, Main, NextScript } from 'next/document'; 1 2 import Script from 'next/script'; 2 - import { Html, Head, Main, NextScript } from 'next/document'; 3 + 3 4 import { LEGACY_JAVASCRIPT_FILE } from '@/next.constants.mjs'; 4 5 5 6 const Document = () => (
+2 -1
providers/blogDataProvider.tsx
··· 1 1 import { createContext } from 'react'; 2 + import type { FC, PropsWithChildren } from 'react'; 3 + 2 4 import blogData from '@/public/blog-posts-data.json'; 3 - import type { FC, PropsWithChildren } from 'react'; 4 5 import type { BlogData } from '@/types'; 5 6 6 7 export const BlogDataContext = createContext<BlogData>({
+3 -2
providers/layoutProvider.tsx
··· 1 1 import { createContext, useMemo } from 'react'; 2 + import type { FC, PropsWithChildren } from 'react'; 3 + 2 4 import AboutLayout from '@/layouts/AboutLayout'; 3 5 import BlogIndexLayout from '@/layouts/BlogIndexLayout'; 4 6 import BlogPostLayout from '@/layouts/BlogPostLayout'; ··· 6 8 import ContributeLayout from '@/layouts/ContributeLayout'; 7 9 import DefaultLayout from '@/layouts/DefaultLayout'; 8 10 import DocsLayout from '@/layouts/DocsLayout'; 9 - import DownloadLayout from '@/layouts/DownloadLayout'; 10 11 import DownloadCurrentLayout from '@/layouts/DownloadCurrentLayout'; 12 + import DownloadLayout from '@/layouts/DownloadLayout'; 11 13 import DownloadReleasesLayout from '@/layouts/DownloadReleasesLayout'; 12 14 import IndexLayout from '@/layouts/IndexLayout'; 13 - import type { FC, PropsWithChildren } from 'react'; 14 15 import type { LegacyFrontMatter, LegacyLayouts } from '@/types'; 15 16 16 17 type LayoutContextProps = {
+2 -1
providers/localeProvider.tsx
··· 1 1 import { createContext, useMemo } from 'react'; 2 + import type { FC, PropsWithChildren } from 'react'; 2 3 import { IntlProvider } from 'react-intl'; 4 + 3 5 import { useRouter } from '@/hooks/useRouter'; 4 6 import { 5 7 defaultLocale, ··· 7 9 getCurrentLocale, 8 10 getCurrentTranslations, 9 11 } from '@/next.locales.mjs'; 10 - import type { FC, PropsWithChildren } from 'react'; 11 12 import type { LocaleContext as LocaleContextType } from '@/types'; 12 13 13 14 // Initialises the Context with the default Localisation Data
+4 -3
providers/mdxProvider.tsx
··· 1 - import { useEffect } from 'react'; 2 1 import { MDXProvider as BaseMDXProvider } from '@mdx-js/react'; 2 + import type { MDXComponents } from 'mdx/types'; 3 3 import { MDXRemote } from 'next-mdx-remote'; 4 + import { useEffect } from 'react'; 5 + import type { FC } from 'react'; 6 + 4 7 import NodeApiVersionLinks from '@/components/Docs/NodeApiVersionLinks'; 5 - import type { FC } from 'react'; 6 - import type { MDXComponents } from 'mdx/types'; 7 8 8 9 const mdxComponents: MDXComponents = { 9 10 NodeApiVersionLinks: NodeApiVersionLinks,
+3 -2
providers/nodeReleasesProvider.tsx
··· 1 1 import { createContext, useMemo } from 'react'; 2 + import type { FC, PropsWithChildren } from 'react'; 3 + 2 4 import nodeReleasesData from '@/public/node-releases-data.json'; 5 + import type { NodeReleaseSource, NodeRelease } from '@/types'; 3 6 import { getNodeReleaseStatus } from '@/util/nodeRelease'; 4 - import type { FC, PropsWithChildren } from 'react'; 5 - import type { NodeReleaseSource, NodeRelease } from '@/types'; 6 7 7 8 export const NodeReleasesContext = createContext<NodeRelease[]>([]); 8 9
+2 -1
providers/siteProvider.tsx
··· 1 1 import { createContext } from 'react'; 2 + import type { FC, PropsWithChildren } from 'react'; 3 + 2 4 import { siteConfig } from '@/next.json.mjs'; 3 - import type { FC, PropsWithChildren } from 'react'; 4 5 import type { SiteConfig } from '@/types'; 5 6 6 7 export const SiteContext = createContext<SiteConfig>(siteConfig);
+3 -2
providers/withNodeRelease.tsx
··· 1 1 import { useMemo } from 'react'; 2 + import type { FC } from 'react'; 3 + 2 4 import { useNodeReleases } from '@/hooks/useNodeReleases'; 5 + import type { NodeRelease, NodeReleaseStatus } from '@/types'; 3 6 import { isNodeRelease } from '@/util/nodeRelease'; 4 - import type { FC } from 'react'; 5 - import type { NodeRelease, NodeReleaseStatus } from '@/types'; 6 7 7 8 type WithNodeReleaseProps = { 8 9 status: NodeReleaseStatus;
+3 -2
theme.tsx
··· 1 1 import { memo } from 'react'; 2 + import type { FC, PropsWithChildren } from 'react'; 3 + 4 + import HtmlHead from './components/HtmlHead'; 2 5 import { LayoutProvider } from './providers/layoutProvider'; 3 6 import { MDXProvider } from './providers/mdxProvider'; 4 - import HtmlHead from './components/HtmlHead'; 5 - import type { FC, PropsWithChildren } from 'react'; 6 7 import type { DynamicStaticProps } from './types'; 7 8 8 9 type ThemeProps = PropsWithChildren<DynamicStaticProps>;
+1
types/dynamic.ts
··· 1 1 import type { Heading } from '@vcarl/remark-headings'; 2 + 2 3 import type { LegacyFrontMatter } from './frontmatter'; 3 4 4 5 export interface DynamicStaticProps {
+1
util/getNodeApiLink.ts
··· 1 1 import semVer from 'semver'; 2 + 2 3 import { DOCS_URL, DIST_URL } from '@/next.constants.mjs'; 3 4 4 5 export const getNodeApiLink = (version: string) => {