This template provides a consistent starting point for frontend projects built with Vite, React, and TypeScript. It integrates ESLint and Prettier to enforce code quality and style consistency across multiple development environments.
- Vite: A fast and modern build tool for development.
- React + TypeScript: Scaffolding for React projects with TypeScript support.
- ESLint: Configured with support for React, TypeScript, and Prettier integration.
- Prettier: Ensures consistent code formatting.
- EditorConfig: Standardizes indentation, line endings, and other settings across editors.
- Ready-to-Use Folder Structure: Simplifies project setup.
This template includes a robust ESLint setup using the Flat Config format. The configuration supports:
- The latest ECMAScript features (
ecmaVersion: 'latest'). - TypeScript linting using
@typescript-eslint/parserand@typescript-eslint/eslint-plugin. - React-specific linting with
eslint-plugin-react-hooksandeslint-plugin-react-refresh. - Prettier integration via
eslint-plugin-prettier, ensuring formatting issues are reported as ESLint errors. - Pre-configured rules for React and TypeScript development.
The template includes a .prettierrc file with the following settings:
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "always",
"printWidth": 80,
"tabWidth": 2
}Prettier is seamlessly integrated with ESLint, so all formatting issues are reported during linting.
Here's the updated How to Use section along with the Scripts:
-
Clone the Template:
git clone <template-repo-url> my-new-project cd my-new-project
-
Install Dependencies:
npm install
-
Start the Development Server:
npm run dev
-
Build the Project:
npm run build
-
Preview the Production Build:
npm run preview
-
Lint the Project:
npm run lint
-
Fix Linting Issues:
npm run lint:fix
-
Format the Codebase:
npm run format
-
Check Code Formatting:
npm run format:check
-
Run Unit Tests:
npm run test -
Generate Coverage Reports:
npm run test:coverage
-
Open Vitest UI:
npm run test:ui
npm run dev: Start the development server.npm run build: Create a production-ready build.npm run preview: Preview the production build.npm run lint: Lint the codebase using ESLint.npm run lint:fix: Automatically fix linting issues where possible.npm run format: Format the codebase with Prettier.npm run format:check: Check if the codebase is properly formatted.npm run test: Run all unit tests with Vitest.npm run test:coverage: Generate a coverage report for the tests.npm run test:ui: Open the Vitest UI for managing and running tests interactively.
To securely encrypt sensitive files in this project using StackExchange Blackbox, follow these steps:
You can automatically install StackExchange Blackbox via the following commands:
git clone https://github.com/StackExchange/blackbox.git
cd blackbox
sudo make copy-installThis will copy the necessary files into /usr/local/bin.
The public and private Base64-encoded GPG keys are stored in the repository's "Secrets." Ask the project maintainer to share the keys with you if you do not have access yet.
You will receive:
- A Base64-encoded public key
- A Base64-encoded private key
Once you receive the Base64-encoded public key, use the following command to decode and import it:
echo "base64_encoded_public_key" | base64 --decode | gpg --import- Replace
base64_encoded_public_keywith the actual Base64-encoded string of the public key.
After importing the public key, you'll also need to import the private key for decryption purposes. To do that, use the following command:
echo "base64_encoded_private_key" | base64 --decode | gpg --import- Replace
base64_encoded_private_keywith the actual Base64-encoded string of the private key.
You can verify if both keys were successfully imported with the following command:
gpg --list-secret-keysThis will list the GPG keys on your system, and you should see both the public and private key associated with your GPG email.
With both the public and private keys imported, you can now decrypt the files in your project:
blackbox_decrypt_all_filesThis command will decrypt all files that were encrypted with Blackbox, using your imported GPG keys.