diff --git a/.eslintrc.cjs b/.eslintrc.cjs index ae5e95c..4573a19 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -26,6 +26,16 @@ module.exports = { "index" ], "pathGroups": [ + { + "pattern": "react", + "group": "builtin", + "position": "before" + }, + { + "pattern": "@/**", + "group": "parent", + "position": "before" + }, { "pattern": "**/*.stories.ts?", "group": "external", diff --git a/README.md b/README.md index 3948d33..ea271a4 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,9 @@ React dApp Template (Vite) is an easy-to-use foundation for efficiently building ## What's Included and Preconfigured -### Web3 Related Packages +### Web3 Packages -- ethers.js -- typechain +- ethers.js (v5) ### Testing Infrastucture @@ -66,17 +65,17 @@ React dApp Template (Vite) is an easy-to-use foundation for efficiently building **React Error Boundary**: A feature in React for handling and containing errors within specific components. -**React Helmet**: A library for managing metadata in React applications, optimizing SEO and discoverability. +**React Helmet Async**: A library for managing metadata in React applications, optimizing SEO and discoverability. **I18Next**: An internationalization library for easily translating JavaScript applications into different languages. -**React Icon All Files**: A library providing a collection of high-quality SVG icons for React applications. +**React Icons**: A library providing a collection of high-quality SVG icons for React applications. **React Cookie Consent**: A library simplifying the implementation of cookie consent banners in React applications. ## Getting Started -Please visit the [Official React dApp Tamplate Documentation Page](https://huseyindeniz.github.io/react-dapp-template-documentation/) to start your dApp frontend development journey. +Please visit the [Official React dApp Template Documentation Page](https://huseyindeniz.github.io/react-dapp-template-documentation/) to start your dApp frontend development journey. ## Contributions diff --git a/package-lock.json b/package-lock.json index 0737b79..88bf523 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,7 +69,8 @@ "storybook-addon-react-router-v6": "^2.0.7", "ts-jest": "^29.1.1", "typescript": "^5.0.2", - "vite": "^4.4.5" + "vite": "^4.4.5", + "vite-tsconfig-paths": "^4.2.1" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -13697,6 +13698,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globrex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", + "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==", + "dev": true + }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -21361,6 +21368,26 @@ } } }, + "node_modules/tsconfck": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-2.1.2.tgz", + "integrity": "sha512-ghqN1b0puy3MhhviwO2kGF8SeMDNhEbnKxjK7h6+fvY9JAxqvXi8y5NAHSQv687OVboS2uZIByzGd45/YxrRHg==", + "dev": true, + "bin": { + "tsconfck": "bin/tsconfck.js" + }, + "engines": { + "node": "^14.13.1 || ^16 || >=18" + }, + "peerDependencies": { + "typescript": "^4.3.5 || ^5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", @@ -22211,6 +22238,25 @@ } } }, + "node_modules/vite-tsconfig-paths": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/vite-tsconfig-paths/-/vite-tsconfig-paths-4.2.1.tgz", + "integrity": "sha512-GNUI6ZgPqT3oervkvzU+qtys83+75N/OuDaQl7HmOqFTb0pjZsuARrRipsyJhJ3enqV8beI1xhGbToR4o78nSQ==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "globrex": "^0.1.2", + "tsconfck": "^2.1.0" + }, + "peerDependencies": { + "vite": "*" + }, + "peerDependenciesMeta": { + "vite": { + "optional": true + } + } + }, "node_modules/void-elements": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", diff --git a/package.json b/package.json index cd3cf79..bd17e07 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vitedapp", "private": true, - "version": "0.1.0", + "version": "0.2.0", "type": "module", "scripts": { "dev": "vite", @@ -76,7 +76,8 @@ "storybook-addon-react-router-v6": "^2.0.7", "ts-jest": "^29.1.1", "typescript": "^5.0.2", - "vite": "^4.4.5" + "vite": "^4.4.5", + "vite-tsconfig-paths": "^4.2.1" }, "jest": { "preset": "ts-jest", @@ -84,30 +85,30 @@ "moduleNameMapper": { "^.+\\.svg$": "jest-svg-transformer", "^.+\\.(css|less|scss|webp|png|jpg)$": "identity-obj-proxy", - "react-i18next": "/src/__mocks__/i18nextMock.tsx" + "react-i18next": "/src/__mocks__/i18nextMock.tsx", + "@/features/i18n/(.*)": "/src/features/i18n/$1", + "@/features/ui/(.*)": "/src/features/ui/$1", + "@/features/wallet/(.*)": "/src/features/wallet/$1", + "@/services/(.*)": "/src/services/$1", + "@/pages/(.*)": "/src/pages/$1", + "@/hooks/(.*)": "/src/hooks/$1", + "@/store/(.*)": "/src/store/$1" }, "setupFilesAfterEnv": [ "/src/setupTests.ts" ], "collectCoverageFrom": [ "src/**/*.{js,jsx,ts,tsx}", - "!src/reportWebVitals.ts", - "!src/serviceWorker.ts", - "!src/serviceWorkerRegistration.ts", - "!src/test-utils.tsx", - "!src/index.tsx", - "!src/App.tsx", "!src/**/*.stories.{js,jsx,ts,tsx}", - "!/node_modules/", - "!/template/" + "!/node_modules/" ], "coveragePathIgnorePatterns": [], "coverageThreshold": { "global": { "branches": 30, - "functions": 40, - "lines": 40, - "statements": 40 + "functions": 30, + "lines": 30, + "statements": 30 } } } diff --git a/src/App.tsx b/src/App.tsx index dca0f97..5e0ff26 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,11 +1,12 @@ -import log from 'loglevel'; import React from 'react'; + +import log from 'loglevel'; import { Provider } from 'react-redux'; -import { Router } from './pages/Router'; -import store from './store/store'; +import { Router } from '@/pages/Router'; +import store from '@/store/store'; -import './features/i18n/i18n'; +import '@/features/i18n/i18n'; log.setDefaultLevel('silent'); diff --git a/src/__mocks__/customRender.tsx b/src/__mocks__/customRender.tsx index 410f649..e31df4e 100644 --- a/src/__mocks__/customRender.tsx +++ b/src/__mocks__/customRender.tsx @@ -1,10 +1,11 @@ /* eslint-disable react-refresh/only-export-components */ +import * as React from 'react'; + import { ChakraProvider } from '@chakra-ui/react'; import { render, RenderOptions } from '@testing-library/react'; -import * as React from 'react'; -import { I18nextProvider } from 'react-i18next'; +import { I18nextProvider } from 'react-i18next'; -import { theme } from '../features/ui/components/Layout/Theme/theme'; +import { theme } from '@/features/ui/components/Layout/Theme/theme'; import i18n from './i18nextMock'; diff --git a/src/features/i18n/components/LangMenu/LangMenu.tsx b/src/features/i18n/components/LangMenu/LangMenu.tsx index e410fec..fe5e2d9 100644 --- a/src/features/i18n/components/LangMenu/LangMenu.tsx +++ b/src/features/i18n/components/LangMenu/LangMenu.tsx @@ -1,5 +1,6 @@ -import { Button, useDisclosure } from "@chakra-ui/react"; import React from "react"; + +import { Button, useDisclosure } from "@chakra-ui/react"; import { useTranslation } from "react-i18next"; import { useLocation } from "react-router-dom"; diff --git a/src/features/i18n/useI18nWatchers.ts b/src/features/i18n/useI18nWatchers.ts index 70e66a8..50448de 100644 --- a/src/features/i18n/useI18nWatchers.ts +++ b/src/features/i18n/useI18nWatchers.ts @@ -1,8 +1,9 @@ import { useEffect } from 'react'; + import { useTranslation } from 'react-i18next'; import { useLocation, useParams, useNavigate } from 'react-router-dom'; -import { usePages } from '../../pages/usePages'; +import { usePages } from '@/pages/usePages'; import { i18nConfig } from './config'; diff --git a/src/features/ui/components/Layout/Copyright/Copyright.tsx b/src/features/ui/components/Layout/Copyright/Copyright.tsx index 2adc688..3161d13 100644 --- a/src/features/ui/components/Layout/Copyright/Copyright.tsx +++ b/src/features/ui/components/Layout/Copyright/Copyright.tsx @@ -1,13 +1,14 @@ -import { Box, Link, Button, Image, Tooltip } from '@chakra-ui/react'; import React from 'react'; +import { Box, Link, Button, Image, Tooltip } from '@chakra-ui/react'; + import reactDappTemplateLogo from '../../../assets/images/react-dapp-template-logo.webp'; // You can remove or change this section export const Copyright: React.FC = React.memo(() => { return ( - +