Skip to content

Commit 6c16f33

Browse files
committed
feat(docs): add comprehensive documentation and markdown linting setup
- Add new documentation files covering CI, contributing, image processing, linting, lockfile management, markdown linting, node version, and package manager - Set up markdown linting with markdownlint-cli2 and configuration files - Update CI workflow to include markdown linting - Add scripts for testing CI locally - Update README with links to new documentation
1 parent db50437 commit 6c16f33

20 files changed

+618
-26
lines changed

.github/workflows/lint.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,10 @@ jobs:
3939
run: pnpm biome format .
4040

4141
- name: Run linting
42-
run: pnpm biome check .
42+
run: pnpm biome check .
43+
44+
- name: Lint Markdown files
45+
run: pnpm lint:md
46+
47+
- name: Run all linting checks (combined)
48+
run: pnpm lint

.lintstagedrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"*.{js,jsx,ts,tsx}": ["biome check --write", "biome format --write"],
3-
"*.astro": ["biome check --write", "biome format --write"]
3+
"*.astro": ["biome check --write", "biome format --write"],
4+
"*.md": ["markdownlint-cli2 --fix"]
45
}

.markdownlint-cli2.jsonc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"config": {
3+
"extends": ".markdownlint.json",
4+
"MD013": false,
5+
"MD012": false,
6+
"MD047": false
7+
},
8+
"globs": ["**/*.md"],
9+
"ignores": ["node_modules/**", "**/node_modules/**", "README.md"],
10+
"fix": false,
11+
"noProgress": true,
12+
"customRules": [],
13+
"markdownItPlugins": []
14+
}

.markdownlint.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"default": true,
3+
"MD013": false,
4+
"MD033": false,
5+
"MD041": false,
6+
"MD046": { "style": "fenced" },
7+
"MD024": false,
8+
"MD025": { "front_matter_title": "" },
9+
"MD029": false,
10+
"MD012": false,
11+
"MD047": false,
12+
"MD032": false,
13+
"MD031": false,
14+
"MD001": false,
15+
"MD009": false,
16+
"MD026": false,
17+
"MD040": false,
18+
"MD007": false
19+
}

.markdownlintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore main README.md which has special formatting for badges and alignment
2+
README.md
3+
4+
# Ignore node_modules
5+
node_modules/

README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Frontend Tools Explorer is a curated collection of essential tools, libraries, a
5050
- v22 LTS (v22.0.0 or newer, also supported v22.17.0)
5151
- pnpm (v8.0.0 or newer)
5252

53-
> **Note:** This project requires specific Node.js and package manager versions. For more details, see [PACKAGE-MANAGER.md](./PACKAGE-MANAGER.md) and [NODE-VERSION.md](./NODE-VERSION.md).
53+
> **Note:** This project requires specific Node.js and package manager versions. For more details, see [PACKAGE-MANAGER.md](./docs/PACKAGE-MANAGER.md) and [NODE-VERSION.md](./docs/NODE-VERSION.md).
5454
5555
### Installation
5656

