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

Fixed Lint issues and updated Eslint rules #2163

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
85 changes: 66 additions & 19 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
const MAX_PARAMS = 4;
const JSX_INDENT_SIZE = 2;

module.exports = {
env: {
node: true,
browser: true,
es2020: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react/recommended', 'plugin:storybook/recommended'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:storybook/recommended',
'plugin:import/recommended' // Add this line to include recommended rules from eslint-plugin-import
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
@@ -13,55 +23,92 @@ module.exports = {
ecmaVersion: 11,
sourceType: 'module',
},
plugins: ['react', '@typescript-eslint', '@emotion', 'cypress'],
plugins: ['react', '@typescript-eslint', '@emotion', 'cypress', 'import'], // Add 'import' here
rules: {
// General JavaScript/TypeScript
'no-console': 'warn',
'no-debugger': 'error',
'prefer-const': 'warn',
'no-var': 'error',
'consistent-return': 'warn',
'eqeqeq': ['error', 'always'],
'@typescript-eslint/explicit-module-boundary-types': 'warn',
'@typescript-eslint/explicit-function-return-type': 'warn',

// React Best Practices
'react/jsx-key': 'error',
'react/no-array-index-key': 'warn',
'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'never' }],

// Code Quality
'complexity': ['warn', { max: 10 }],
'max-lines': ['warn', { max: 300, skipBlankLines: true, skipComments: true }],
'max-params': ['warn', MAX_PARAMS],
'no-magic-numbers': ['warn', { ignore: [0, 1] }],

// Security
'no-eval': 'error',
'no-new-func': 'error',

// Existing Rules
'no-undef': 'warn',
'no-unsafe-optional-chaining': 'warn',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'warn',
'no-empty-pattern': 'warn',
// base rule disabled as it can report incorrect errors
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn', // or "error"
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],

'react/react-in-jsx-scope': 'off',
'react/jsx-props-no-spreading': 'off',
'react/jsx-props-no-spreading': 'warn',
'react/jsx-filename-extension': [
1,
{ extensions: ['.js', '.jsx', '.tsx'] },
'warn',
{ extensions: ['.js', '.jsx', '.tsx'] }
],
'react/no-unknown-property': [
2,
'error',
{
ignore: ['jsx', 'global'],
},
}
],
'react/jsx-indent': [
'warn',
JSX_INDENT_SIZE
],
'import/extensions': [
'warn',
'always',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
}
],
'react/jsx-indent': 'off',
'import/extensions': 'off',
'import/no-unresolved': 'off',
'import/no-unresolved': 'warn', // should be error
'import/named': 'warn', // should be error
'react/jsx-no-literals': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-types': 'warn',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/no-empty-function': 'warn',
'react/display-name': 'off',
'react/no-find-dom-node': 'off',
'@emotion/jsx-import': 'error',
'@emotion/no-vanilla': 'error',
'@emotion/import-from-emotion': 'error',
'@emotion/styled-import': 'error',
'@typescript-eslint/no-var-requires': 0,
'react/prop-types': 'off',
'@typescript-eslint/no-var-requires': 'warn',
'react/prop-types': 'warn',
'cypress/no-assigning-return-values': 'error',
'cypress/no-unnecessary-waiting': 'error',
'cypress/assertion-before-screenshot': 'warn',
'cypress/no-force': 'warn',
'cypress/no-force': 'error',
'cypress/no-async-tests': 'error',
'cypress/no-pause': 'error',
},
112 changes: 112 additions & 0 deletions ESLintREADME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# ESLint Rules Overview
This document provides an overview of the ESLint rules configured for our project, including what each rule does, why it's important, and how to address issues or ignore the rule if necessary.

## General JavaScript/TypeScript Rules
### no-console
- What It Does: Warns when console.log statements are used in the code.
- Why It's Needed: Console statements can leave debug logs in production code, which can be a security risk or clutter the output.
- How to Fix: Remove console.log statements or replace them with a proper logging mechanism.
- Ignore If: You might need to ignore this rule during development if you frequently use console.log for debugging.

