Skip to content

Commit

Permalink
Integration of Prettier with Updated Configuration (#128)
Browse files Browse the repository at this point in the history
* added prettier package ans script

* fix prettier to all files

* change prettier config

* added semocolon to end of the line using prettier
  • Loading branch information
sahsisunny authored Jan 20, 2024
1 parent 44bbb22 commit 0ef2ab3
Show file tree
Hide file tree
Showing 133 changed files with 11,622 additions and 8,578 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# yarn
.yarnrc.yml
.yarn/*
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore all files in the "node_modules" directory
node_modules/

# Ignore all files in the coverage directory
/coverage/*

# Ignore all files in the .next directory
/.next/*
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"printWidth": 80,
"arrowParens": "always",
"trailingComma": "all",
"bracketSpacing": true,
"endOfLine": "lf"
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ Now go to your forked repository and you'll see that **This branch is xx commits

Wait for it to get reviewed, make the changes required (if any) , commit your changes and hit **Pull Request** again, your commits will be added to the same pull request you had opened earlier (if it is NOT closed).

12. **Congratulations on making your first Pull Request! 🎉**
12. **Congratulations on making your first Pull Request! 🎉**
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,25 @@ This page is hosted on: https://members.realdevsquad.com/

You can find a detailed guide [here](./CONTRIBUTING.md)!


# Coding Conventions

### There are only 2 things in computer science: cache invalidation & naming things — *********Phil Karlton*********
### There are only 2 things in computer science: cache invalidation & naming things — \***\*\*\*\***Phil Karlton\***\*\*\*\***

## Imports Order

## Imports Order
- External Libraries
- External Libraries
- Internal Libraries
- Components
- Types
- Images
- CSS
- Components
- Types
- Images
- CSS

## Commits style:

- Make Atomic commits of changes, even if they are across multiple files in logical units.
- Add displayName to make the Header clear
- Remove unused date format
- Chore change library version

- Add displayName to make the Header clear
- Remove unused date format
- Chore change library version
- It's alright to add a Description even if it's big we want to understand things just by reading the commit description at times.

## Branch Naming:
Expand All @@ -52,13 +51,13 @@ refact: for cleanup and refactor
example

```jsx
/*BAD*/
const value = 5 //what is this value ?
const isPagination = true // what does it do ?
/*BAD*/
const value = 5; //what is this value ?
const isPagination = true; // what does it do ?

/*GOOD*/
const initialIndexValue = 5;
const isPaginationEnabled = true
const isPaginationEnabled = true;
```

## Sanity:
Expand All @@ -67,12 +66,12 @@ const isPaginationEnabled = true

```jsx
//bad
const onItmClk =()=>{}
const onItmClk = () => {};

//good
const onItemClick = () => {}
const onItemClick = () => {};

const onProceedBtnClick = () => {}
const onProceedBtnClick = () => {};
```

## Folder structure:
Expand Down
72 changes: 36 additions & 36 deletions constants/NavConstants.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
interface NavObject{
id: Number,
name: String,
link: String
interface NavObject {
id: Number;
name: String;
link: String;
}

const navItems: Array<NavObject> = [
{
id: 0,
name: 'Home',
link: 'https://realdevsquad.com/',
},
{
id: 1,
name: 'Welcome',
link: 'https://welcome.realdevsquad.com/',
},
{
id: 0,
name: 'Events',
link: 'https://www.realdevsquad.com/events',
},
{
id: 0,
name: 'Members',
link: 'https://members.realdevsquad.com/',
},
{
id: 0,
name: 'Crypto',
link: 'https://crypto.realdevsquad.com/',
},
{
id: 0,
name: 'Status',
link: 'https://status.realdevsquad.com/',
},
]
{
id: 0,
name: 'Home',
link: 'https://realdevsquad.com/',
},
{
id: 1,
name: 'Welcome',
link: 'https://welcome.realdevsquad.com/',
},
{
id: 0,
name: 'Events',
link: 'https://www.realdevsquad.com/events',
},
{
id: 0,
name: 'Members',
link: 'https://members.realdevsquad.com/',
},
{
id: 0,
name: 'Crypto',
link: 'https://crypto.realdevsquad.com/',
},
{
id: 0,
name: 'Status',
link: 'https://status.realdevsquad.com/',
},
];

export default navItems
export default navItems;
5 changes: 3 additions & 2 deletions constants/NotFound.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const NOT_FOUND_CONSTANT = {
PAGE_NOT_FOUND: "The page you're trying to find doesn't exist, please go to members page to see all the members of RDS",
}
PAGE_NOT_FOUND:
"The page you're trying to find doesn't exist, please go to members page to see all the members of RDS",
};
26 changes: 13 additions & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const nextJest = require("next/jest");

const createJestConfig = nextJest({
dir: "./",
});

const customJestConfig = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
moduleDirectories: ["node_modules", "<rootDir>/"],
testEnvironment: "jest-environment-jsdom",
};

module.exports = createJestConfig(customJestConfig);
const nextJest = require('next/jest');

const createJestConfig = nextJest({
dir: './',
});

const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleDirectories: ['node_modules', '<rootDir>/'],
testEnvironment: 'jest-environment-jsdom',
};

module.exports = createJestConfig(customJestConfig);
16 changes: 8 additions & 8 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "@testing-library/jest-dom";
import "./setupTests";
import "whatwg-fetch";

// jest.config.js
module.exports = {
setupFilesAfterEnv: ["@testing-library/jest-dom", "./jest.setup.ts"],
};
import '@testing-library/jest-dom';
import './setupTests';
import 'whatwg-fetch';

// jest.config.js
module.exports = {
setupFilesAfterEnv: ['@testing-library/jest-dom', './jest.setup.ts'],
};
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const nextConfig = {
},
};

module.exports = nextConfig
module.exports = nextConfig;
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
"build:production": "cp ./env/.env.production .env && next build",
"start": "next start",
"test": "jest --watch",
"lint": "next lint",
"lint:check": "next lint",
"lint:fix": "next lint --fix",
"build:staging": "cp ./env/.env.staging .env && next build",
"coverage": "jest --collect-coverage"
"coverage": "jest --collect-coverage",
"prettier:check": "prettier --check .",
"prettier:fix": "prettier --write .",
"fix": "yarn prettier:fix && yarn lint:fix"
},
"dependencies": {
"@chakra-ui/icons": "^2.0.19",
Expand Down Expand Up @@ -46,6 +50,7 @@
"jest-environment-jsdom": "^29.3.1",
"msw": "^0.49.1",
"postcss": "^8.4.19",
"prettier": "^3.1.1",
"tailwindcss": "^3.2.4"
}
}
4 changes: 1 addition & 3 deletions pages/404.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ import { NOT_FOUND_CONSTANT } from '@/constants/NotFound';
import NotFound from '@/src/components/NotFound';

export default function NotFoundPage() {
return (
<NotFound text={NOT_FOUND_CONSTANT.PAGE_NOT_FOUND} />
);
return <NotFound text={NOT_FOUND_CONSTANT.PAGE_NOT_FOUND} />;
}
38 changes: 19 additions & 19 deletions pages/[memberprofile]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { GetServerSidePropsContext } from "next";
import { Box, Flex } from "@chakra-ui/react";
import { GetServerSidePropsContext } from 'next';
import { Box, Flex } from '@chakra-ui/react';

import { wrapper } from "@/src/store";
import { wrapper } from '@/src/store';

import MemberProfileCard from "src/components/MemberProfileCard";
import MemberContributions from "@/src/components/MemberContribution";
import MemberProfileCard from 'src/components/MemberProfileCard';
import MemberContributions from '@/src/components/MemberContribution';

import serverApi from "@/src/services/serverApi";
import serverApi from '@/src/services/serverApi';

import styles from "./memberProfileWrapper.module.css";
import { useGetIsSuperUser } from "@/src/utils/customHooks";
import NotFound from "@/src/components/NotFound";
import { useRouter } from "next/router";
import styles from './memberProfileWrapper.module.css';
import { useGetIsSuperUser } from '@/src/utils/customHooks';
import NotFound from '@/src/components/NotFound';
import { useRouter } from 'next/router';

export default function MembersProfile(props: any) {
const { userData, userContribution, userActiveTask, error } = props;
Expand All @@ -31,14 +31,14 @@ export default function MembersProfile(props: any) {
return (
<Box
sx={{
display: "flex",
justifyContent: "center",
display: 'flex',
justifyContent: 'center',
}}
width={"100%"}
width={'100%'}
>
<Flex
width={"70%"}
justifyContent={"center"}
width={'70%'}
justifyContent={'center'}
className={styles.memberProfile_wrapper}
>
<MemberProfileCard userData={user} />
Expand All @@ -60,13 +60,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
try {
store.dispatch(serverApi.endpoints.getUser.initiate(memberprofile));
store.dispatch(
serverApi.endpoints.getContributions.initiate(memberprofile)
serverApi.endpoints.getContributions.initiate(memberprofile),
);
store.dispatch(
serverApi.endpoints.getUserActiveTask.initiate(memberprofile)
serverApi.endpoints.getUserActiveTask.initiate(memberprofile),
);
const [userDetails, userContribution, activeTask] = await Promise.all(
store.dispatch(serverApi.util.getRunningQueriesThunk())
store.dispatch(serverApi.util.getRunningQueriesThunk()),
);
const userData = userDetails?.data ?? null;
const userActiveTask = activeTask?.data ?? null;
Expand All @@ -88,5 +88,5 @@ export const getServerSideProps = wrapper.getServerSideProps(
} catch (e) {
console.error(e);
}
}
},
);
28 changes: 14 additions & 14 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ function App({ Component, ...rest }: AppProps) {
const emotionCache = createCache({
key: 'emotion-css-cache',
prepend: true,
})
});

return (
<>
<Head>
<title>Real Dev Squad</title>
<link rel='icon' href='/images/Real-Dev-Squad@1x.svg' />
<link rel="icon" href="/images/Real-Dev-Squad@1x.svg" />
</Head>
<CacheProvider value={emotionCache}>
<ChakraProvider theme={theme}>
<Provider store={store}>
<LayoutComponent>
<AuthHandler>
<KeyboardEventHandler>
<Component {...props.pageProps} />
</KeyboardEventHandler>
</AuthHandler>
</LayoutComponent>
</Provider>
<Toast />
</ChakraProvider>
<ChakraProvider theme={theme}>
<Provider store={store}>
<LayoutComponent>
<AuthHandler>
<KeyboardEventHandler>
<Component {...props.pageProps} />
</KeyboardEventHandler>
</AuthHandler>
</LayoutComponent>
</Provider>
<Toast />
</ChakraProvider>
</CacheProvider>
<Loader />
</>
Expand Down
Loading

0 comments on commit 0ef2ab3

Please sign in to comment.