Skip to content

Commit ee9d004

Browse files
committed
docs: add community health files
- CONTRIBUTING.md with development setup and guidelines - CODE_OF_CONDUCT.md (Contributor Covenant v2) - SECURITY.md with vulnerability disclosure process
1 parent dcacca8 commit ee9d004

File tree

3 files changed

+306
-0
lines changed

3 files changed

+306
-0
lines changed

CODE_OF_CONDUCT.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
[s.werner@sebastian-software.de](mailto:s.werner@sebastian-software.de).
64+
65+
All complaints will be reviewed and investigated promptly and fairly.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Attribution
71+
72+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
73+
version 2.0, available at
74+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
75+
76+
[homepage]: https://www.contributor-covenant.org
77+

CONTRIBUTING.md

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# Contributing to eslint-plugin-lingui-typescript
2+
3+
First off, thanks for taking the time to contribute! 🎉
4+
5+
## Development Setup
6+
7+
### Prerequisites
8+
9+
- Node.js ≥ 24
10+
- npm
11+
12+
### Getting Started
13+
14+
```bash
15+
# Clone the repository
16+
git clone https://github.com/sebastian-software/eslint-plugin-lingui-typescript.git
17+
cd eslint-plugin-lingui-typescript
18+
19+
# Install dependencies
20+
npm install
21+
22+
# Run tests
23+
npm test
24+
25+
# Run linting
26+
npm run lint
27+
28+
# Type check
29+
npm run typecheck
30+
```
31+
32+
## Project Structure
33+
34+
```
35+
src/
36+
├── index.ts # Plugin entry point
37+
├── rules/ # ESLint rule implementations
38+
│ ├── rule-name.ts # Rule implementation
39+
│ └── rule-name.test.ts # Rule tests (co-located)
40+
└── utils/ # Shared utilities
41+
└── create-rule.ts # Rule factory helper
42+
```
43+
44+
## Adding a New Rule
45+
46+
1. Create the rule file: `src/rules/my-new-rule.ts`
47+
2. Create the test file: `src/rules/my-new-rule.test.ts`
48+
3. Export the rule from `src/index.ts`
49+
4. Add documentation: `docs/rules/my-new-rule.md`
50+
5. Update `README.md` with the new rule
51+
52+
### Rule Template
53+
54+
```typescript
55+
import { createRule } from "../utils/create-rule.js"
56+
57+
type MessageId = "myMessageId"
58+
59+
export const myNewRule = createRule<[], MessageId>({
60+
name: "my-new-rule",
61+
meta: {
62+
type: "suggestion",
63+
docs: {
64+
description: "Description of what the rule does"
65+
},
66+
messages: {
67+
myMessageId: "Error message shown to users"
68+
},
69+
schema: []
70+
},
71+
defaultOptions: [],
72+
create(context) {
73+
return {
74+
// AST visitor methods
75+
}
76+
}
77+
})
78+
```
79+
80+
## Code Style
81+
82+
- **TypeScript**: All code must be written in TypeScript
83+
- **Prettier**: Code is auto-formatted with Prettier
84+
- **ESLint**: Follow the project's ESLint configuration
85+
- **No semicolons**: We use ASI (automatic semicolon insertion)
86+
- **Double quotes**: Use double quotes for strings
87+
88+
The pre-commit hook will automatically format and lint your code.
89+
90+
## Commit Messages
91+
92+
We use [Conventional Commits](https://www.conventionalcommits.org/):
93+
94+
```
95+
feat(rule-name): add new feature
96+
fix(rule-name): fix bug description
97+
docs: update documentation
98+
refactor: improve code structure
99+
test: add missing tests
100+
chore: update dependencies
101+
```
102+
103+
## Testing
104+
105+
```bash
106+
# Run all tests
107+
npm test
108+
109+
# Run tests in watch mode
110+
npm run test:watch
111+
112+
# Run a specific test file
113+
npm test -- src/rules/my-rule.test.ts
114+
```
115+
116+
### Writing Tests
117+
118+
Tests use `@typescript-eslint/rule-tester` with Vitest:
119+
120+
```typescript
121+
import { RuleTester } from "@typescript-eslint/rule-tester"
122+
import { afterAll, describe, it } from "vitest"
123+
import { myRule } from "./my-rule.js"
124+
125+
RuleTester.afterAll = afterAll
126+
RuleTester.describe = describe
127+
RuleTester.it = it
128+
129+
const ruleTester = new RuleTester({
130+
languageOptions: {
131+
parserOptions: {
132+
projectService: {
133+
allowDefaultProject: ["*.ts", "*.tsx"]
134+
},
135+
tsconfigRootDir: import.meta.dirname
136+
}
137+
}
138+
})
139+
140+
ruleTester.run("my-rule", myRule, {
141+
valid: [
142+
// Valid code examples
143+
],
144+
invalid: [
145+
// Invalid code examples with expected errors
146+
]
147+
})
148+
```
149+
150+
## Pull Request Process
151+
152+
1. Fork the repository and create your branch from `main`
153+
2. Make your changes and add tests
154+
3. Ensure all tests pass: `npm test`
155+
4. Ensure linting passes: `npm run lint`
156+
5. Ensure type checking passes: `npm run typecheck`
157+
6. Update documentation if needed
158+
7. Submit a pull request
159+
160+
### PR Checklist
161+
162+
- [ ] Tests added/updated
163+
- [ ] Documentation updated
164+
- [ ] Commit messages follow conventional commits
165+
- [ ] All CI checks pass
166+
167+
## Releasing
168+
169+
Releases are handled by maintainers using `release-it`:
170+
171+
```bash
172+
npm run release
173+
```
174+
175+
This will:
176+
1. Run all checks (lint, typecheck, test)
177+
2. Bump the version based on conventional commits
178+
3. Update the CHANGELOG
179+
4. Create a git tag
180+
5. Push to GitHub
181+
6. Create a GitHub Release
182+
7. Publish to npm
183+
184+
## Questions?
185+
186+
Feel free to open an issue if you have questions or need help!
187+

SECURITY.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 1.x | :white_check_mark: |
8+
9+
## Reporting a Vulnerability
10+
11+
If you discover a security vulnerability in this project, please report it responsibly.
12+
13+
**Do NOT open a public GitHub issue for security vulnerabilities.**
14+
15+
Instead, please email us at: [s.werner@sebastian-software.de](mailto:s.werner@sebastian-software.de)
16+
17+
Please include:
18+
19+
- A description of the vulnerability
20+
- Steps to reproduce the issue
21+
- Potential impact
22+
- Any suggested fixes (if you have them)
23+
24+
## Response Timeline
25+
26+
- We will acknowledge receipt of your report within 48 hours
27+
- We will provide an initial assessment within 7 days
28+
- We will work with you to understand and resolve the issue
29+
- Once fixed, we will publicly acknowledge your contribution (unless you prefer to remain anonymous)
30+
31+
## Scope
32+
33+
This security policy applies to the `eslint-plugin-lingui-typescript` npm package and its source code repository.
34+
35+
Since this is an ESLint plugin that only runs during development/linting (not in production), the attack surface is limited. However, we still take security seriously and appreciate responsible disclosure.
36+
37+
## Best Practices for Users
38+
39+
- Keep your dependencies up to date
40+
- Use `npm audit` regularly
41+
- Pin dependencies in production environments
42+

0 commit comments

Comments
 (0)