### no-debugger
- What It Does: Disallows the use of debugger statements.
- Why It's Needed: debugger statements can stop the execution of code, which might cause issues in production.
- How to Fix: Remove debugger statements before committing code.
- Ignore If: Only if debugging in development, but ensure to remove before deployment.

### prefer-const
- What It Does: Encourages the use of const for variables that are never reassigned.
- Why It's Needed: Using const improves readability and ensures variables that should not be reassigned are not mistakenly changed.
- How to Fix: Replace let with const for variables that do not get reassigned.
- Ignore If: You have a variable that must be reassigned or if your code does not follow this practice due to specific reasons.

### no-var
- What It Does: Enforces the use of let and const instead of var.
- Why It's Needed: var has function-scoped behavior which can lead to unexpected issues. let and const are block-scoped and provide better predictability.
- How to Fix: Replace var with let or const.
- Ignore If: Rare cases where var is needed due to legacy code or specific JavaScript patterns.

### consistent-return
- What It Does: Ensures that all code paths in a function either return a value or do not return a value.
- Why It's Needed: This rule helps avoid bugs by ensuring functions have a predictable return behavior.
- How to Fix: Ensure that all return paths in a function return a value if required, or explicitly return undefined if no value is intended.
- Ignore If: Only if there's a deliberate design choice to not consistently return values, but it's better to address the inconsistency.

### eqeqeq
- What It Does: Enforces the use of === and !== instead of == and !=.
- Why It's Needed: == and != perform type coercion which can lead to unexpected results. Using === and !== ensures strict comparison.
- How to Fix: Replace == and != with === and !==.
- Ignore If: In specific cases where type coercion is intentionally desired.

### @typescript-eslint/explicit-module-boundary-types
- What It Does: Enforces explicit return types on functions and class methods.
- Why It's Needed: Ensures that the types of function outputs are clear, which improves code readability and type safety.
- How to Fix: Explicitly define return types for all functions and methods.
- Ignore If: Only if you are certain that the return type is clear without explicit annotation, but it's generally better to define it.


### @typescript-eslint/explicit-function-return-type
- What It Does: Enforces explicit return types for functions.
- Why It's Needed: Helps with code clarity and maintainability by ensuring all functions have clearly defined return types.
- How to Fix: Add return types to all functions.
- Ignore If: Only in cases where the return type is obvious from the context or if the function is a small utility.

## React Best Practices
### react/jsx-key
- What It Does: Ensures that all elements in a list have a key prop.
- Why It's Needed: key helps React identify which items have changed, are added, or are removed, optimizing rendering.
- How to Fix: Add a unique key prop to all elements in an array or iterator.
- Ignore If: Only in cases where you are certain that the key is not necessary or if the list is static and does not change.

### react/no-array-index-key
- What It Does: Disallows using array indices as keys in React lists.
- Why It's Needed: Array indices can cause issues with component state and performance if the list changes dynamically.
- How to Fix: Use unique and stable identifiers for keys instead of array indices.
- Ignore If: Only if the list is static and the use of indices does not impact the functionality.

### react/jsx-curly-brace-presence
- What It Does: Enforces the use of curly braces for expressions in JSX.
- Why It's Needed: Improves readability by making it clear where expressions are used in JSX.
- How to Fix: Wrap JSX expressions in curly braces.
- Ignore If: Only if you have a compelling reason not to use curly braces for JSX expressions.


## Code Quality

### complexity
- What It Does: Limits the complexity of functions to keep them manageable.
- Why It's Needed: Keeps functions simple and easier to understand, reducing the likelihood of bugs.
- How to Fix: Refactor functions to reduce complexity by breaking them into smaller, more manageable pieces.
- Ignore If: Only in cases where the function's complexity is unavoidable due to the nature of the logic.

### max-lines
- What It Does: Limits the number of lines in a file.
- Why It's Needed: Encourages modular code by keeping files small and focused.
- How to Fix: Break large files into smaller modules or components.
- Ignore If: Only if the file size is justified by the functionality and modularization is not practical.

