You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
4
+
5
+
Fixes # (issue)
6
+
7
+
## Type of change
8
+
9
+
Please delete options that are not relevant.
10
+
11
+
-[ ] Bug fix (non-breaking change which fixes an issue)
12
+
-[ ] New feature (non-breaking change which adds functionality)
13
+
-[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14
+
-[ ] This change requires a documentation update
15
+
16
+
## How Has This Been Tested?
17
+
18
+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
19
+
20
+
-[ ] Test A
21
+
-[ ] Test B
22
+
23
+
## Checklist:
24
+
25
+
-[ ] My code follows the style guidelines of this project
26
+
-[ ] I have performed a self-review of my own code
27
+
-[ ] I have commented my code, particularly in hard-to-understand areas
28
+
-[ ] I have made corresponding changes to the documentation
29
+
-[ ] My changes generate no new warnings
30
+
-[ ] I have added tests that prove my fix is effective or that my feature works
31
+
-[ ] New and existing unit tests pass locally with my changes
|**[ESLint](https://eslint.org/)**| Statically analyzes your code to quickly find and fix problems. It's configured with recommended rules to enforce best practices. |
15
+
|**[Prettier](https://prettier.io/)**| An opinionated code formatter that enforces a consistent style across your entire codebase, eliminating arguments over code style. |
16
+
|**[Jest](https://jestjs.io/)**| A delightful JavaScript Testing Framework with a focus on simplicity. It's set up and ready for you to write unit and integration tests. |
17
+
|**[Husky](https://typicode.github.io/husky/)**| Manages Git hooks to make it easy to run scripts at specific stages, like before a commit. |
18
+
|**[lint-staged](https://github.com/okonet/lint-staged)**| Works with Husky to run linters and formatters on your staged files *before* they are committed, ensuring no bad code gets in. |
19
+
|**[GitHub Actions](https://github.com/features/actions)**| Automates your workflow with two pre-configured CI pipelines for validating code on `main` and all other feature branches. |
8
20
9
-
-**Linting** with [ESLint](https://eslint.org/) to find and fix problems in your JavaScript code.
10
-
-**Formatting** with [Prettier](https://prettier.io/) for a consistent code style.
11
-
-**Testing** with [Jest](https://jestjs.io/) as the testing framework.
12
-
-**CI/CD** with [GitHub Actions](https://github.com/features/actions) to automate linting, formatting checks, and testing on every push and pull request.
13
-
-**Pre-commit Hooks** with [Husky](https://typicode.github.io/husky/) and [lint-staged](https://github.com/okonet/lint-staged) to lint and format your code before you even commit it.
14
21
15
22
## Getting Started
16
23
17
24
### Using as a Template
18
25
19
-
Click the "Use this template" button on the GitHub repository page to create a new repository with the same directory structure and files.
26
+
1. Click the **"Use this template"** button on the GitHub repository page.
27
+
2. Select **"Create a new repository"**.
28
+
3. Give your new repository a name and description.
29
+
4. Clone your new repository to your local machine.
This will install all dependencies and also run the `prepare` script, which sets up the Husky pre-commit hooks automatically.
40
+
41
+
3. Start coding!
29
42
30
-
2. Install dependencies:
31
-
```bash
32
-
npm install
33
-
```
34
43
35
44
## Available Scripts
36
45
@@ -44,19 +53,48 @@ In the project directory, you can run:
44
53
45
54
## How It Works
46
55
47
-
### Pre-commit Hook
56
+
### Pre-commit Hooks
57
+
58
+
This project uses `Husky` and `lint-staged` to run `eslint --fix` and `prettier --write` on staged `.js` files every time you make a commit. This automated quality gate ensures that no code that violates the style guide ever gets into the codebase.
59
+
60
+
If a file has linting or formatting errors, the tools will attempt to fix them automatically. If they can, the fixed code is what gets committed. If they can't, the commit is aborted so you can fix the issues manually.
61
+
62
+
63
+
### CI/CD Pipelines
64
+
65
+
This template includes two GitHub Actions workflows located in the `.github/workflows` directory:
66
+
67
+
1. **`ci.yml`**: This workflow runs on every push and pull request to the `main` branch. It acts as a final validation gate, ensuring that all tests, linting, and formatting checks pass before code is merged.
68
+
2. **`feature-branch-ci.yml`**: This workflow runs on all branches *except* `main`. It provides early feedback on feature branches, running the same set of checks to ensure quality throughout the development process.
69
+
70
+
Both workflows perform the following steps across multiple Node.js versions (18.x, 20.x):
71
+
72
+
1. **Install dependencies** using `npm ci` for fast, reliable installs.
73
+
2. **Lint code** with `npm run lint`.
74
+
3. **Check formatting** with `npm run format`.
75
+
4. **Run tests** with `npm test`.
76
+
77
+
## Customization
78
+
79
+
This template is a starting point. You can easily customize it to fit your project's needs:
80
+
81
+
- **Linting Rules**: Modify the `.eslintrc.js` file to add or change ESLint rules.
82
+
- **Formatting Options**: Adjust the `.prettierrc` file to change Prettier's formatting options.
83
+
- **Testing**: The `jest.config.js` file can be configured for more advanced testing scenarios.
84
+
- **CI/CD**: Edit the workflow files in `.github/workflows` to add new steps, such as deployment or notifications.
48
85
49
-
This project uses `husky` and `lint-staged` to run `eslint --fix` and `prettier --write` on staged `.js` files every time you make a commit. This ensures that no code that violates the style guide gets into the codebase.
86
+
## Contributing
50
87
51
-
After running `npm install`, the `prepare` script sets up the husky hooks.
88
+
Contributions are welcome! If you're using this template and have ideas for improvement, please feel free to open an issue or submit a pull request.
52
89
53
-
### CI Pipeline
90
+
1. **Fork** the repository.
91
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`).
92
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`).
93
+
4. Push to the branch (`git push origin feature/AmazingFeature`).
94
+
5. Open a **Pull Request**.
54
95
55
-
The `.github/workflows/ci.yml` file defines a GitHub Actions workflow that runs on every push and pull request to the `main` branch. It performs the following checks on Node.js 18.x and 20.x:
96
+
Please use the provided Pull Request and Issue templates.
56
97
57
-
1. Installs dependencies.
58
-
2. Runs `npm run lint` to check for linting errors.
59
-
3. Runs `npm run format` to check for formatting errors.
60
-
4. Runs `npm test` to execute the test suite.
98
+
## License
61
99
62
-
This ensures that all code inthe `main` branch is high quality and passes all checks.
100
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.
0 commit comments