@@ -78,7 +78,7 @@ Frontend Tools Explorer is a curated collection of essential tools, libraries, a
7878
# If needed, install the LTS version from nodejs.org
7979
```
8080

81-
> **Note:** This project requires pnpm as the package manager. We recommend using Corepack (built into Node.js 20+) to manage pnpm. See [PACKAGE-MANAGER.md](./PACKAGE-MANAGER.md) for more details and troubleshooting.
81+
> **Note:** This project requires pnpm as the package manager. We recommend using Corepack (built into Node.js 20+) to manage pnpm. See [PACKAGE-MANAGER.md](./docs/PACKAGE-MANAGER.md) for more details and troubleshooting.
8282
8383
3. Start the development server
8484

@@ -109,23 +109,43 @@ To add a new frontend tool to the directory:
109109
3. Import and add your tool to the array in `src/data/tools/index.ts`
110110
4. Submit a pull request
111111

112-
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for detailed contribution guidelines.
112+
Please see [CONTRIBUTING.md](./docs/CONTRIBUTING.md) for detailed contribution guidelines.
113+
114+
## 📚 Documentation
115+
116+
All project documentation is available in the [docs](./docs) directory. This includes:
117+
118+
- [Contributing Guidelines](./docs/CONTRIBUTING.md)
119+
- [CI Setup](./docs/CI.md)
120+
- [Linting and Formatting](./docs/LINTING.md)
121+
- [Markdown Linting](./docs/MARKDOWN-LINTING.md)
122+
- [Package Manager Configuration](./docs/PACKAGE-MANAGER.md)
123+
- [Node.js Version Requirements](./docs/NODE-VERSION.md)
124+
- [Lockfile Management](./docs/LOCKFILE-MANAGEMENT.md)
125+
- [Image Processing](./docs/IMAGE-PROCESSING.md)
113126

114127
## 🔄 Continuous Integration
115128

116129
This project uses GitHub Actions for continuous integration to ensure code quality. The CI workflow automatically runs linting and formatting checks on every pull request and push to the main branch.
117130

118-
For more details on the CI setup, troubleshooting common issues, and best practices, see [CI.md](./CI.md).
131+
You can test the CI workflow locally before pushing changes:
132+
133+
```sh
134+
# Run the CI test script
135+
./scripts/test-ci.sh
136+
```
137+
138+
For more details on the CI setup, troubleshooting common issues, and best practices, see [CI.md](./docs/CI.md).
119139

120140
### Dependency Management
121141

122-
This project uses pnpm for dependency management and requires proper lockfile handling, especially in CI environments. For guidance on managing the lockfile and resolving common issues, see [LOCKFILE-MANAGEMENT.md](./LOCKFILE-MANAGEMENT.md).
142+
This project uses pnpm for dependency management and requires proper lockfile handling, especially in CI environments. For guidance on managing the lockfile and resolving common issues, see [LOCKFILE-MANAGEMENT.md](./docs/LOCKFILE-MANAGEMENT.md).
123143

124144
## 🖼️ Image Processing
125145

126146
This project uses Astro's built-in image optimization with Sharp for processing images. Sharp is required for both local development and Vercel deployment.
127147

128-
For more details on image processing configuration, troubleshooting, and best practices, see [IMAGE-PROCESSING.md](./IMAGE-PROCESSING.md).
148+
For more details on image processing configuration, troubleshooting, and best practices, see [IMAGE-PROCESSING.md](./docs/IMAGE-PROCESSING.md).
129149

130150
## 📝 License
131151

CI.md renamed to docs/CI.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ The CI workflow is defined in `.github/workflows/lint.yml` and performs the foll
1010

1111
1. **Checkout Code**: Fetches the repository code with full history for proper lockfile validation
1212
2. **Setup pnpm**: Installs the pnpm package manager (version 8.15.4)
13-
3. **Setup Node.js**: Configures Node.js environment (version 22.17.0 LTS) with pnpm caching
13+
3. **Setup Node.js**: Configures Node.js environment with both Node.js v20 LTS and v22 LTS using a matrix strategy
1414
4. **Install Dependencies**: Installs project dependencies using pnpm
1515
5. **Check Formatting**: Verifies code formatting using Biome with `pnpm biome format .`
16-
6. **Run Linting**: Performs code linting using Biome with `pnpm biome check .`
16+
6. **Run JavaScript/TypeScript Linting**: Performs code linting using Biome with `pnpm biome check .`
17+
7. **Run Markdown Linting**: Checks markdown files with `pnpm lint:md`
18+
8. **Run Combined Linting**: Executes all linting checks with `pnpm lint`
1719

1820
## Important Notes on Dependency Management
1921

@@ -56,11 +58,66 @@ If you encounter dependency-related issues in CI:
5658

5759
For more detailed guidance on lockfile management and troubleshooting, see [LOCKFILE-MANAGEMENT.md](./LOCKFILE-MANAGEMENT.md).
5860

61+
## Testing CI Locally
62+
63+
Before pushing changes to CI configuration or code that might affect CI, it's recommended to test the workflow locally:
64+
65+
### Using the Test Script
66+
67+
We provide a convenient script to test the CI workflow locally:
68+
69+
```bash
70+
# Make the script executable (if needed)
71+
chmod +x scripts/test-ci.sh
72+
73+
# Run the test script
74+
./scripts/test-ci.sh
75+
```
76+
77+
This script will:
78+
1. Run all the individual commands from the CI workflow
79+
2. Optionally run the entire GitHub Actions workflow locally using `act`
80+
81+
### Manual Testing
82+
83+
If you prefer to test manually, follow these steps:
84+
85+
1. **Run the same commands locally** that are executed in the CI workflow:
86+
```bash
87+
# Install dependencies (same as CI)
88+
pnpm install --no-frozen-lockfile
89+
90+
# Check formatting
91+
pnpm biome format .
92+
93+
# Run JavaScript/TypeScript linting
94+
pnpm lint:js
95+
96+
# Lint Markdown files
97+
pnpm lint:md
98+
99+
# Run all linting checks at once
100+
pnpm lint
101+
```
102+
103+
2. **Test with multiple Node.js versions** if possible:
104+
- Use a version manager like nvm to switch between Node.js versions
105+
- Test with both Node.js v20 LTS and v22 LTS as specified in the CI matrix
106+
107+
3. **Use GitHub Actions local runners** for more comprehensive testing:
108+
- [act](https://github.com/nektos/act) allows running GitHub Actions workflows locally
109+
- Install with: `brew install act` (on macOS)
110+
- Run with: `act -j lint` to execute the lint job
111+
112+
4. **Validate workflow files** for syntax errors:
113+
- Use the [GitHub Actions Workflow Validator](https://github.com/marketplace/actions/workflow-validator) or online tools
114+
59115
## Best Practices
60116

61117
1. Always commit the `pnpm-lock.yaml` file to ensure consistent dependencies
62118
2. Use the same Node.js and pnpm versions locally as specified in the CI workflow
63119
3. Avoid manually editing the lockfile
64120
4. When adding new dependencies, update the lockfile by running `pnpm install` and commit the changes
65121
5. Use `pnpm install --no-frozen-lockfile` in CI environments to prevent lockfile-related failures
66-
6. If you're experiencing CI failures related to the lockfile, try removing the `--frozen-lockfile` flag in your local environment
122+
6. If you're experiencing CI failures related to the lockfile, try removing the `--frozen-lockfile` flag in your local environment
123+
7. Always test CI workflow changes locally before pushing to the repository

CONTRIBUTING.md renamed to docs/CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ export const toolName: Tool = {
113113

114114
4. Open your browser and visit `http://localhost:4321`
115115

