Skip to content

Commit c07a5f1

Browse files
chore: fix lint errors
1 parent 327dfad commit c07a5f1

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"pickier.pickier-vscode",
4+
"streetsidesoftware.code-spell-checker"
5+
]
6+
}

.vscode/settings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{
2+
// Use pickier as the default formatter
3+
"prettier.enable": false,
4+
"biome.enabled": false,
5+
"editor.formatOnSave": true,
6+
"editor.defaultFormatter": "pickier.pickier-vscode",
7+
// Auto fix
8+
"editor.codeActionsOnSave": {
9+
"source.fixAll": "explicit",
10+
"source.organizeImports": "never"
11+
},
212
"cSpell.words": [
313
"bunpress"
414
]

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,21 @@ export MYAPP_NAME="My Application" # → string
100100
```
101101

102102
Environment variable naming:
103+
103104
- Prefix: Uppercase version of config name (or custom `env_prefix`)
104105
- Nested keys: Separated by underscores
105106
- Hyphens: Converted to underscores
106107

107108
Examples:
109+
108110
- `database.host``MYAPP_DATABASE_HOST`
109111
- `api-key``MYAPP_API_KEY`
110112
- `cache.ttl-seconds``MYAPP_CACHE_TTL_SECONDS`
111113

112114
## Type Safety Features
113115

114116
### ✅ Compile-Time Type Checking
117+
115118
- **No runtime type errors** - all types validated at compile time
116119
- **IDE autocomplete** - full IntelliSense support for config fields
117120
- **Default values** - define defaults directly in your struct
@@ -203,7 +206,7 @@ const Config = struct {
203206
204207
var config = try zig_config.loadConfig(Config, allocator, .{
205208
.name = "myapp",
206-
.env_prefix = "CUSTOM", // Uses CUSTOM_* instead of MYAPP_*
209+
.env_prefix = "CUSTOM", // Uses CUSTOM** instead of MYAPP**
207210
});
208211
defer config.deinit(allocator);
209212
```
@@ -242,24 +245,27 @@ pub fn main() !void {
242245
### Merge Strategies
243246

244247
#### Replace (default for primitives/arrays)
248+
245249
```zig
246250
.{ .strategy = .replace }
247251
// Arrays are completely replaced
248252
// [1, 2] + [3, 4] = [3, 4]
249253
```
250254

251255
#### Concat (for arrays)
256+
252257
```zig
253258
.{ .strategy = .concat }
254259
// Arrays are concatenated with deduplication
255260
// [1, 2] + [2, 3] = [1, 2, 3]
256261
```
257262

258263
#### Smart (for object arrays)
264+
259265
```zig
260266
.{ .strategy = .smart }
261267
// Object arrays are merged by key (id, name, key, path, type)
262-
// [{"id": 1, "name": "a"}] + [{"id": 1, "name": "b"}]
268+
// [{"id": 1, "name": "a"}] + [{"id": 1, "name": "b"}]
263269
// = [{"id": 1, "name": "b"}] // merged by id
264270
```
265271

@@ -346,6 +352,7 @@ All 20 tests passing! Note: There are 4 known memory "leaks" from Zig's JSON par
346352
### Main Functions
347353

348354
#### `loadConfig`
355+
349356
```zig
350357
pub fn loadConfig(
351358
comptime T: type,
@@ -357,6 +364,7 @@ pub fn loadConfig(
357364
Load configuration with full error handling. Returns a typed result.
358365

359366
#### `tryLoadConfig`
367+
360368
```zig
361369
pub fn tryLoadConfig(
362370
comptime T: type,
@@ -368,6 +376,7 @@ pub fn tryLoadConfig(
368376
Load configuration, returning `null` on error.
369377

370378
#### `deepMerge`
379+
371380
```zig
372381
pub fn deepMerge(
373382
allocator: std.mem.Allocator,
@@ -415,6 +424,7 @@ MIT
415424
## Contributing
416425

417426
Contributions welcome! Please ensure:
427+
418428
- All tests pass (`zig build test`)
419429
- Code follows Zig style guidelines
420430
- New features include tests

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "zig-config",
3+
"type": "module",
34
"version": "0.1.1",
45
"scripts": {
56
"release": "pantry release patch --yes",

0 commit comments

Comments
 (0)