Skip to content

Commit 13c870e

Browse files
committed
update 8 files
1 parent f234e81 commit 13c870e

File tree

8 files changed

+931
-22
lines changed

8 files changed

+931
-22
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ jobs:
2525
run: npm ci
2626
- name: Lint code
2727
run: npm run lint
28-
- name: Check formatting
29-
run: npm run format
3028
- name: Lint Markdown files
3129
run: npm run lint:md
30+
- name: Check formatting
31+
run: npm run format
3232
- name: Check Markdown formatting
3333
run: npm run format:md
34+
- name: Check Markdown links
35+
run: npm run check:links
36+
- name: Audit for vulnerabilities
37+
run: npm audit --production
3438
- name: Run tests
3539
run: npm test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ coverage/
1717
.env.local
1818
.env.development.local
1919
.env.test.local
20-
.env.production.local
20+
.env.production.local

.markdownlint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"MD013": false
2+
"MD013": false,
3+
"default": true
34
}

CODE_OF_CONDUCT.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,11 @@ representative at an online or offline event.
5959
## Enforcement
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62-
reported to the community leaders responsible for enforcement at
63-
<shytiger@yahoo.com>
64-
All complaints will be reviewed and investigated promptly and fairly.
62+
reported to the community leaders responsible for enforcement at [YOUR_PROJECT_CONTACT_EMAIL].
63+
_All complaints will be reviewed and investigated promptly and fairly_.
6564

6665
All community leaders are obligated to respect the privacy and security of the
67-
reporter of any incident.
66+
_reporter of any incident._
6867

6968
## Enforcement Guidelines
7069

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Please take a moment to review this document to understand our contribution guid
2020

2121
## Code of Conduct
2222

