Skip to content

Commit 8d5071f

Browse files
committed
initialized project with, latest nextJs, tailwind, jest, typescript, eslint, husky, and created a DFS visualizer by created a binary tree
0 parents  commit 8d5071f

31 files changed

+18578
-0
lines changed

.env.example

Whitespace-only changes.

.eslintignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
build/
3+
coverage/
4+
*.json
5+
*.css
6+
out

.eslintrc.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
Configure eslint for nextJs
3+
Read more about it: https://dev.to/azadshukor/setting-up-nextjs-13-with-typescript-eslint-47an
4+
Read about env : https://eslint.org/docs/latest/use/configure/language-options-deprecated#using-configuration-files
5+
*/
6+
{
7+
"env": {
8+
"browser": true,
9+
"node": true,
10+
"jest": true
11+
},
12+
"extends": [
13+
"next/core-web-vitals",
14+
"eslint:recommended",
15+
"plugin:@typescript-eslint/recommended",
16+
"plugin:testing-library/react", // for jest unit testing
17+
"plugin:jest-dom/recommended" // for jest unit testing
18+
],
19+
"parser": "@typescript-eslint/parser",
20+
"plugins": ["@typescript-eslint"],
21+
"rules": {
22+
// Note: you must disable the base rule as it can report incorrect errors
23+
// instead we enabled -> @typescript-eslint/no-unused-vars
24+
"no-unused-vars": "off",
25+
"@typescript-eslint/no-unused-vars": "error",
26+
"react/jsx-no-bind": [
27+
"error",
28+
{
29+
"allowArrowFunctions": true,
30+
"allowBind": false,
31+
"ignoreRefs": true
32+
}
33+
],
34+
"semi": "error",
35+
"prefer-const": "error",
36+
"no-console": "warn",
37+
"react/no-did-update-set-state": "error",
38+
"react/no-unknown-property": "error",
39+
"react/no-unused-prop-types": "error",
40+
"react/prop-types": "error",
41+
"react/react-in-jsx-scope": "off",
42+
"react-hooks/rules-of-hooks": "error",
43+
"react-hooks/exhaustive-deps": "warn",
44+
45+
// ES6 and Beyond
46+
// "arrow-body-style": ["error", "as-needed"],
47+
// "arrow-parens": ["error", "always"],
48+
"no-var": "error",
49+
"prefer-arrow-callback": "error",
50+
51+
// Code Readability and Consistency
52+
"indent": ["error", 2],
53+
// "quotes": ["error", "single", "backtick"],
54+
// "camelcase": "error",
55+
56+
// Error Prevention
57+
"no-undef": "error",
58+
"eqeqeq": "error",
59+
"no-implicit-coercion": "error",
60+
"no-unused-expressions": "error",
61+
"no-extra-boolean-cast": "error",
62+
"no-eval": "error"
63+
},
64+
"root": true
65+
}

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
.env*.production
31+
.env*.development
32+
33+
# vercel
34+
.vercel
35+
36+
# typescript
37+
*.tsbuildinfo
38+
next-env.d.ts

.husky/pre-commit.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run format && npm run lint && git add -A .

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"trailingComma": "es5",
3+
"bracketSpacing": true,
4+
"endOfLine": "lf",
5+
"semi": true,
6+
"tabWidth": 2,
7+
"singleQuote": true,
8+
"jsxSingleQuote": true,
9+
"plugins": ["prettier-plugin-tailwindcss"]
10+
}

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
# or
14+
bun dev
15+
```
16+
17+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18+
19+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20+
21+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22+
23+
## Learn More
24+
25+
To learn more about Next.js, take a look at the following resources:
26+
27+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29+
30+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31+
32+
## Deploy on Vercel
33+
34+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35+
36+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

__test__/HomeComponent.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Write a test case for home page
3+
*/
4+
5+
import { render, screen } from '@testing-library/react';
6+
import Page from '../src/app/page';
7+
8+
describe('Home component', () => {
9+
it('Should have a Hello World text', () => {
10+
render(<Page />);
11+
const getText = screen.getByText('Hello world!');
12+
expect(getText).toBeInTheDocument();
13+
});
14+
});

jest.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { Config } from 'jest';
2+
import nextJest from 'next/jest.js';
3+
4+
const createJestConfig = nextJest({
5+
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
6+
dir: './',
7+
});
8+
9+
// Add any custom config to be passed to Jest
10+
const config: Config = {
11+
coverageProvider: 'v8',
12+
testEnvironment: 'jsdom',
13+
// Add more setup options before each test is run
14+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
15+
};
16+
17+
// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
18+
export default createJestConfig(config);

jest.setup.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
This file contains common setup logic to be executed before running each test file in Jest.
3+
It initializes any necessary configurations, mocks, or environment setups required for testing purposes.
4+
Developers can define global setup functions, such as setting up mock modules or configuring test environments,
5+
to ensure consistent behavior across all tests in the project.
6+
*/
7+
8+
import '@testing-library/jest-dom';
9+
10+
// do setup once, for entire other test files also
11+
//This setup is necessary because IntersectionObserver isn't available in the test environment
12+
13+
beforeAll(() => {
14+
// IntersectionObserver isn't available in test environment
15+
const mockIntersectionObserver = jest.fn();
16+
mockIntersectionObserver.mockReturnValue({
17+
observe: () => null,
18+
unobserve: () => null,
19+
disconnect: () => null,
20+
});
21+
window.IntersectionObserver = mockIntersectionObserver;
22+
});

next.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {};
3+
4+
export default nextConfig;

0 commit comments

Comments
 (0)