116+
5. Test your changes locally before submitting a PR
117+
```sh
118+
# Run linting checks
119+
pnpm lint
120+
121+
# Test CI workflow locally
122+
./scripts/test-ci.sh
123+
```
124+
125+
> For more details on testing CI locally, see [CI.md](./CI.md#testing-ci-locally).
126+
116127
## Style Guidelines
117128

118129
### Code Style
File renamed without changes.

LINTING.md renamed to docs/LINTING.md

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ biome format --write .
3434

3535
## Features Summary
3636

37-
| Feature | Biome |
38-
|---------|-------|
39-
| Linting ||
40-
| Formatting ||
41-
| Astro Support | ⚠️ (partial) |
42-
| Performance | Very Fast |
43-
| Editor Integration ||
44-
| Configuration | `biome.json` |
37+
| Feature | Biome | markdownlint-cli2 |
38+
|---------|-------|------------------|
39+
| Linting |||
40+
| Formatting |||
41+
| Astro Support | ⚠️ (partial) | N/A |
42+
| Markdown Support |||
43+
| Performance | Very Fast | Fast |
44+
| Editor Integration |||
45+
| Configuration | `biome.json` | `.markdownlint.json` |
4546

4647
## Automated Checks with Husky and lint-staged
4748

@@ -61,13 +62,15 @@ The lint-staged configuration is in `.lintstagedrc.json`:
6162
```json
6263
{
6364
"*.{js,jsx,ts,tsx}": ["biome check --write", "biome format --write"],
64-
"*.astro": ["biome check --write", "biome format --write"]
65+
"*.astro": ["biome check --write", "biome format --write"],
66+
"*.md": ["markdownlint-cli2 --fix"]
6567
}
6668
```
6769

6870
This ensures that:
6971
- JavaScript and TypeScript files are linted and formatted
7072
- Astro files are linted and formatted (to the extent supported by Biome)
73+
- Markdown files are linted and automatically fixed when possible
7174

7275
### Benefits
7376

@@ -84,25 +87,55 @@ This project uses **Biome** as the linting and formatting tool because:
8487
3. It offers a Prettier-compatible formatter
8588
4. It provides excellent performance for JavaScript and TypeScript projects
8689

90+
## Markdown Linting with markdownlint-cli2
91+
92+
In addition to Biome, this project uses [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) to lint and format Markdown documentation files.
93+
94+
### Features
95+
96+
- **Consistent formatting** across all markdown files
97+
- **Automated fixes** for common issues
98+
- **Pre-commit checks** to ensure documentation quality
99+
- **CI integration** to verify documentation in pull requests
100+
101+
### Usage
102+
103+
```bash
104+
# Check markdown files for issues
105+
pnpm lint:md
106+
107+
# Fix markdown issues automatically where possible
108+
pnpm lint:md:fix
109+
```
110+
111+
For more details on the markdown linting setup, see [MARKDOWN-LINTING.md](./MARKDOWN-LINTING.md).
112+
87113
## Installation
88114

89-
Biome is already installed as a dev dependency in this project. You can use it directly through the npm scripts or via the `biome` command:
115+
Biome and markdownlint-cli2 are already installed as dev dependencies in this project. You can use them directly through the npm scripts or via their respective commands:
90116

91117
```bash
92-
# Using npm scripts
118+
# Using npm scripts for Biome
93119
pnpm lint
94120
pnpm format
95121
pnpm check
96122

123+
# Using npm scripts for markdownlint
124+
pnpm lint:md
125+
pnpm lint:md:fix
126+
97127
# Or directly
98128
pnpm biome check .
99129
pnpm biome format .
130+
pnpm markdownlint-cli2 "**/*.md"
131+
pnpm markdownlint-cli2 --fix "**/*.md"
100132
```
101133

102134
## Editor Integration
103135

104-
Biome offers a VS Code extension for editor integration:
136+
Both Biome and markdownlint offer VS Code extensions for editor integration:
105137

106138
- [Biome VS Code Extension](https://marketplace.visualstudio.com/items?itemName=biomejs.biome)
139+
- [markdownlint VS Code Extension](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint)
107140

108-
The project's `.vscode/settings.json` is already configured to use Biome when it's installed.
141+
The project's `.vscode/settings.json` is already configured to use Biome when it's installed. The markdownlint extension will automatically use the project's `.markdownlint.json` configuration.

0 commit comments

Comments
 (0)