@kirill.konshin/lint 0.4.3 → 0.4.5
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/db.md +28 -0
- package/rules/mui.md +2 -6
- package/rules/npm-yarn.md +8 -0
- package/rules/redux.md +7 -1
- package/rules/tailwind.md +24 -0
- package/rules/ui-kit.md +14 -0
package/package.json
CHANGED
package/rules/db.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: always_apply
|
|
3
|
+
description: Database persistence and migration rules
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# IndexedDB
|
|
7
|
+
|
|
8
|
+
- Use Dexie for browser-owned IndexedDB data.
|
|
9
|
+
- Do not keep IndexedDB as a second authority after migrating data to a server database.
|
|
10
|
+
|
|
11
|
+
# Postgres
|
|
12
|
+
|
|
13
|
+
- Use Neon Postgres with Drizzle and checked-in generated migrations.
|
|
14
|
+
- Prefer Neon HTTP for simple stateless operations; use the pooled serverless driver for transactions, migrations, and connection-oriented work.
|
|
15
|
+
- Keep schemas, repositories, tenancy, and authorization app-owned; keep reusable driver plumbing in `@kirill.konshin/db`.
|
|
16
|
+
- Import `@kirill.konshin/db` through focused driver, migration, URL, and type subpaths so unrelated drivers are not loaded.
|
|
17
|
+
- Keep database access server-only and separate the database/repository layer from API, UI, and state-management layers.
|
|
18
|
+
- Preserve canonical external identifiers as strings; never coerce opaque IDs or URNs to numbers.
|
|
19
|
+
- Model related state once per owner and entity when that avoids duplicate rows, and enforce invariants with keys, constraints, and indexes.
|
|
20
|
+
- Validate inputs at the application boundary and enforce critical invariants again in Postgres.
|
|
21
|
+
- Use `DATABASE_URL` at runtime; prefer `DATABASE_URL_UNPOOLED` for migrations and maintenance when available.
|
|
22
|
+
- Close owned pools in `finally`; do not leak clients or hide ownership of long-lived connections.
|
|
23
|
+
- Fold Neon Auth into [Iron Session](./auth.md): link identity server-side, store app context in the sealed session, then clear the transient Neon session.
|
|
24
|
+
- Enforce user and tenant scope on every read and mutation; authentication alone is not authorization.
|
|
25
|
+
- For LocalStorage or IndexedDB migrations, preserve behavior but improve the schema when normalization or consolidation is clearly safer.
|
|
26
|
+
- Make importers transactional, validated, idempotent, and count-verifiable; never delete server data merely because a mutable export became smaller.
|
|
27
|
+
- Keep one-off data transfers out of permanent migration machinery; verify source, destination, schema, counts, and runtime connectivity.
|
|
28
|
+
- After schema changes, generate migrations, confirm no drift, migrate a disposable database in tests, and run typecheck/build/tests.
|
package/rules/mui.md
CHANGED
|
@@ -5,24 +5,20 @@ paths:
|
|
|
5
5
|
- '**/*.tsx'
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
- Full adherence to MUI best practices, which preserve semantics and accessibility
|
|
9
|
-
- If contradicts or not sure, as user what to do
|
|
10
|
-
- No negative margins hacks or similar
|
|
11
|
-
- Use bare minimum of JSX to code needed behavior
|
|
12
|
-
- Good example: `Toolbar → ButtonGroup → anchored Menu`
|
|
13
8
|
- Always import components or icons this way: `import { Paper, Button } from '@mui/material';` and `import { Xxx } from '@mui/icons-material';`
|
|
14
9
|
- See barrel handling section
|
|
15
10
|
- Exception: if developing a library use direct imports with minimal bundle footprint (libraries may not be used with barrel handling)
|
|
16
11
|
- To use MUI default classes always use stable minifiable class names:
|
|
17
12
|
- Import: `import { inputClasses } from '@mui/material';` or `import { inputClasses } from '@mui/material/Input';` (see rule about imports)
|
|
18
13
|
- Usage: `<Box sx={{ [``& .${inputClasses.root}``]: { /* styles */ } }}><Input /></Box>`
|
|
14
|
+
- Define safe-area insets globally or in the theme; consume through `sx`, never repeated `env(...)`
|
|
19
15
|
|
|
20
16
|
# Admin Pages & Login
|
|
21
17
|
|
|
22
18
|
- ALWAYS use MUI for admin interfaces (Tailwind is ONLY for user-facing sites, see tailwind.md)
|
|
23
19
|
- ALWAYS use [`@toolpad/core`](https://mui.com/toolpad/core/introduction/) for admin page layouts and login screens: `AppProvider`, `DashboardLayout`, `PageContainer`, `SignInPage`
|
|
24
20
|
- ALWAYS prefer `@kirill.konshin/mui/admin` (`AdminAppProvider`, `AdminDashboardLayout`, `AdminSignInPage`) over hand-rolled `NextAppProvider`/`DashboardLayout`/`SignInPage` boilerplate; `AdminSignInPage.loginAction` takes `loginFormAction` from `@kirill.konshin/auth` (see auth.md)
|
|
25
|
-
-
|
|
21
|
+
- Prefer Toolpad built-ins (navigation, dialogs, notifications, CRUD) over hand-rolled equivalents
|
|
26
22
|
|
|
27
23
|
# Next.js
|
|
28
24
|
|
package/rules/npm-yarn.md
CHANGED
|
@@ -123,3 +123,11 @@ Rules:
|
|
|
123
123
|
- Unlinking: `yalc remove --all` cleans `.yalc/` and `yalc.lock` but leaves dangling symlinks in `node_modules` — delete them before `yarn install`
|
|
124
124
|
- Yarn 4.17+ quarantines packages published <24h ago (`npmMinimalAgeGate`) — consumers need `npmPreapprovedPackages: ["@kirill.konshin/*"]` in `.yarnrc.yml` to install own packages right after release (older Yarn errors on that key — upgrade the consumer via `packageManager` first)
|
|
125
125
|
- `.yarnrc.local.yml` is NOT a thing (open Yarn feature request, local overrides only via `YARN_*` env vars) and yalc runs NO registry (it is a file store in `~/.yalc`), so a registry override cannot replace linking — `yalc link` is the only mode that leaves all manifests untouched
|
|
126
|
+
|
|
127
|
+
# First Publish with OIDC
|
|
128
|
+
|
|
129
|
+
- Never bootstrap, publish, or push a release without explicit approval.
|
|
130
|
+
- Bootstrap a new npm package once from a locally authenticated session with `npm publish --access public --tag bootstrap`; complete npm's interactive 2FA challenge, or use `--otp=<code>` for TOTP.
|
|
131
|
+
- Configure its GitHub trusted publisher for organization/user `kirill-konshin`, repository `utils`, workflow `release.yml`, optional environment `npm-publish`, and check **Allow npm publish**.
|
|
132
|
+
- Under Publishing access, check **Require two-factor authentication and disallow bypass 2FA tokens (recommended)**; OIDC publishes remain allowed and should be used for every normal release.
|
|
133
|
+
- The first conventional `feat` release establishes the normal `latest` version.
|
package/rules/redux.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
type: always_apply
|
|
3
|
-
description:
|
|
3
|
+
description: Rules for Redux
|
|
4
4
|
---
|
|
5
|
+
|
|
6
|
+
- Keep popup, input, and component-owned state local
|
|
7
|
+
- Use Redux only for global state shared or controlled across many places
|
|
8
|
+
- Avoid global-by-default state and prop drilling; lift locally or use scoped context
|
|
9
|
+
- Connect Redux in business components; keep reusable UI prop-driven
|
|
10
|
+
- Prefer logical slices: API, UI, specialty (approved by user), by default if UI only all goes into one slice
|
package/rules/tailwind.md
CHANGED
|
@@ -7,6 +7,30 @@ description: Set of rules for projects which use Tailwind
|
|
|
7
7
|
- Always use latest version of Tailwind
|
|
8
8
|
- Default UI library for use with Tailwind is Hero UI v3+
|
|
9
9
|
- Use the smallest possible configuration of Tailwind and Hero UI, adhere to their best practices (for Vite, Next.js integration, etc.)
|
|
10
|
+
- Define safe-area insets as named Tailwind utilities; never repeat arbitrary `env(...)` or safe-area calculations in components
|
|
11
|
+
- Safe-area positioning utilities must declare an unconditional design-system gutter first, then enhance it with the maximum of that gutter and the device-reported inset on every edge; use at least `1.5rem` for floating controls because insets can be zero and custom-property resolution can fail on real devices
|
|
12
|
+
|
|
13
|
+
```css
|
|
14
|
+
@utility top-safe {
|
|
15
|
+
top: 1.5rem;
|
|
16
|
+
top: max(1.5rem, env(safe-area-inset-top, 0px));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@utility right-safe {
|
|
20
|
+
right: 1.5rem;
|
|
21
|
+
right: max(1.5rem, env(safe-area-inset-right, 0px));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@utility bottom-safe {
|
|
25
|
+
bottom: 1.5rem;
|
|
26
|
+
bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@utility left-safe {
|
|
30
|
+
left: 1.5rem;
|
|
31
|
+
left: max(1.5rem, env(safe-area-inset-left, 0px));
|
|
32
|
+
}
|
|
33
|
+
```
|
|
10
34
|
|
|
11
35
|
# ESLint (eslint-plugin-tailwindcss, bundled with @kirill.konshin/lint)
|
|
12
36
|
|
package/rules/ui-kit.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: always_apply
|
|
3
|
+
description: Rules for UI kits
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
- Follow UI kit docs and primitives; preserve semantics and accessibility
|
|
7
|
+
- Customize ONLY when the kit cannot meet the need and the user approves
|
|
8
|
+
- Minimize custom JSX, styles, and wrappers; reuse repeated compositions
|
|
9
|
+
- Separate business logic, APIs, and state from presentation; business components may compose UI primitives including UI kit, to a reasonable degree, or if user approves
|
|
10
|
+
- Keep reusable UI logic-free, prop-driven, portable, and testable without the store or API
|
|
11
|
+
- Use base spacing and type scales; avoid pixel spacing except for exact placement; scale through a few base tokens
|
|
12
|
+
- Prefer theme or global overrides to component patches, even for one-offs
|
|
13
|
+
- Support mobile safe-area insets through framework primitives
|
|
14
|
+
- Design mobile-first; scale up at `md`
|