Skip to content

Commit ea63894

Browse files
committed
chore: set up lint and typecheck
1 parent 6c37086 commit ea63894

8 files changed

Lines changed: 1481 additions & 1275 deletions

File tree

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
ci:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: pnpm/action-setup@v4
14+
15+
- uses: actions/setup-node@v5
16+
with:
17+
node-version: 22
18+
cache: pnpm
19+
20+
- run: pnpm install
21+
22+
- run: pnpm typecheck
23+
24+
- run: pnpm lint

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ dist
44
.env
55
.env.*
66
!.env.example
7+
.DS_Store
8+
.idea

CONTRIBUTING.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# Contributing to `@supabase/edge-functions`
2+
3+
Thank you for your interest in contributing to `@supabase/edge-functions`! This document provides guidelines and instructions for contributing to the project.
4+
5+
## Table of Contents
6+
7+
- [Getting Started](#getting-started)
8+
- [Development Setup](#development-setup)
9+
- [Project Structure](#project-structure)
10+
- [Development Workflow](#development-workflow)
11+
- [Testing](#testing)
12+
- [Code Style](#code-style)
13+
- [Submitting Changes](#submitting-changes)
14+
- [Release Process](#release-process)
15+
16+
## Getting Started
17+
18+
TBD
19+
20+
## Development Setup
21+
22+
### Prerequisites
23+
24+
- **Node.js**: 20.x or higher
25+
- **pnpm**
26+
27+
### Installation
28+
29+
1. Fork and clone the repository:
30+
31+
```bash
32+
git clone https://github.com/YOUR_USERNAME/edge-functions.git
33+
cd edge-functions
34+
```
35+
36+
2. Install dependencies:
37+
38+
```bash
39+
pnpm install
40+
```
41+
42+
3. Build the project to verify setup:
43+
44+
```bash
45+
pnpm build
46+
```
47+
48+
## Development Workflow
49+
50+
### Building
51+
52+
Build the library for distribution:
53+
54+
```bash
55+
pnpm build
56+
```
57+
58+
Watch mode for development (rebuilds on file changes):
59+
60+
```bash
61+
pnpm run dev
62+
```
63+
64+
### Formatting
65+
66+
Format all code using Prettier:
67+
68+
```bash
69+
pnpm format
70+
```
71+
72+
## Submitting Changes
73+
74+
### Commit Messages
75+
76+
We use [Conventional Commits](https://www.conventionalcommits.org/) for automated releases. Format:
77+
78+
```text
79+
<type>(<scope>): <description>
80+
81+
[optional body]
82+
83+
[optional footer]
84+
```
85+
86+
**Types:**
87+
88+
- `feat`: New feature (triggers minor version bump)
89+
- `fix`: Bug fix (triggers patch version bump)
90+
- `docs`: Documentation changes only
91+
- `test`: Adding or updating tests
92+
- `chore`: Maintenance tasks, dependency updates
93+
- `refactor`: Code changes that neither fix bugs nor add features
94+
- `perf`: Performance improvements
95+
- `ci`: CI/CD configuration changes
96+
97+
**Breaking changes:**
98+
99+
- Use `feat!:` or `fix!:` for breaking changes (triggers major version bump)
100+
- Or include `BREAKING CHANGE:` in the commit footer
101+
102+
**Examples:**
103+
104+
```bash
105+
feat: add support for view operations
106+
fix: handle empty namespace list correctly
107+
docs: update README with new examples
108+
test: add integration tests for table updates
109+
feat!: change auth config structure
110+
111+
BREAKING CHANGE: auth configuration now uses a discriminated union
112+
```
113+
114+
### Pull Request Process
115+
116+
1. **Create a branch** from `main`:
117+
118+
```bash
119+
git checkout -b feat/my-feature
120+
```
121+
122+
2. **Make your changes** following the guidelines above
123+
124+
3. **Commit** using conventional commit format:
125+
126+
```bash
127+
git commit -m "feat: add support for XYZ"
128+
```
129+
130+
4. **Push** to your fork:
131+
132+
```bash
133+
git push origin feat/my-feature
134+
```
135+
136+
5. **Open a Pull Request** with:
137+
- Clear title following conventional commit format
138+
- Description of what changed and why
139+
- Reference any related issues (e.g., "Fixes #123")
140+
- Screenshots/examples if adding user-facing features
141+
142+
6. **Respond to feedback** - maintainers may request changes
143+
144+
### PR Guidelines
145+
146+
- Keep PRs focused - one feature or fix per PR
147+
- Update documentation if you change public APIs
148+
- Add tests for new functionality
149+
- Ensure all CI checks pass
150+
- Rebase on `main` if needed to resolve conflicts
151+
- Be responsive to review feedback
152+
153+
## Release Process
154+
155+
This project uses [release-please](https://github.com/googleapis/release-please) for automated releases. You don't need to manually manage versions or changelogs.
156+
157+
### How It Works
158+
159+
1. **You commit** using conventional commit format (see above)
160+
161+
2. **release-please creates/updates a release PR** automatically when changes are pushed to `main`
162+
- Updates version in `package.json`
163+
- Updates `CHANGELOG.md`
164+
- Generates release notes
165+
166+
3. **Maintainer merges the release PR** when ready to release
167+
- Creates a GitHub release and git tag
168+
- Automatically publishes to npm with provenance
169+
170+
### Version Bumps
171+
172+
Versions follow [Semantic Versioning](https://semver.org/):
173+
174+
- **Major (1.0.0 → 2.0.0)**: Breaking changes (`feat!:`, `fix!:`, or `BREAKING CHANGE:`)
175+
- **Minor (1.0.0 → 1.1.0)**: New features (`feat:`)
176+
- **Patch (1.0.0 → 1.0.1)**: Bug fixes (`fix:`)
177+
178+
Commits with types like `docs:`, `test:`, `chore:` don't trigger releases on their own.
179+
180+
### For Maintainers Only
181+
182+
Publishing is fully automated via GitHub Actions:
183+
184+
1. Merge the release-please PR when ready
185+
2. GitHub Actions will automatically publish to npm with provenance
186+
3. No manual `npm publish` needed
187+
188+
## Questions?
189+
190+
- Open an [issue](https://github.com/supabase/edge-functions/issues) for bugs or feature requests
191+
- Check existing issues and PRs before creating new ones
192+
- Tag your issues appropriately (`bug`, `enhancement`, `documentation`, etc.)
193+
194+
## License
195+
196+
By contributing to `@supabase/edge-functions`, you agree that your contributions will be licensed under the MIT License.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Supabase
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import tseslint from 'typescript-eslint'
2+
3+
export default tseslint.config(tseslint.configs.recommended)

package.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,17 @@
3232
"files": [
3333
"dist"
3434
],
35+
"engines": {
36+
"node": ">=20"
37+
},
3538
"scripts": {
3639
"build": "tsdown",
3740
"dev": "tsdown --watch",
3841
"format": "prettier --write .",
39-
"prepare": "simple-git-hooks"
42+
"lint": "eslint src",
43+
"lint:fix": "eslint src --fix",
44+
"prepare": "simple-git-hooks",
45+
"typecheck": "tsc --noEmit"
4046
},
4147
"simple-git-hooks": {
4248
"pre-commit": "pnpm pretty-quick --staged",
@@ -48,12 +54,14 @@
4854
]
4955
},
5056
"devDependencies": {
51-
"@commitlint/cli": "^19.x",
52-
"@commitlint/config-conventional": "^19.x",
57+
"@commitlint/cli": "^20.4.2",
58+
"@commitlint/config-conventional": "^20.4.2",
59+
"eslint": "^10.0.2",
5360
"prettier": "3.8.1",
5461
"pretty-quick": "^4.2.2",
5562
"simple-git-hooks": "^2.13.1",
56-
"tsdown": "^0.18.4",
57-
"typescript": "^5.9.3"
63+
"tsdown": "^0.20.3",
64+
"typescript": "^5.9.3",
65+
"typescript-eslint": "^8.56.1"
5866
}
5967
}

0 commit comments

Comments
 (0)