### max-params
- What It Does: Limits the number of parameters a function can have.
- Why It's Needed: Reduces complexity by keeping functions focused and easier to understand.
- How to Fix: Refactor functions to use fewer parameters, possibly by grouping related parameters into objects.
- Ignore If: Only if the function's complexity and number of parameters are justified.

### no-magic-numbers
- What It Does: Disallows the use of magic numbers (hard-coded numeric values without explanation).
- Why It's Needed: Improves code readability by replacing magic numbers with named constants or variables.
- How to Fix: Define constants for magic numbers and use them in your code.
- Ignore If: Only if the number is self-explanatory or used in a very limited context.

## Security

### no-eval
- What It Does: Disallows the use of eval().
- Why It's Needed: eval() can execute arbitrary code and may introduce security risks.
- How to Fix: Avoid using eval() and find alternative ways to achieve the desired functionality.
- Ignore If: Only if eval() is absolutely necessary and you are aware of the security implications.

### no-new-func
- What It Does: Disallows the use of the Function constructor.
- Why It's Needed: The Function constructor can execute arbitrary code and has similar risks as eval().
- How to Fix: Replace Function constructor usage with safer alternatives.
- Ignore If: Only if the Function constructor is essential for a specific, well-understood case.
10 changes: 5 additions & 5 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -211,15 +211,15 @@ Cypress.Commands.add('addProjects', () => {

Cypress.Commands.add('projectDetails', () => {
//define a variable consisting alphabets in small and capital letter
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';

//specify the length for the new string
var lenString = 4;
var randomstring = '';
const lenString = 4;
let randomstring = '';

//loop to select a new character in each iteration
for (var i = 0; i < lenString; i++) {
var rnum = Math.floor(Math.random() * characters.length);
for (let i = 0; i < lenString; i++) {
const rnum = Math.floor(Math.random() * characters.length);
randomstring += characters.substring(rnum, rnum + 1);
console.log(`randomstring`, randomstring);
}
4 changes: 2 additions & 2 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -45,13 +45,13 @@
type AppOwnProps = { tenantConfig: Tenant };

const VideoContainer = dynamic(
() => import('../src/features/common/LandingVideo'),

Check notice on line 48 in pages/_app.tsx

codefactor.io / CodeFactor

pages/_app.tsx#L48

Missing file extension for "../src/features/common/LandingVideo" (import/extensions)
{
ssr: false,
}
);

const Layout = dynamic(() => import('../src/features/common/Layout'), {

Check notice on line 54 in pages/_app.tsx

codefactor.io / CodeFactor

pages/_app.tsx#L54

Missing file extension for "../src/features/common/Layout" (import/extensions)
ssr: false,
});

@@ -62,7 +62,7 @@
enabled: process.env.NODE_ENV === 'production',
integrations: [
new RewriteFrames({
iteratee: (frame) => {

Check notice on line 65 in pages/_app.tsx

codefactor.io / CodeFactor

pages/_app.tsx#L65

Missing return type on function. (@typescript-eslint/explicit-function-return-type)
frame.filename = frame.filename?.replace(distDir, 'app:///_next');
return frame;
},
@@ -98,7 +98,7 @@
});
}

const onRedirectCallback = (appState: any) => {

Check notice on line 101 in pages/_app.tsx

codefactor.io / CodeFactor

pages/_app.tsx#L101

Missing return type on function. (@typescript-eslint/explicit-function-return-type)
// Use Next.js's Router.replace method to replace the url
if (appState) Router.replace(appState?.returnTo || '/');
};
@@ -114,7 +114,7 @@
Component,
pageProps,
emotionCache = clientSideEmotionCache,
}: MyAppProps & AppOwnProps) => {

Check notice on line 117 in pages/_app.tsx

codefactor.io / CodeFactor

pages/_app.tsx#L117

Missing return type on function. (@typescript-eslint/explicit-function-return-type)
const router = useRouter();
const [isMap, setIsMap] = React.useState(false);
const [currencyCode, setCurrencyCode] = React.useState('');
@@ -251,8 +251,8 @@
? window.location.origin
: ''
}
audience={'urn:plant-for-the-planet'}
cacheLocation={'localstorage'}
audience="urn:plant-for-the-planet"
cacheLocation="localstorage"
onRedirectCallback={onRedirectCallback}
useRefreshTokens={true}
>
@@ -271,7 +271,7 @@
setshowVideo={setshowVideo}
/>
) : null}
<Component {...ProjectProps} />

Check notice on line 274 in pages/_app.tsx

codefactor.io / CodeFactor

pages/_app.tsx#L274

Prop spreading is forbidden (react/jsx-props-no-spreading)
</AnalyticsProvider>
</BulkCodeProvider>
</ProjectPropsProvider>
2 changes: 1 addition & 1 deletion pages/sites/[slug]/[locale]/profile/history.tsx
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@

async function fetchPaymentHistory(next = false): Promise<void> {
setIsDataLoading(true);
setProgress(70);

Check notice on line 60 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L60

No magic number: 70. (no-magic-numbers)
if (next && paymentHistory?._links?.next) {
try {
const newPaymentHistory = await getAuthenticatedRequest<PaymentHistory>(
@@ -77,9 +77,9 @@
items: [...paymentHistory.items, ...newPaymentHistory.items],
_links: newPaymentHistory._links,
});
setProgress(100);

Check notice on line 80 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L80

No magic number: 100. (no-magic-numbers)
setIsDataLoading(false);
setTimeout(() => setProgress(0), 1000);

Check notice on line 82 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L82

No magic number: 1000. (no-magic-numbers)
} catch (err) {
setErrors(handleError(err as APIError));
redirect('/profile');
@@ -94,9 +94,9 @@
logoutUser
);
setpaymentHistory(paymentHistory);
setProgress(100);

Check notice on line 97 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L97

No magic number: 100. (no-magic-numbers)
setIsDataLoading(false);
setTimeout(() => setProgress(0), 1000);

Check notice on line 99 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L99

No magic number: 1000. (no-magic-numbers)
setaccountingFilters(paymentHistory._filters);
} catch (err) {
setErrors(handleError(err as APIError));
@@ -115,9 +115,9 @@
logoutUser
);
setpaymentHistory(paymentHistory);
setProgress(100);

Check notice on line 118 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L118

No magic number: 100. (no-magic-numbers)
setIsDataLoading(false);
setTimeout(() => setProgress(0), 1000);

Check notice on line 120 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L120

No magic number: 1000. (no-magic-numbers)
} catch (err) {
setErrors(handleError(err as APIError));
redirect('/profile');
@@ -147,7 +147,7 @@
return tenantConfig ? (
<>
{progress > 0 && (
<div className={'topLoader'}>
<div className="topLoader">
<TopProgressBar progress={progress} />
</div>
)}
@@ -160,7 +160,7 @@
subtitle={t('donationsSubTitle')}
multiColumn={true}
>
<History {...HistoryProps} />

Check notice on line 163 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L163

Prop spreading is forbidden (react/jsx-props-no-spreading)
</DashboardView>

{/* <UnderMaintenance/> */}
@@ -173,7 +173,7 @@

export default AccountHistory;

export const getStaticPaths = async () => {

Check notice on line 176 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L176

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 176 in pages/sites/[slug]/[locale]/profile/history.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/history.tsx#L176

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
2 changes: 1 addition & 1 deletion pages/sites/[slug]/[locale]/profile/payouts/index.tsx
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
return tenantConfig ? (
<>
{progress > 0 && (
<div className={'topLoader'}>
<div className="topLoader">
<TopProgressBar progress={progress} />
</div>
)}
@@ -68,7 +68,7 @@
);
}

export const getStaticPaths = async () => {

Check notice on line 71 in pages/sites/[slug]/[locale]/profile/payouts/index.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/payouts/index.tsx#L71

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 71 in pages/sites/[slug]/[locale]/profile/payouts/index.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/payouts/index.tsx#L71

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
2 changes: 1 addition & 1 deletion pages/sites/[slug]/[locale]/profile/planetcash/index.tsx
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@

useEffect(() => {
// Cleanup function to reset state and address Warning: Can't perform a React state update on an unmounted component.
return () => {

Check notice on line 44 in pages/sites/[slug]/[locale]/profile/planetcash/index.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/index.tsx#L44

Missing return type on function. (@typescript-eslint/explicit-function-return-type)
setProgress(0);
};
}, []);
@@ -49,7 +49,7 @@
return tenantConfig ? (
<>
{progress > 0 && (
<div className={'topLoader'}>
<div className="topLoader">
<TopProgressBar progress={progress} />
</div>
)}
@@ -65,7 +65,7 @@
);
}

export const getStaticPaths = async () => {

Check notice on line 68 in pages/sites/[slug]/[locale]/profile/planetcash/index.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/index.tsx#L68

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 68 in pages/sites/[slug]/[locale]/profile/planetcash/index.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/index.tsx#L68

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
2 changes: 1 addition & 1 deletion pages/sites/[slug]/[locale]/profile/planetcash/new.tsx
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@

useEffect(() => {
// Cleanup function to reset state and address Warning: Can't perform a React state update on an unmounted component.
return () => {

Check notice on line 45 in pages/sites/[slug]/[locale]/profile/planetcash/new.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/new.tsx#L45

Missing return type on function. (@typescript-eslint/explicit-function-return-type)
setProgress(0);
};
}, []);
@@ -50,7 +50,7 @@
return tenantConfig ? (
<>
{progress > 0 && (
<div className={'topLoader'}>
<div className="topLoader">
<TopProgressBar progress={progress} />
</div>
)}
@@ -69,7 +69,7 @@
);
}

export const getStaticPaths = async () => {

Check notice on line 72 in pages/sites/[slug]/[locale]/profile/planetcash/new.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/new.tsx#L72

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 72 in pages/sites/[slug]/[locale]/profile/planetcash/new.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/new.tsx#L72

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@

// Cleanup function to reset state and address Warning: Can't perform a React state update on an unmounted component.
useEffect(() => {
return () => {

Check notice on line 45 in pages/sites/[slug]/[locale]/profile/planetcash/transactions.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/transactions.tsx#L45

Missing return type on function. (@typescript-eslint/explicit-function-return-type)
setProgress(0);
};
}, []);
@@ -50,7 +50,7 @@
return tenantConfig ? (
<>
{progress > 0 && (
<div className={'topLoader'}>
<div className="topLoader">
<TopProgressBar progress={progress} />
</div>
)}
@@ -69,7 +69,7 @@
);
}

export const getStaticPaths = async () => {

Check notice on line 72 in pages/sites/[slug]/[locale]/profile/planetcash/transactions.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/transactions.tsx#L72

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 72 in pages/sites/[slug]/[locale]/profile/planetcash/transactions.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/planetcash/transactions.tsx#L72

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
12 changes: 6 additions & 6 deletions pages/sites/[slug]/[locale]/profile/recurrency.tsx
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@

async function fetchRecurrentDonations(): Promise<void> {
setIsDataLoading(true);
setProgress(70);

Check notice on line 53 in pages/sites/[slug]/[locale]/profile/recurrency.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/recurrency.tsx#L53

No magic number: 70. (no-magic-numbers)
try {
const recurrencies = await getAuthenticatedRequest<Subscription[]>(
tenantConfig.id,
@@ -60,16 +60,16 @@
);
if (recurrencies && Array.isArray(recurrencies)) {
const activeRecurrencies = recurrencies?.filter(
(obj) => obj.status == 'active' || obj.status == 'trialing'
(obj) => obj.status === 'active' || obj.status === 'trialing'
);
const pauseRecurrencies = recurrencies?.filter(
(obj) => obj.status == 'paused'
(obj) => obj.status === 'paused'
);
const otherRecurrencies = recurrencies?.filter(
(obj) =>
obj.status != 'paused' &&
obj.status != 'active' &&
obj.status != 'trialing'
obj.status !== 'paused' &&
obj.status !== 'active' &&
obj.status !== 'trialing'
);
setrecurrencies([
...activeRecurrencies,
@@ -81,9 +81,9 @@
setErrors(handleError(err as APIError));
redirect('/profile');
}
setProgress(100);

Check notice on line 84 in pages/sites/[slug]/[locale]/profile/recurrency.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/recurrency.tsx#L84

No magic number: 100. (no-magic-numbers)
setIsDataLoading(false);
setTimeout(() => setProgress(0), 1000);

Check notice on line 86 in pages/sites/[slug]/[locale]/profile/recurrency.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/recurrency.tsx#L86

No magic number: 1000. (no-magic-numbers)
}

React.useEffect(() => {
@@ -99,7 +99,7 @@
return tenantConfig ? (
<>
{progress > 0 && (
<div className={'topLoader'}>
<div className="topLoader">
<TopProgressBar progress={progress} />
</div>
)}
@@ -107,7 +107,7 @@
<Head>
<title>{t('recurrency')}</title>
</Head>
<RecurrentPayments {...RecurrencyProps} />

Check notice on line 110 in pages/sites/[slug]/[locale]/profile/recurrency.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/recurrency.tsx#L110

Prop spreading is forbidden (react/jsx-props-no-spreading)
</UserLayout>
</>
) : (
@@ -117,7 +117,7 @@

export default RecurrentDonations;

export const getStaticPaths = async () => {

Check notice on line 120 in pages/sites/[slug]/[locale]/profile/recurrency.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/recurrency.tsx#L120

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 120 in pages/sites/[slug]/[locale]/profile/recurrency.tsx

codefactor.io / CodeFactor

pages/sites/[slug]/[locale]/profile/recurrency.tsx#L120

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
const subDomainPaths = await constructPathsForTenantSlug();

const paths = subDomainPaths.map((path) => {
2 changes: 1 addition & 1 deletion public/assets/images/icons/headerIcons/BackArrow.tsx
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ function BackArrow() {
viewBox="0 0 16.652 15.708"
>
<path
fill={'#0c0d0d'}
fill="#0c0d0d"
d="M20.834 12.67H10.707l3.928-3.757a1.565 1.565 0 000-2.139 1.4 1.4 0 00-2.044 0l-6.54 6.341a1.441 1.441 0 00-.426 1.06v.019a1.441 1.441 0 00.426 1.06l6.535 6.341a1.4 1.4 0 002.044 0 1.565 1.565 0 000-2.139L10.7 15.7h10.129a1.481 1.481 0 001.448-1.514 1.466 1.466 0 00-1.443-1.516z"
data-name="Icon ionic-md-arrow-round-back"
transform="translate(-5.625 -6.33)"
4 changes: 2 additions & 2 deletions public/assets/images/icons/manageProjects/NotReviewed.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';

function NotReviewed() {

Check notice on line 3 in public/assets/images/icons/manageProjects/NotReviewed.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/NotReviewed.tsx#L3

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 3 in public/assets/images/icons/manageProjects/NotReviewed.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/NotReviewed.tsx#L3

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
return (
<svg
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
width={'100%'}
height={'100%'}
width="100%"

Check notice on line 8 in public/assets/images/icons/manageProjects/NotReviewed.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/NotReviewed.tsx#L8

Curly braces are unnecessary here. (react/jsx-curly-brace-presence)
height="100%"

Check notice on line 9 in public/assets/images/icons/manageProjects/NotReviewed.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/NotReviewed.tsx#L9

Curly braces are unnecessary here. (react/jsx-curly-brace-presence)
viewBox="0 0 815.686 572.003"
>
<defs>
@@ -299,7 +299,7 @@
<path
fill="#007b49"
d="M366.15 346.02l4.425 2.414a5.171 5.171 0 01.585-1.719 5.3 5.3 0 017.185-2.157 5.23 5.23 0 012.6 3.236 5.32 5.32 0 010 10.6l-.146.274a6.509 6.509 0 11-11.447-6.2 5.924 5.924 0 011.08-1.462l-5.485-2.944s-.183 0 .384-1.134.819-.908.819-.908z"
data-name="tree 1 2"

Check notice on line 302 in public/assets/images/icons/manageProjects/NotReviewed.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/NotReviewed.tsx#L302

File has too many lines (669). Maximum allowed is 300. (max-lines)
transform="translate(123.059 -44.724)"
></path>
<path
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';

function SubmitForReviewImage() {

Check notice on line 3 in public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx#L3

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 3 in public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx#L3

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
return (
<svg
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
width={'100%'}
height={'100%'}
width="100%"

Check notice on line 8 in public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx#L8

Curly braces are unnecessary here. (react/jsx-curly-brace-presence)
height="100%"

Check notice on line 9 in public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx#L9

Curly braces are unnecessary here. (react/jsx-curly-brace-presence)
viewBox="0 0 815.685 572.003"
>
<defs>
@@ -299,7 +299,7 @@
<path
fill="#007b49"
d="M366.15 346.02l4.425 2.414a5.171 5.171 0 01.585-1.719 5.3 5.3 0 017.185-2.157 5.23 5.23 0 012.6 3.236 5.32 5.32 0 010 10.6l-.146.274a6.509 6.509 0 11-11.447-6.2 5.924 5.924 0 011.08-1.462l-5.485-2.944s-.183 0 .384-1.134.819-.908.819-.908z"
data-name="tree 1 2"

Check notice on line 302 in public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/SubmitForReviewImage.tsx#L302

File has too many lines (687). Maximum allowed is 300. (max-lines)
transform="translate(123.059 -44.724)"
></path>
<path
4 changes: 2 additions & 2 deletions public/assets/images/icons/manageProjects/UnderReview.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';

function UnderReview() {

Check notice on line 3 in public/assets/images/icons/manageProjects/UnderReview.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/UnderReview.tsx#L3

Missing return type on function. (@typescript-eslint/explicit-function-return-type)

Check notice on line 3 in public/assets/images/icons/manageProjects/UnderReview.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/UnderReview.tsx#L3

Missing return type on function. (@typescript-eslint/explicit-module-boundary-types)
return (
<svg
xmlns="http://www.w3.org/2000/svg"
xmlnsXlink="http://www.w3.org/1999/xlink"
width={'100%'}
height={'100%'}
width="100%"

Check notice on line 8 in public/assets/images/icons/manageProjects/UnderReview.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/UnderReview.tsx#L8

Curly braces are unnecessary here. (react/jsx-curly-brace-presence)
height="100%"

Check notice on line 9 in public/assets/images/icons/manageProjects/UnderReview.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/UnderReview.tsx#L9

Curly braces are unnecessary here. (react/jsx-curly-brace-presence)
viewBox="0 0 747.112 531.353"
>
<defs>
@@ -299,7 +299,7 @@
fill="#ffb0b1"
d="M847.59 434.459c.075-.067.142-.142.209-.209-.067.067-.134.142-.209.209z"
data-name="Path 5553"
transform="translate(14416.145 5493.637)"

Check notice on line 302 in public/assets/images/icons/manageProjects/UnderReview.tsx

codefactor.io / CodeFactor

public/assets/images/icons/manageProjects/UnderReview.tsx#L302

File has too many lines (932). Maximum allowed is 300. (max-lines)
></path>
<path
d="M944.927 331.9c-5.337 3.647-9.814 6.727-10.681 7.369-2.4 1.764-6.973 12.168-9.888 17.475-2.347 4.275-9.948 5.374-12.818 5.643l.344-3.147c6.517-2.907 11.51-12.205 11.51-12.205l12.9-22.6 4.44 4.021s1.697 1.333 4.193 3.444z"
Loading
Loading