|
1 |
| -# boilerplate-vite-reactjs |
2 |
| -Basic boilerplate: ReactJS,ESLINT+PRETTIER,ALIAS PATH,PNPM,BASIC STRUCTURE PACK |
| 1 | +# boilerplate-vite-reactjs |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +## Requeriments |
| 6 | + |
| 7 | +- **ESLINT Plugin** |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +- **PRETTIER Plugin** |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +- **PNPM Package manager** |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +- **Image Preview** (Optional) |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +This plugin is a lifesaver! It gives you a sweet preview of your image files, no matter the extension (svg, png, jpg, you name it). You'll find it on the left side, right next to the line number. Just hover your cursor over the path, and voila! You'll see the image pop up, even within the component. |
| 24 | + |
| 25 | +**Example** |
| 26 | + |
| 27 | + |
| 28 | +## Description |
| 29 | + |
| 30 | +This project is created for ReactJS using the PNPM Package Manager. It comes with basic ESLint and Prettier configurations, as well as the use of relative paths based on the project's path structure. Essentially, it's a boilerplate that helps you kickstart your projects quickly and easily. |
| 31 | + |
| 32 | +I hope this less formal version meets your requirements. If you need any further modifications or have any other requests, please let me know. |
| 33 | + |
| 34 | +## Configuration description |
| 35 | + |
| 36 | +### vite.config.js |
| 37 | + |
| 38 | +Check out the vite.config.js file! That's where you'll find all the routes with their fancy aliases for the project. If you want to add a new route, simply follow the same writing style as shown in the line below. |
| 39 | + |
| 40 | +```js |
| 41 | +import { fileURLToPath, URL } from "url"; |
| 42 | +import { defineConfig } from "vite"; |
| 43 | +import vue from "@vitejs/plugin-react"; |
| 44 | + |
| 45 | +// https://vitejs.dev/config/ |
| 46 | +export default defineConfig({ |
| 47 | + plugins: [vue()], |
| 48 | + resolve: { |
| 49 | + alias: [ |
| 50 | + { find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) }, |
| 51 | + { find: '@assets', replacement: fileURLToPath(new URL('./src/assets', import.meta.url)) }, |
| 52 | + { find: '@components', replacement: fileURLToPath(new URL('./src/components', import.meta.url)) }, |
| 53 | + { find: '@config', replacement: fileURLToPath(new URL('./src/config', import.meta.url)) }, |
| 54 | + { find: '@pages', replacement: fileURLToPath(new URL('./src/pages', import.meta.url)) }, |
| 55 | + { find: '@router', replacement: fileURLToPath(new URL('./src/router', import.meta.url)) }, |
| 56 | + { find: '@styles', replacement: fileURLToPath(new URL('./src/styles', import.meta.url)) }, |
| 57 | + { find: '@utils', replacement: fileURLToPath(new URL('./src/utils', import.meta.url)) }, |
| 58 | + ], |
| 59 | + }, |
| 60 | +}); |
| 61 | +``` |
| 62 | +
|
| 63 | +#### jsconfig.json |
| 64 | +
|
| 65 | +```js |
| 66 | +{ |
| 67 | + "compilerOptions": { |
| 68 | + "baseUrl": ".", |
| 69 | + "paths": { |
| 70 | + "@/*": ["/src/*"], |
| 71 | + "@assets/*": ["/src/assets/*"], |
| 72 | + "@components/*": ["/src/components/*"], |
| 73 | + "@config/*": ["/src/config/*"], |
| 74 | + "@pages/*": ["/src/pages/*"], |
| 75 | + "@router/*": ["/src/router/*"], |
| 76 | + "@styles/*": ["/src/styles/*"], |
| 77 | + "@utils/*": ["/src/utils/*"], |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | +``` |
| 82 | +
|
| 83 | +> ⚡VSCODE will automatically detect the routes and suggest them in autocomplete. |
| 84 | +
|
| 85 | + |
| 86 | +
|
| 87 | +--- |
| 88 | +### .prettierrc |
| 89 | +
|
| 90 | +PRETTIER is the handy tool you need to keep your code in check! It's like having a code format enforcer that ensures everything looks clean and organized. When you collaborate with others on the same project, thanks to PRETTIER's rules, there won't be a jumbled mess of code styles. |
| 91 | +
|
| 92 | +Need some extra rules? Check out this link: [Rules Prettier]([/guides/content/editing-an-existing-page](https://prettier.io/docs/en/options.html)). Although the configurations already in the file should cover your needs, it's always good to have more choices based on personal preference and team organization. But honestly, what you have here is more than sufficient to get things rolling. |
| 93 | +
|
| 94 | +
|
| 95 | +```js |
| 96 | +{ |
| 97 | + "userTabs": true, |
| 98 | + "semi": false, |
| 99 | + "singleQuote": true, |
| 100 | + "jsxSingleQuote": true, |
| 101 | + "bracketLine": true, |
| 102 | + "arrowParens": "avoid", |
| 103 | + "endOfLine": "lf" |
| 104 | +} |
| 105 | +``` |
| 106 | +
|
| 107 | +--- |
| 108 | +--- |
| 109 | +
|
| 110 | +> If this repository has been helpful to you, please show your support by giving it a star. It would mean the world to me, and I'll be extremely grateful. Thank you! |
| 111 | +
|
| 112 | +
|
| 113 | +Make sure to swing by my Personal Blog! You never know what gems you'll discover that could be of value to you or your buddies. |
| 114 | +
|
| 115 | +[<ode <raft avila Blog](https://codecraftavila.super.site/) |
0 commit comments