Skip to content
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

Dependencies upgradation - inprogress #48

Open
wants to merge 2 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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
/.swc/
/analyze/

# yarn
/.yarn/*

# production
/build
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default [
"*.setup.js",
"*.config.js",
"lighthouserc.js",
"coverage/",
],
},
];
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
"@emotion/jest": "^11.13.0",
"@emotion/server": "^11.11.0",
"@eslint/eslintrc": "^3.1.0",
"eslint-config-prettier": "^9.1.0",
"@eslint/js": "^9.9.1",
"@lingui/cli": "^4.11.3",
"@lingui/loader": "^4.11.3",
"@lingui/swc-plugin": "^4.0.8",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.0",
"@types/isomorphic-fetch": "^0.0.39",
Expand All @@ -80,6 +80,7 @@
"babel-plugin-typescript-to-proptypes": "^2.0.0",
"eslint": "^9.9.1",
"eslint-config-next": "^14.2.7",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-security": "^3.0.1",
Expand Down
6 changes: 6 additions & 0 deletions src/common/ErrorBoundary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@

import { Trans } from "@lingui/macro";
import React, { ReactElement } from "react";
import PropTypes from "prop-types";


Check failure on line 11 in src/common/ErrorBoundary/index.tsx

View workflow job for this annotation

GitHub Actions / Build & Lint (20.x)

Delete `⏎`
class ErrorBoundary extends React.Component<
{ children: ReactElement },
{ hasError: boolean; error: Error | null }
> {
static propTypes = {

Check failure on line 16 in src/common/ErrorBoundary/index.tsx

View workflow job for this annotation

GitHub Actions / Build & Lint (20.x)

Make this public static property readonly
children: PropTypes.element.isRequired,
};

Comment on lines +16 to +19
Copy link

Choose a reason for hiding this comment

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

Enhance type safety by making the propTypes property readonly.

The addition of the propTypes static property is a good practice to enhance the type safety and documentation of the component. It correctly defines the expected type for the children prop as a required element of type PropTypes.element.

To further align with best practices and prevent accidental mutation, consider making the propTypes property readonly.

Apply this diff to make the property readonly:

-static propTypes = {
+static readonly propTypes = {
   children: PropTypes.element.isRequired,
 };
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
static propTypes = {
children: PropTypes.element.isRequired,
};
static readonly propTypes = {
children: PropTypes.element.isRequired,
};
Tools
GitHub Check: Build & Lint (20.x)

[failure] 16-16:
Make this public static property readonly

constructor(props) {
super(props);
this.state = { hasError: false, error: null };
Expand Down
1 change: 1 addition & 0 deletions src/common/If/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import { ReactNode } from "react";

interface IfProps {
Expand All @@ -7,7 +8,7 @@
}

const If: React.FC<IfProps> = props => {
return <>{props.condition ? props.children : props.otherwise}</>;

Check failure on line 11 in src/common/If/index.tsx

View workflow job for this annotation

GitHub Actions / Build & Lint (20.x)

A fragment with only one child is redundant
};

export default If;
6 changes: 6 additions & 0 deletions src/common/Meta/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import Head from "next/head";
import React, { memo } from "react";
import PropTypes from "prop-types";

const Meta = ({ title, description }) => {
return (
Expand All @@ -17,4 +18,9 @@ const Meta = ({ title, description }) => {
);
};

Meta.propTypes = {
title: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
};

export default memo(Meta);
2 changes: 1 addition & 1 deletion src/common/T/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* T
*
*/

import React from "react";
import { Typography, TypographyProps } from "@mui/material";

