@venizia/dev-configs 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -18
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# :fire: IGNIS - @venizia/dev-configs
|
|
4
4
|
|
|
5
|
-
**Shared ESLint, Prettier, and TypeScript configs for the
|
|
5
|
+
**Shared ESLint, Prettier, and TypeScript configs for the IGNIS ecosystem**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@venizia/dev-configs)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[](https://eslint.org/)
|
|
11
11
|
[](https://prettier.io/)
|
|
12
12
|
|
|
13
|
-
Single source of truth for development tooling across the entire
|
|
13
|
+
Single source of truth for development tooling across the entire IGNIS monorepo. Flat ESLint config (v9+), Prettier formatting, and TypeScript compiler settings with `experimentalDecorators` + `emitDecoratorMetadata` enabled.
|
|
14
14
|
|
|
15
15
|
[Installation](#installation) • [Quick Start](#quick-start) • [API Reference](#eslint-configuration) • [Documentation](https://venizia-ai.github.io/ignis)
|
|
16
16
|
|
|
@@ -35,7 +35,7 @@ Single source of truth for development tooling across the entire Ignis monorepo.
|
|
|
35
35
|
- [Architecture: Three-Layer Rule Stack](#architecture-three-layer-rule-stack)
|
|
36
36
|
- [Layer 1: eslint-common (Foundation)](#layer-1-eslint-common-foundation)
|
|
37
37
|
- [Layer 2: eslint-node (Node.js Specialization)](#layer-2-eslint-node-nodejs-specialization)
|
|
38
|
-
- [Layer 3: dev-configs (
|
|
38
|
+
- [Layer 3: dev-configs (IGNIS Overrides)](#layer-3-dev-configs-ignis-overrides)
|
|
39
39
|
- [Complete Rule Reference](#complete-rule-reference)
|
|
40
40
|
- [Rule Examples: Pass vs Fail](#rule-examples-pass-vs-fail)
|
|
41
41
|
- [Flat Config Format (ESLint v9+)](#flat-config-format-eslint-v9)
|
|
@@ -127,7 +127,7 @@ Layer 1: @minimaltech/eslint-common (Foundation: JS recommended + Prettier +
|
|
|
127
127
|
|
|
|
128
128
|
Layer 2: @minimaltech/eslint-node (Node.js: LB4-derived rules + eslint-plugin-n + TS strictness adjustments)
|
|
129
129
|
|
|
|
130
|
-
Layer 3: @venizia/dev-configs (
|
|
130
|
+
Layer 3: @venizia/dev-configs (IGNIS: relax no-explicit-any + add unicorn + enforce curly braces)
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
Each layer is a flat config array. The final export is the concatenation of all three, meaning rules defined later take precedence.
|
|
@@ -163,7 +163,7 @@ Key rules from this layer:
|
|
|
163
163
|
|
|
164
164
|
Provided by `@minimaltech/eslint-node`. Built on top of the common layer, this adds:
|
|
165
165
|
|
|
166
|
-
**LoopBack 4-derived rules (`lbRules`)** -- a comprehensive rule set originally from the LoopBack Next project, adapted for
|
|
166
|
+
**LoopBack 4-derived rules (`lbRules`)** -- a comprehensive rule set originally from the LoopBack Next project, adapted for IGNIS:
|
|
167
167
|
|
|
168
168
|
| Rule | Value | Purpose |
|
|
169
169
|
| :--- | :---- | :------ |
|
|
@@ -207,7 +207,7 @@ Provided by `@minimaltech/eslint-node`. Built on top of the common layer, this a
|
|
|
207
207
|
|
|
208
208
|
---
|
|
209
209
|
|
|
210
|
-
### Layer 3: dev-configs (
|
|
210
|
+
### Layer 3: dev-configs (IGNIS Overrides)
|
|
211
211
|
|
|
212
212
|
This is the final layer defined in `@venizia/dev-configs` itself:
|
|
213
213
|
|
|
@@ -360,7 +360,7 @@ while (hasNext()) advance(); // Error: Expected { after 'while' co
|
|
|
360
360
|
In framework-level code, `any` is sometimes unavoidable when dealing with decorator metadata, dynamic DI resolution, and generic container patterns:
|
|
361
361
|
|
|
362
362
|
```typescript
|
|
363
|
-
// These patterns are common in
|
|
363
|
+
// These patterns are common in IGNIS and would be painful to type perfectly:
|
|
364
364
|
|
|
365
365
|
// Decorator factory that accepts any class
|
|
366
366
|
function controller(opts: { path: string }) {
|
|
@@ -918,7 +918,7 @@ The comprehensive base configuration containing all compiler options. Located at
|
|
|
918
918
|
| :----- | :---- | :----------- | :------------- | :--------------------- |
|
|
919
919
|
| `target` | `ES2022` | Sets the JavaScript version for emit output. | ES2022 provides native `class`, `async/await`, `top-level await`, private class fields, and `Array.at()` without downleveling. Bun and modern Node.js fully support ES2022. | Lowering to ES5/ES6 introduces unnecessary transpilation overhead. Raising to ESNext may use features not yet stable in all runtimes. |
|
|
920
920
|
| `lib` | `["ES2022"]` | Includes type definitions for ES2022 standard library APIs (`structuredClone`, `Array.at()`, `Object.hasOwn()`, `Error.cause`, etc.). | Matches the `target` to ensure type-checked APIs match the emitted code. | Removing this causes TypeScript to not recognize modern APIs like `structuredClone`. Adding `"DOM"` would introduce browser-specific types (e.g., `window`, `document`) that do not exist in Node.js/Bun. |
|
|
921
|
-
| `experimentalDecorators` | `true` | **CRITICAL.** Enables the legacy/experimental decorator syntax (`@decorator`) used by
|
|
921
|
+
| `experimentalDecorators` | `true` | **CRITICAL.** Enables the legacy/experimental decorator syntax (`@decorator`) used by IGNIS for DI, controllers, models, and repositories. | See [Critical Flags](#critical-flags-for-decorator-based-di). | All IGNIS decorators fail to compile. |
|
|
922
922
|
| `emitDecoratorMetadata` | `true` | **CRITICAL.** Emits design-time type metadata via `Reflect.metadata()`. | See [Critical Flags](#critical-flags-for-decorator-based-di). | DI container cannot resolve constructor parameter types. |
|
|
923
923
|
| `useDefineForClassFields` | `false` | **CRITICAL.** Uses assignment semantics for class fields instead of `Object.defineProperty()`. | See [Critical Flags](#critical-flags-for-decorator-based-di). | Decorator-based property injection is overwritten by defineProperty. |
|
|
924
924
|
|
|
@@ -931,7 +931,7 @@ The comprehensive base configuration containing all compiler options. Located at
|
|
|
931
931
|
| `resolveJsonModule` | `true` | Allows importing `.json` files with full type inference. | Used for importing `package.json` and configuration files. | `import pkg from './package.json'` stops working. |
|
|
932
932
|
| `allowSyntheticDefaultImports` | `true` | Allows `import foo from 'module'` even when the module has no explicit `default` export. | Many CJS packages (e.g., `express`, `lodash`) do not have default exports but are commonly imported this way. | `import _ from 'lodash/get'` and similar patterns produce type errors. |
|
|
933
933
|
| `esModuleInterop` | `true` | Emits `__importDefault` and `__importStar` helpers for correct CJS/ESM interop at runtime. | Without this, `import` of CJS modules may resolve to `{ default: module }` instead of `module` directly. | Default imports from CJS modules break at runtime (the module object itself becomes `{ default: ... }`). |
|
|
934
|
-
| `isolatedModules` | `false` | When `true`, restricts features that require cross-file analysis (const enums, namespace merging). |
|
|
934
|
+
| `isolatedModules` | `false` | When `true`, restricts features that require cross-file analysis (const enums, namespace merging). | IGNIS uses `const enum` for binding scopes and namespace merging for type augmentation. These features require cross-file compilation. | Enabling this would disallow `const enum` usage in `@venizia/ignis-inversion` and related packages. |
|
|
935
935
|
| `forceConsistentCasingInFileNames` | `true` | Errors on imports that do not match the file system's actual casing. | Prevents cross-platform bugs where `import './UserService'` works on macOS (case-insensitive) but fails on Linux (case-sensitive). | Disabling this allows case mismatches that cause runtime `MODULE_NOT_FOUND` errors on Linux CI servers. |
|
|
936
936
|
|
|
937
937
|
**Emit**
|
|
@@ -1040,11 +1040,11 @@ This configures `ts-node` (when used during development) to run in `transpileOnl
|
|
|
1040
1040
|
|
|
1041
1041
|
### Critical Flags for Decorator-Based DI
|
|
1042
1042
|
|
|
1043
|
-
Three TypeScript compiler options are **absolutely essential** for the
|
|
1043
|
+
Three TypeScript compiler options are **absolutely essential** for the IGNIS decorator-based dependency injection system to function. Changing any of these will break the entire framework.
|
|
1044
1044
|
|
|
1045
1045
|
#### `experimentalDecorators: true`
|
|
1046
1046
|
|
|
1047
|
-
Enables the TypeScript experimental decorator syntax used throughout
|
|
1047
|
+
Enables the TypeScript experimental decorator syntax used throughout IGNIS:
|
|
1048
1048
|
|
|
1049
1049
|
```typescript
|
|
1050
1050
|
@controller({ path: '/users' })
|
|
@@ -1067,7 +1067,7 @@ to change in a future release. Set the 'experimentalDecorators' option in your
|
|
|
1067
1067
|
|
|
1068
1068
|
The following decorators all require this flag: `@controller`, `@inject`, `@injectable`, `@repository`, `@datasource`, `@service`, `@model`, `@get`, `@post`, `@put`, `@patch`, `@del`, `@api`.
|
|
1069
1069
|
|
|
1070
|
-
**Note on TC39 decorators:** TypeScript 5.0+ supports the new TC39 stage 3 decorator proposal (without `experimentalDecorators`). However, the TC39 decorators do NOT support `emitDecoratorMetadata`, which
|
|
1070
|
+
**Note on TC39 decorators:** TypeScript 5.0+ supports the new TC39 stage 3 decorator proposal (without `experimentalDecorators`). However, the TC39 decorators do NOT support `emitDecoratorMetadata`, which IGNIS relies on for automatic DI resolution. IGNIS intentionally uses the legacy/experimental decorator syntax for this reason.
|
|
1071
1071
|
|
|
1072
1072
|
---
|
|
1073
1073
|
|
|
@@ -1154,7 +1154,7 @@ assigned in the constructor.
|
|
|
1154
1154
|
|
|
1155
1155
|
## Consumption Pattern
|
|
1156
1156
|
|
|
1157
|
-
Every package in the
|
|
1157
|
+
Every package in the IGNIS monorepo follows an identical pattern to consume these configs. Here is the complete setup for a new package:
|
|
1158
1158
|
|
|
1159
1159
|
### 1. ESLint (`eslint.config.mjs`)
|
|
1160
1160
|
|
|
@@ -1206,7 +1206,7 @@ Packages that need path aliases or additional settings simply add them under `co
|
|
|
1206
1206
|
|
|
1207
1207
|
## Real-World Consumer Examples
|
|
1208
1208
|
|
|
1209
|
-
The following are actual configurations from packages in the
|
|
1209
|
+
The following are actual configurations from packages in the IGNIS monorepo.
|
|
1210
1210
|
|
|
1211
1211
|
### packages/inversion (Standard Package)
|
|
1212
1212
|
|
|
@@ -1318,7 +1318,7 @@ Applications use the same pattern as library packages:
|
|
|
1318
1318
|
|
|
1319
1319
|
## Setting Up a New Package
|
|
1320
1320
|
|
|
1321
|
-
Complete step-by-step guide for adding a new package to the
|
|
1321
|
+
Complete step-by-step guide for adding a new package to the IGNIS monorepo (or any project consuming `@venizia/dev-configs`).
|
|
1322
1322
|
|
|
1323
1323
|
### Step 1: Create the Package Directory
|
|
1324
1324
|
|
|
@@ -1332,7 +1332,7 @@ mkdir -p packages/my-package/src
|
|
|
1332
1332
|
{
|
|
1333
1333
|
"name": "@venizia/ignis-my-package",
|
|
1334
1334
|
"version": "0.0.1",
|
|
1335
|
-
"description": "My new
|
|
1335
|
+
"description": "My new IGNIS package",
|
|
1336
1336
|
"exports": {
|
|
1337
1337
|
".": {
|
|
1338
1338
|
"types": "./dist/index.d.ts",
|
|
@@ -1755,9 +1755,9 @@ bun run clean && bun run build
|
|
|
1755
1755
|
|
|
1756
1756
|
## Important Notes
|
|
1757
1757
|
|
|
1758
|
-
- **Monorepo-wide impact.** This package is the foundation of every other package in the
|
|
1758
|
+
- **Monorepo-wide impact.** This package is the foundation of every other package in the IGNIS monorepo. Any change to ESLint rules, Prettier settings, or TypeScript compiler options propagates to **all** packages and examples. Test thoroughly before modifying.
|
|
1759
1759
|
|
|
1760
|
-
- **Decorator flags are non-negotiable.** The `experimentalDecorators`, `emitDecoratorMetadata`, and `useDefineForClassFields` settings are structural requirements of the
|
|
1760
|
+
- **Decorator flags are non-negotiable.** The `experimentalDecorators`, `emitDecoratorMetadata`, and `useDefineForClassFields` settings are structural requirements of the IGNIS DI system. Changing them will break `@inject`, `@controller`, `@repository`, and every other decorator in the framework.
|
|
1761
1761
|
|
|
1762
1762
|
- **ESLint v9+ required.** This package exports flat config arrays, not the legacy `.eslintrc` format. ESLint v9.0.0 or later is required.
|
|
1763
1763
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/dev-configs",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Shareable development configurations for TypeScript projects: ESLint v9 flat config (with unicorn plugin), Prettier formatting, and TypeScript compiler options with critical decorator support (experimentalDecorators, emitDecoratorMetadata, useDefineForClassFields). Single source of truth for consistent code style, type checking, and build settings across monorepo packages. 3-line consumption pattern per config.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build-tools",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"prepublishOnly": "bun run rebuild"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"@minimaltech/eslint-node": "^0.
|
|
95
|
-
"eslint-plugin-unicorn": "^
|
|
94
|
+
"@minimaltech/eslint-node": "^0.3.0",
|
|
95
|
+
"eslint-plugin-unicorn": "^71.1.0"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"eslint": "^9.0.0 || ^10.0.0",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@types/bun": "^1.3.14",
|
|
115
|
-
"eslint": "^10.
|
|
116
|
-
"prettier": "^3.
|
|
115
|
+
"eslint": "^10.7.0",
|
|
116
|
+
"prettier": "^3.9.5",
|
|
117
117
|
"typescript": "^6.0.3"
|
|
118
118
|
}
|
|
119
119
|
}
|