@kirill.konshin/lint 0.8.5 → 0.8.6
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/package.json +1 -1
- package/rules/typescript.md +2 -0
package/package.json
CHANGED
package/rules/typescript.md
CHANGED
|
@@ -92,6 +92,8 @@ paths:
|
|
|
92
92
|
- `exports` conditions must be FLAT and `types`-first (`{types, import, default}`) — a nested or `import`-only map matches NO condition outside `import`, so CJS resolvers get `ERR_PACKAGE_PATH_NOT_EXPORTED` (the entry is invisible, not merely interop-incompatible); `default` is the catch-all, not a CJS build, and Node >= 22.12 loads the ESM behind it through `require()`
|
|
93
93
|
- Next.js transpiles `next.config.ts` to CommonJS and `require()`s it, so config-only helpers MUST be reachable this way — keep them in their own subpath that imports nothing at runtime
|
|
94
94
|
- Every subpath export needs its OWN bundler entry — a pure re-export barrel that is merely reachable from the main entry gets inlined, and its `dist/<mod>/index.js` is never written
|
|
95
|
+
- Emit declarations with the tsdown `dts` option of `vp pack`; do not add `unplugin-dts` or `vite-plugin-dts` — tsdown already falls back to the TypeScript compiler (`dts.generator: 'tsc'`) when a package cannot use `isolatedDeclarations`
|
|
96
|
+
- Exception: `unplugin-dts` for a package that must build with `vite build` library mode and cannot move to `vp pack`
|
|
95
97
|
- NEVER import an OPTIONAL peerDependency at runtime, not even for a single constant — inline it (annotate with `typeof` of a type-only import as a drift guard); a barrel re-exporting such a module makes the WHOLE entry unresolvable when the peer is absent
|
|
96
98
|
|
|
97
99
|
# Type Annotation Patterns
|