Skip to content

Commit 93c043f

Browse files
authored
feat(docs): add code of conduct and contribution guide (#23)
1 parent 1cd7d1b commit 93c043f

File tree

3 files changed

+323
-0
lines changed

3 files changed

+323
-0
lines changed

CODE_OF_CONDUCT.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Contributor Covenant 3.0 Code of Conduct
2+
3+
## Our Pledge
4+
5+
We pledge to make our community welcoming, safe, and equitable for all.
6+
7+
We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all individuals, regardless of characteristics including race, ethnicity, caste, color, age, physical characteristics, neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or religion, national or social origin, socio-economic position, level of education, or other status. The same privileges of participation are extended to everyone who participates in good faith and in accordance with this Covenant.
8+
9+
## Encouraged Behaviors
10+
11+
While acknowledging differences in social norms, we all strive to meet our community's expectations for positive behavior. We also understand that our words and actions may be interpreted differently than we intend based on culture, background, or native language.
12+
13+
With these considerations in mind, we agree to behave mindfully toward each other and act in ways that center our shared values, including:
14+
15+
1. Respecting the **purpose of our community**, our activities, and our ways of gathering.
16+
2. Engaging **kindly and honestly** with others.
17+
3. Respecting **different viewpoints** and experiences.
18+
4. **Taking responsibility** for our actions and contributions.
19+
5. Gracefully giving and accepting **constructive feedback**.
20+
6. Committing to **repairing harm** when it occurs.
21+
7. Behaving in other ways that promote and sustain the **well-being of our community**.
22+
23+
## Restricted Behaviors
24+
25+
We agree to restrict the following behaviors in our community. Instances, threats, and promotion of these behaviors are violations of this Code of Conduct.
26+
27+
1. **Harassment.** Violating explicitly expressed boundaries or engaging in unnecessary personal attention after any clear request to stop.
28+
2. **Character attacks.** Making insulting, demeaning, or pejorative comments directed at a community member or group of people.
29+
3. **Stereotyping or discrimination.** Characterizing anyone’s personality or behavior on the basis of immutable identities or traits.
30+
4. **Sexualization.** Behaving in a way that would generally be considered inappropriately intimate in the context or purpose of the community.
31+
5. **Violating confidentiality**. Sharing or acting on someone's personal or private information without their permission.
32+
6. **Endangerment.** Causing, encouraging, or threatening violence or other harm toward any person or group.
33+
7. Behaving in other ways that **threaten the well-being** of our community.
34+
35+
### Other Restrictions
36+
37+
1. **Misleading identity.** Impersonating someone else for any reason, or pretending to be someone else to evade enforcement actions.
38+
2. **Failing to credit sources.** Not properly crediting the sources of content you contribute.
39+
3. **Promotional materials**. Sharing marketing or other commercial content in a way that is outside the norms of the community.
40+
4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other restricted behaviors.
41+
42+
## Reporting an Issue
43+
44+
Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviors and norms that can help avoid conflicts and minimize harm.
45+
46+
When an incident does occur, it is important to report it promptly. To report a possible violation, contact the project stewards (@9romise and @danielroe) by DM in our community chat. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project stewards are obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
47+
48+
Community Moderators take reports of violations seriously and will make every effort to respond in a timely manner. They will investigate all reports of code of conduct violations, reviewing messages, logs, and recordings, or interviewing witnesses and other participants. Community Moderators will keep investigation and enforcement actions as transparent as possible while prioritizing safety and confidentiality. In order to honor these values, enforcement actions are carried out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon resolution.
49+
50+
## Addressing and Repairing Harm
51+
52+
If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped.
53+
54+
1. Warning
55+
1. Event: A violation involving a single incident or series of incidents.
56+
2. Consequence: A private, written warning from the Community Moderators.
57+
3. Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations.
58+
2. Temporarily Limited Activities
59+
1. Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation.
60+
2. Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members.
61+
3. Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over.
62+
3. Temporary Suspension
63+
1. Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a single serious violation.
64+
2. Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions.
65+
3. Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted.
66+
4. Permanent Ban
67+
1. Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member.
68+
2. Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior.
69+
3. Repair: There is no possible repair in cases of this severity.
70+
71+
This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their discretion and judgment, in keeping with the best interests of our community.
72+
73+
## Scope
74+
75+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public or other spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
76+
77+
## Attribution
78+
79+
This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/).
80+
81+
Contributor Covenant is stewarded by the Organization for Ethical Source and licensed under CC BY-SA 4.0. To view a copy of this license, visit [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/)
82+
83+
For answers to common questions about Contributor Covenant, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are provided at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). Additional enforcement and community guideline resources can be found at [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources). The enforcement ladder was inspired by the work of [Mozilla’s code of conduct team](https://github.com/mozilla/inclusion).

CONTRIBUTING.md

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
# Contributing to vscode-npmx
2+
3+
Thank you for your interest in contributing! ❤️ This document provides guidelines and instructions for contributing.
4+
5+
> [!IMPORTANT]
6+
> Please be respectful and constructive in all interactions. We aim to maintain a welcoming environment for all contributors.
7+
> [👉 Read more](./CODE_OF_CONDUCT.md)
8+
9+
## Goals
10+
11+
The goal of [vscode-npmx](https://marketplace.visualstudio.com/items?itemName=npmx-dev.vscode-npmx) is to build a useful extension around [npmx.dev](https://npmx.dev), making it easier for developers to manage npm packages within VS Code.
12+
13+
## Table of Contents
14+
15+
- [Getting started](#getting-started)
16+
- [Prerequisites](#prerequisites)
17+
- [Setup](#setup)
18+
- [Development workflow](#development-workflow)
19+
- [Available commands](#available-commands)
20+
- [Project structure](#project-structure)
21+
- [Code style](#code-style)
22+
- [TypeScript](#typescript)
23+
- [Import order](#import-order)
24+
- [Naming conventions](#naming-conventions)
25+
- [Testing](#testing)
26+
- [Unit tests](#unit-tests)
27+
- [Submitting changes](#submitting-changes)
28+
- [Before submitting](#before-submitting)
29+
- [Pull request process](#pull-request-process)
30+
- [Commit messages and PR titles](#commit-messages-and-pr-titles)
31+
- [Pre-commit hooks](#pre-commit-hooks)
32+
- [Using AI](#using-ai)
33+
- [Questions](#questions)
34+
- [License](#license)
35+
36+
## Getting started
37+
38+
### Prerequisites
39+
40+
- [Node.js](https://nodejs.org/) (LTS version recommended)
41+
- [pnpm](https://pnpm.io/) v10.28.1 or later
42+
43+
### Setup
44+
45+
1. fork and clone the repository
46+
2. install dependencies:
47+
48+
```bash
49+
pnpm install
50+
```
51+
52+
3. start the development server:
53+
54+
```bash
55+
pnpm dev
56+
```
57+
58+
4. Press `F5` to open the VS Code debugger and start the extension in a new VS Code window.
59+
60+
## Development workflow
61+
62+
### Available commands
63+
64+
```bash
65+
# Development
66+
pnpm dev # Start development server
67+
pnpm build # Production build
68+
pnpm package # Save extension as vsix file to root
69+
70+
# Code Quality
71+
pnpm lint # Run linter (oxlint + oxfmt)
72+
pnpm lint:fix # Auto-fix lint issues
73+
pnpm typecheck # TypeScript type checking
74+
75+
# Testing
76+
pnpm test # Run tests
77+
```
78+
79+
### Project structure
80+
81+
```
82+
playground/ # Playground for testing
83+
res/ # Assets (e.g. marketplace icon)
84+
src/ # Extension source code
85+
├── extractors/ # Extractors
86+
├── providers/ # Providers
87+
├── types/ # TypeScript types
88+
├── utils/ # Utility functions
89+
├── constants.ts # Constants
90+
├── state.ts # State management
91+
└── index.ts # Extension entry point
92+
tests/ # Tests
93+
```
94+
95+
## Code style
96+
97+
When committing changes, try to keep an eye out for unintended formatting updates. These can make a pull request look noisier than it really is and slow down the review process. Sometimes IDEs automatically reformat files on save, which can unintentionally introduce extra changes.
98+
99+
If you want to get ahead of any formatting issues, you can also run `pnpm lint:fix` before committing to fix formatting across the whole project.
100+
101+
### TypeScript
102+
103+
- We care about good types – never cast things to `any` 💪
104+
- Validate rather than just assert
105+
106+
### Import order
107+
108+
1. Type imports first (`import type { ... }`)
109+
2. Internal aliases (`#constants`, `#utils/`, etc.)
110+
3. External packages (including `node:`)
111+
4. Relative imports (`./`, `../`)
112+
5. No blank lines between groups
113+
114+
```typescript
115+
import type { PackageVersionsInfoWithMetadata } from 'fast-npm-meta'
116+
import { logger } from '#state'
117+
import { getVersions } from 'fast-npm-meta'
118+
import { memoize } from '../memoize'
119+
```
120+
121+
### Naming conventions
122+
123+
| Type | Convention | Example |
124+
| ---------------- | -------------------- | --------------------------------------------- |
125+
| Files/Folders | kebab-case | `package-json.ts`, `pnpm-workspace-yaml.ts` |
126+
| Test files | kebab-case + `.test` | `memoize.test.ts` |
127+
| Functions | camelCase | `fetchPackage`, `formatDate` |
128+
| Constants | SCREAMING_SNAKE_CASE | `NPM_REGISTRY`, `ALLOWED_TAGS` |
129+
| Types/Interfaces | PascalCase | `NpmSearchResponse`, `Extractor`, `ValidNode` |
130+
131+
## Testing
132+
133+
### Unit tests
134+
135+
Write unit tests for core functionality using Vitest:
136+
137+
```typescript
138+
import { describe, it, expect } from 'vitest'
139+
140+
describe('featureName', () => {
141+
it('should handle expected case', () => {
142+
expect(result).toBe(expected)
143+
})
144+
})
145+
```
146+
147+
## Submitting changes
148+
149+
### Before submitting
150+
151+
1. ensure your code follows the style guidelines
152+
2. run linting: `pnpm lint:fix`
153+
3. run type checking: `pnpm typecheck`
154+
4. run tests: `pnpm test`
155+
5. write or update tests for your changes
156+
157+
### Pull request process
158+
159+
1. create a feature branch from `main`
160+
2. make your changes with clear, descriptive commits
161+
3. push your branch and open a pull request
162+
4. ensure CI checks pass (lint, type check, tests)
163+
5. request review from maintainers
164+
165+
### Commit messages and PR titles
166+
167+
Write clear, concise PR titles that explain the "why" behind changes.
168+
169+
We use [Conventional Commits](https://www.conventionalcommits.org/). Since we squash on merge, the PR title becomes the commit message in `main`, so it's important to get it right.
170+
171+
Format: `type(scope): description`
172+
173+
**Types:** `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
174+
175+
**Scopes (optional):** `docs`, `i18n`, `deps`
176+
177+
**Examples:**
178+
179+
- `fix: resolve search pagination issue`
180+
- `feat: add package version comparison`
181+
- `fix(i18n): update French translations`
182+
- `chore(deps): update vite to v6`
183+
184+
> [!NOTE]
185+
> The subject must start with a lowercase letter. Individual commit messages within your PR don't need to follow this format since they'll be squashed.
186+
187+
### PR descriptions
188+
189+
If your pull request directly addresses an open issue, use the following inside your PR description.
190+
191+
```text
192+
Resolves | Fixes | Closes: #xxx
193+
```
194+
195+
Replace `#xxx` with either a URL to the issue, or the number of the issue. For example:
196+
197+
```text
198+
Fixes:#123
199+
```
200+
201+
or
202+
203+
```text
204+
Closes https://github.com/npmx-dev/vscode-npmx/issues/123
205+
```
206+
207+
This provides the following benefits:
208+
209+
- it links the pull request to the issue (the merge icon will appear in the issue), so everybody can see there is an open PR
210+
- when the pull request is merged, the linked issue is automatically closed
211+
212+
## Pre-commit hooks
213+
214+
The project uses `nano-staged` with `husky` to automatically lint files on commit.
215+
216+
## Using AI
217+
218+
You're welcome to use AI tools to help you contribute. But there are two important ground rules:
219+
220+
### 1. Never let an LLM speak for you
221+
222+
When you write a comment, issue, or PR description, use your own words. Grammar and spelling don't matter – real connection does. AI-generated summaries tend to be long-winded, dense, and often inaccurate. Simplicity is an art. The goal is not to sound impressive, but to communicate clearly.
223+
224+
### 2. Never let an LLM think for you
225+
226+
Feel free to use AI to write code, tests, or point you in the right direction. But always understand what it's written before contributing it. Take personal responsibility for your contributions. Don't say "ChatGPT says..." – tell us what _you_ think.
227+
228+
For more context, see [Using AI in open source](https://roe.dev/blog/using-ai-in-open-source).
229+
230+
## Questions?
231+
232+
If you have questions or need help, feel free to open an issue for discussion or join our [Discord server](https://chat.npmx.dev).
233+
234+
## License
235+
236+
By contributing to vscode-npmx, you agree that your contributions will be licensed under the [MIT License](LICENSE).

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242

4343
<!-- configs -->
4444

45+
## Contributing
46+
47+
Contributions are welcome! Please review our [contribution guide](./CONTRIBUTING.md) for more details.
48+
4549
## License
4650

4751
[MIT](./LICENSE) License &copy; 2026-PRESENT [Vida Xie](https://github.com/9romise)

0 commit comments

Comments
 (0)