@kirill.konshin/lint 0.8.5 → 0.8.7
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/rules/vercel.md +1 -1
- package/skills/lint-vercel/SKILL.md +34 -2
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
|
package/rules/vercel.md
CHANGED
|
@@ -11,4 +11,4 @@ paths:
|
|
|
11
11
|
- The Vercel CLI is a `devDependency`
|
|
12
12
|
- `.vercel/repo.json` (from `vercel link --repo`) is committed; the rest of `.vercel/` stays ignored: `.vercel/*` with `!.vercel/repo.json` in `.gitignore`, never a bare `.vercel` line
|
|
13
13
|
- After `vercel link`, remove the `.vercel` line it appends to `.gitignore`
|
|
14
|
-
- Setup and
|
|
14
|
+
- Setup, checks and env vars for local development (`vercel env pull`, database integration connected to Development): the `lint-vercel` skill
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lint-vercel
|
|
3
|
-
description: Vercel project setup - the Vercel CLI as a dev dependency, the committed repository link (`.vercel/repo.json`) so every clone is linked without `vercel link`, what stays out of git in `.vercel/`, the Yarn install command for projects whose root package is ESM. Use when adding Vercel to a project, running `vercel link`, editing `vercel.json`, editing the `.vercel` lines of `.gitignore`, or when a Vercel install fails with Yarn / Corepack.
|
|
3
|
+
description: Vercel project setup - the Vercel CLI as a dev dependency, the committed repository link (`.vercel/repo.json`) so every clone is linked without `vercel link`, what stays out of git in `.vercel/`, the Yarn install command for projects whose root package is ESM, local development env vars from the Vercel Development environment (`vercel env pull`, Neon / Marketplace integration connected to Development). Use when adding Vercel to a project, running `vercel link`, editing `vercel.json`, editing the `.vercel` lines of `.gitignore`, setting up env vars or a database for local development, or when a Vercel install fails with Yarn / Corepack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Other platform operations (deploy, env vars in other environments, domains, logs): the `vercel-cli` skill.
|
|
7
7
|
|
|
8
8
|
# CLI
|
|
9
9
|
|
|
@@ -29,6 +29,38 @@ Everything else in `.vercel/` is local and stays out of git: env files of `verce
|
|
|
29
29
|
- `vercel link` appends a `.vercel` line to `.gitignore` when that exact line is missing, which silently drops the exception: after every `vercel link`, remove the appended `.vercel` line
|
|
30
30
|
- Check: `git check-ignore -q .vercel/repo.json` exits 1 (not ignored), `git status -uall` shows `.vercel/repo.json` and nothing else from `.vercel/`
|
|
31
31
|
|
|
32
|
+
# Development environment variables
|
|
33
|
+
|
|
34
|
+
CONFIRM WITH USER IF USER WANTS AN INSTRUCTION OR YOU SET THE VARS!
|
|
35
|
+
|
|
36
|
+
When a Vercel project runs locally, propose this setup to the user: the Vercel **Development** environment keeps the local variables, and `vercel env pull` writes them to the env file of the app. Then no person copies secrets by hand, and the env file stays out of git.
|
|
37
|
+
|
|
38
|
+
Pull:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
yarn vercel env pull <app-dir>/.env.local
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- The file path is specific to the app: use the env file that the framework of the app loads, in the directory of the app (Next.js: `<app-dir>/.env.local`); make sure that `.gitignore` ignores it
|
|
45
|
+
- Run the command where the link resolves to the project (see [Repository link](#repository-link))
|
|
46
|
+
- The command pulls the Development environment by default
|
|
47
|
+
- The command replaces all of the file (it asks first, `--yes` does not ask): do not edit the pulled file by hand
|
|
48
|
+
- Put local overrides for one machine in a file that the framework loads with a higher priority and the pull does not write (Next.js: `.env.development.local`)
|
|
49
|
+
|
|
50
|
+
Set the variables:
|
|
51
|
+
|
|
52
|
+
- Add a variable only to Development when its value is different on a local machine, for example an OAuth redirect URI (`http://localhost:3000/redirect`) or the client ID and secret of a local OAuth app
|
|
53
|
+
- Add or change a variable in the dashboard (Settings → Environment Variables) or with `yarn vercel env add <NAME> development`, then pull again
|
|
54
|
+
- A variable that an integration owns (Neon and other Marketplace storage, with the integration icon) cannot be edited one by one: connect the integration to Development (below)
|
|
55
|
+
|
|
56
|
+
Connect a database integration (Neon) to Development. Do the two steps, because each step controls a different setting:
|
|
57
|
+
|
|
58
|
+
1. Storage → the database → **Settings** → **Allowed Environments**: select **All environments**. This lets the resource connect to Development
|
|
59
|
+
2. Storage → the database → **Projects** → ⋯ in the row of the project → **Update Project Connection**: select **Development**. This adds the variables to the Development environment of the project
|
|
60
|
+
3. Check: the **Environments** column of the project row shows Development. Then pull again
|
|
61
|
+
|
|
62
|
+
- Development then uses the same database branch as Production: local writes change production data. When that is not acceptable, tell the user and propose a separate Neon branch for Development (the `neon-postgres-branches` skill)
|
|
63
|
+
|
|
32
64
|
# Install with Yarn
|
|
33
65
|
|
|
34
66
|
The root `package.json` has `"type": "module"` (`@kirill.konshin/lint` requires it). With `ENABLE_EXPERIMENTAL_COREPACK=1`, Vercel downloads Yarn into `.vercel/cache/corepack/`, inside the repository, so Node loads Yarn's CommonJS bundle as ESM and `yarn install` crashes with `Dynamic require of "util" is not supported`. Set the install command in `vercel.json` instead:
|