23-
This project and everyone participating in it is governed by the [js-quality-starter Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to <shytiger@yahoo.com>.
23+
This project and everyone participating in it is governed by the [js-quality-starter Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [YOUR_PROJECT_CONTACT_EMAIL].
24+
2425

2526
## How to Contribute
2627

README.md

Lines changed: 52 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# js-quality-starter
22

3+
[![Codecov](https://codecov.io/gh/YOUR_GITHUB_USERNAME/YOUR_REPO_NAME/branch/main/graph/badge.svg?token=YOUR_CODECOV_TOKEN)](https://codecov.io/gh/YOUR_GITHUB_USERNAME/YOUR_REPO_NAME)
4+
5+
6+
37
A template repository for modern JavaScript projects with pre-configured linting, formatting, testing, and CI/CD using GitHub Actions.
48

59
This template provides a solid foundation for any new JavaScript project, ensuring code quality and consistency from the start.
@@ -10,12 +14,13 @@ This template comes pre-configured with a suite of modern, industry-standard too
1014

1115
| Tool | Purpose |
1216
| :-------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- |
13-
| **[ESLint](https://eslint.org/)** | Statically analyzes your code to quickly find and fix problems. It's configured with recommended rules to enforce best practices. |
14-
| **[Prettier](https://prettier.io/)** | An opinionated code formatter that enforces a consistent style across your entire codebase, eliminating arguments over code style. |
15-
| **[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. |
16-
| **[Husky](https://typicode.github.io/husky/)** | Manages Git hooks to make it easy to run scripts at specific stages, like before a commit. |
17-
| **[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. |
18-
| **[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. |
17+
| **ESLint** | Statically analyzes your code to quickly find and fix problems. It's configured with recommended rules to enforce best practices. |
18+
| **Prettier** | An opinionated code formatter that enforces a consistent style across your entire codebase, eliminating arguments over code style. |
19+
| **Jest** | A delightful JavaScript Testing Framework with a focus on simplicity. It's set up and ready for you to write unit and integration tests. |
20+
| **markdownlint** | A linter for Markdown files to enforce consistent style and catch common errors in documentation. |
21+
| **Husky** | Manages Git hooks to make it easy to run scripts at specific stages, like before a commit. |
22+
| **lint-staged** | Works with Husky to run linters and formatters on your staged files _before_ they are committed, ensuring no bad code gets in. |
23+
| **GitHub Actions** | Automates your workflow with two pre-configured CI pipelines for validating code on `main` and all other feature branches. |
1924

2025
## Getting Started
2126

@@ -35,17 +40,23 @@ This template comes pre-configured with a suite of modern, industry-standard too
3540
cd your-new-repo
3641
```
3742

38-
This will install all dependencies and also run the `prepare` script, which sets up the Husky pre-commit hooks automatically.
43+
2. Install dependencies:
44+
```bash
45+
npm install
46+
```
47+
This will install all dependencies and also run the `prepare` script, which sets up the Husky pre-commit hooks automatically.
3948

40-
2. Start coding!
49+
3. Start coding!
4150

4251
### Post-Template Setup
4352

4453
After creating your repository from this template, be sure to:
4554

4655
1. **Update `package.json`**: Change the `name`, `description`, and `author` fields.
4756
2. **Update `LICENSE`**: Modify the `[year]` and `[fullname]` to reflect your project's ownership.
48-
3. **Update `CODE_OF_CONDUCT.md` and `CONTRIBUTING.md`**: Replace the `[INSERT CONTACT EMAIL ADDRESS]` placeholder with a valid project contact email.
57+
3. **Update `CODE_OF_CONDUCT.md` and `CONTRIBUTING.md`**: Replace the `[YOUR_PROJECT_CONTACT_EMAIL]` placeholder with a valid project contact email.
58+
59+
4960
5061
## Available Scripts
5162
@@ -56,6 +67,8 @@ In the project directory, you can run:
5667
- `npm run lint:fix`: Lints and automatically fixes fixable issues.
5768
- `npm run format`: Checks for formatting issues with Prettier.
5869
- `npm run format:fix`: Formats all supported files with Prettier.
70+
- `npm run lint:md`: Lints all Markdown files.
71+
- `npm run lint:md:fix`: Lints and automatically fixes fixable issues in Markdown files.
5972
- `npm run format:md`: Checks for formatting issues with Prettier for Markdown files.
6073
- `npm run format:md:fix`: Formats all Markdown files with Prettier.
6174
@@ -78,23 +91,49 @@ Both workflows perform the following steps across multiple Node.js versions (18.
7891

7992
1. **Install dependencies** using `npm ci` for fast, reliable installs.
8093
2. **Lint code** with `npm run lint`.
81-
3. **Check Markdown formatting** with `npm run format:md`.
82-
4. **Check formatting** with `npm run format`.
83-
5. **Run tests** with `npm test`.
94+
3. **Lint Markdown files** with `npm run lint:md`.
95+
4. **Check code formatting** with `npm run format`.
96+
5. **Check Markdown formatting** with `npm run format:md`.
97+
6. **Check for broken links** in Markdown with `npm run check:links`.
98+
7. **Audit for vulnerabilities** with `npm audit --production`.
99+
8. **Run tests** with `npm test`.
100+
101+
84102

85103
## Customization
86104

87105
This template is a starting point. You can easily customize it to fit your project's needs:
88106
89107
- **Linting Rules**: Modify the `.eslintrc.js` file to add or change ESLint rules.
90108
- **Formatting Options**: Adjust the `.prettierrc` file to change Prettier's formatting options.
109+
- **Markdown Linting**: Customize `markdownlint` rules by editing the `.markdownlint.json` file.
91110
- **Testing**: The `jest.config.js` file can be configured for more advanced testing scenarios.
92111
- **CI/CD**: Edit the workflow files in `.github/workflows` to add new steps, such as deployment or notifications.
93112

113+
## Code Coverage
114+
115+
This template is configured to generate code coverage reports using Jest. The reports are output to the `coverage/` directory in various formats, including `lcov`, which is compatible with popular code coverage services.
116+
117+
To get a dynamic code coverage badge like the one at the top of this `README.md`, you can integrate with a service like Codecov or Coveralls.
118+
119+
**Steps to set up Codecov (example):**
120+
1. Sign up for Codecov with your GitHub account.
121+
2. Add your repository to Codecov.
122+
3. Codecov will provide you with a `CODECOV_TOKEN`. Add this token as a secret in your GitHub repository settings (e.g., `CODECOV_TOKEN`).
123+
4. Add a step to your CI workflow (`.github/workflows/ci.yml`) to upload the coverage report to Codecov. This typically involves adding a step like:
124+
```yaml
125+
- name: Upload coverage to Codecov
126+
uses: codecov/codecov-action@v4
127+
with:
128+
token: ${{ secrets.CODECOV_TOKEN }}
129+
```
130+
5. Update the badge URL in `README.md` with your specific repository details and token (if required by Codecov for public repos, though often not for public repos).
131+
132+
94133
## Contributing
95134

96135
We welcome contributions! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines on how to contribute, report bugs, and suggest enhancements.
97136

98137
## License
99138

100-
This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.
139+
This project is licensed under the [LICENSE](LICENSE.md) file for details.

0 commit comments

Comments
 (0)