export type TProps = TypographyProps & {
Expand Down
2 changes: 1 addition & 1 deletion src/common/T/tests/__snapshots__/index.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports[`<T /> should render and match the snapshot 1`] = `
<body>
<div>
<p
class="MuiTypography-root MuiTypography-body1 emotion-0"
class="MuiTypography-root MuiTypography-body1 emotion-0"
data-testid="t"
>
Hello World
Expand Down
7 changes: 4 additions & 3 deletions src/features/info/components/ErrorState/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import React from "react";
import { AlignCenter } from "@common/styled";
import { Trans } from "@lingui/macro";
import { styled } from "@mui/material/styles";

const Error = styled("div")(({ theme }) => ({
const ErrorComponent = styled("div")(({ theme }) => ({
color: theme.palette.error.main,
}));

const ErrorState = () => {
return (
<AlignCenter>
<Error>
<ErrorComponent>
<Trans>Something Went Wrong</Trans>
</Error>
</ErrorComponent>
</AlignCenter>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ exports[`<ErrorState /> should render and match the snapshot 1`] = `
<body>
<div>
<div
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded MuiCard-root emotion-0"
color="#f44336"
data-testid="error-state"
>
<h6
class="MuiTypography-root MuiTypography-subtitle2 emotion-1"
class="MuiTypography-root MuiTypography-subtitle2 emotion-1"
data-testid="t"
>
Repository List
</h6>
<p
class="MuiTypography-root MuiTypography-body1 emotion-2"
class="MuiTypography-root MuiTypography-body1 emotion-2"
data-testid="t"
>
Internal Service Error
Expand Down
1 change: 1 addition & 0 deletions src/features/repos/components/RepoItem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import { CustomCard, T } from "@app/common";
import { Trans } from "@lingui/macro";
import { useRouter } from "next/router";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ exports[`<RepoList /> should render and match the snapshot 1`] = `
.emotion-1 {
display: block;
background-color: rgba(0, 0, 0, 0.11);
height: auto;
height: 1.2em;
margin-top: 0;
margin-bottom: 0;
height: auto;
transform-origin: 0 55%;
-webkit-transform: scale(1, 0.60);
-moz-transform: scale(1, 0.60);
Expand Down Expand Up @@ -82,46 +83,46 @@ exports[`<RepoList /> should render and match the snapshot 1`] = `
<body>
<div>
<div
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded MuiCard-root emotion-0"
data-testid="repo-list"
>
<span
class="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse emotion-1"
class="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse emotion-1"
/>
<div>
<p
class="MuiTypography-root MuiTypography-body1 emotion-2"
class="MuiTypography-root MuiTypography-body1 emotion-2"
data-testid="t"
>
Search query: Nextjs Bulletproof Template
</p>
<p
class="MuiTypography-root MuiTypography-body1 emotion-3"
class="MuiTypography-root MuiTypography-body1 emotion-3"
data-testid="t"
>
Total number of matching repos: 1
</p>
<hr
class="MuiDivider-root MuiDivider-fullWidth emotion-4"
class="MuiDivider-root MuiDivider-fullWidth emotion-4"
/>
<div
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded MuiCard-root emotion-0"
class="MuiPaper-root MuiPaper-outlined MuiPaper-rounded MuiCard-root emotion-0"
>
Nextjs Bulletproof
<p
class="MuiTypography-root MuiTypography-body1 emotion-2"
class="MuiTypography-root MuiTypography-body1 emotion-2"
data-testid="t"
>
Repository Name: Nextjs Bulletproof
</p>
<p
class="MuiTypography-root MuiTypography-body1 emotion-2"
class="MuiTypography-root MuiTypography-body1 emotion-2"
data-testid="t"
>
Repository full name: Nextjs Bulletproof Template
</p>
<p
class="MuiTypography-root MuiTypography-body1 emotion-2"
class="MuiTypography-root MuiTypography-body1 emotion-2"
data-testid="t"
>
Repository stars: 100
Expand Down
1 change: 1 addition & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import "../styles/globals.css";
import type { AppProps } from "next/app";
import { ErrorBoundary } from "@common";
Expand Down
1 change: 1 addition & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import {
DocumentHeadTags,
DocumentHeadTagsProps,
Expand Down
1 change: 1 addition & 0 deletions src/pages/_offline.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import { Container, T } from "@common";
import { Trans } from "@lingui/macro";

Expand Down
1 change: 1 addition & 0 deletions src/pages/info/[slug].tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from "react";
import { loadCatalog } from "@app/utils/linguiUtils";
import { Info } from "@features/info";
import { repoInfoApi } from "@features/info/api/getRepoInfo";
Expand Down
14 changes: 7 additions & 7 deletions src/translations/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ msgstr "No records found"
msgid "Recommendation"
msgstr "Recommendation"

#: src/features/repos/components/RepoItem/index.tsx:24
#: src/features/repos/components/RepoItem/index.tsx:25
msgid "Repository full name: {0}"
msgstr "Repository full name: {0}"

#: src/features/repos/components/ErrorState/index.tsx:30
#: src/features/repos/components/ErrorState/index.tsx:33
msgid "Repository List"
msgstr "Repository List"

#: src/features/repos/components/RepoItem/index.tsx:21
#: src/features/repos/components/RepoItem/index.tsx:22
msgid "Repository Name: {0}"
msgstr "Repository Name: {0}"

#: src/containers/Repos/index.tsx:91
msgid "Repository Search"
msgstr "Repository Search"

#: src/features/repos/components/RepoItem/index.tsx:27
#: src/features/repos/components/RepoItem/index.tsx:28
msgid "Repository stars: {0}"
msgstr "Repository stars: {0}"

Expand All @@ -65,8 +65,8 @@ msgstr "Search Default"
msgid "Search query: {repoName}"
msgstr "Search query: {repoName}"

#: src/common/ErrorBoundary/index.tsx:33
#: src/features/info/components/ErrorState/index.tsx:13
#: src/common/ErrorBoundary/index.tsx:32
#: src/features/info/components/ErrorState/index.tsx:14
msgid "Something Went Wrong"
msgstr "Something Went Wrong"

Expand All @@ -82,6 +82,6 @@ msgstr "Total number of matching repos: {totalCount}"
msgid "Watchers: {watchers}"
msgstr "Watchers: {watchers}"

#: src/pages/_offline.tsx:7
#: src/pages/_offline.tsx:8
msgid "You are Offline!"
msgstr "You are Offline!"
14 changes: 7 additions & 7 deletions src/translations/hi.po
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ msgstr "कोई रिकॉर्ड नहीं मिला"
msgid "Recommendation"
msgstr "सिफारिश"

#: src/features/repos/components/RepoItem/index.tsx:24
#: src/features/repos/components/RepoItem/index.tsx:25
msgid "Repository full name: {0}"
msgstr "रिपॉज़िटरी पूरा नाम: {0}"

#: src/features/repos/components/ErrorState/index.tsx:30
#: src/features/repos/components/ErrorState/index.tsx:33
msgid "Repository List"
msgstr "रिपॉज़िटरी सूची"

#: src/features/repos/components/RepoItem/index.tsx:21
#: src/features/repos/components/RepoItem/index.tsx:22
msgid "Repository Name: {0}"
msgstr "रिपॉज़िटरी का नाम: {0}"

#: src/containers/Repos/index.tsx:91
msgid "Repository Search"
msgstr "रिपॉज़िटरी खोज"

#: src/features/repos/components/RepoItem/index.tsx:27
#: src/features/repos/components/RepoItem/index.tsx:28
msgid "Repository stars: {0}"
msgstr "रिपॉज़िटरी तारे: {0}"

Expand All @@ -65,8 +65,8 @@ msgstr "डिफ़ॉल्ट खोज"
msgid "Search query: {repoName}"
msgstr "खोज क्वेरी: {repoName}"

#: src/common/ErrorBoundary/index.tsx:33
#: src/features/info/components/ErrorState/index.tsx:13
#: src/common/ErrorBoundary/index.tsx:32
#: src/features/info/components/ErrorState/index.tsx:14
msgid "Something Went Wrong"
msgstr "कुछ गलत हो गया"

Expand All @@ -82,6 +82,6 @@ msgstr "मिलती रिपॉज़िटरी की कुल सं
msgid "Watchers: {watchers}"
msgstr "नजरदार: {watchers}"

#: src/pages/_offline.tsx:7
#: src/pages/_offline.tsx:8
msgid "You are Offline!"
msgstr "आप ऑफ़लाइन हैं!"
Loading
Loading