@kirill.konshin/lint 0.4.2 → 0.4.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kirill.konshin/lint",
3
3
  "description": "ESLint + Prettier + lint-staged config and AI agent rules/skills for monorepos",
4
- "version": "0.4.2",
4
+ "version": "0.4.4",
5
5
  "type": "module",
6
6
  "skipGenerate": true,
7
7
  "bin": {
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
- - Use as less custom JSX as possible — prefer Toolpad built-ins (navigation, dialogs, notifications, CRUD) over hand-rolled components
21
+ - Prefer Toolpad built-ins (navigation, dialogs, notifications, CRUD) over hand-rolled equivalents
26
22
 
27
23
  # Next.js
28
24
 
package/rules/nextjs.md CHANGED
@@ -11,10 +11,14 @@ _EVERY_ Next.js page, layout, route handler or component must adhere to policy u
11
11
  - Never use Pages Router
12
12
  - Always use App Router
13
13
  - Use `iron-session` for authentication via `@kirill.konshin/auth`, see auth.md
14
- - Server-only modules (auth/session, DB access, anything touching secrets) MUST start with `import 'server-only'` (the npm package, add as dependency) — ENFORCED BY AGENT: no ESLint rule checks this, add it when creating such modules and flag it when reviewing
14
+ - Server-only modules (auth/session, DB access, anything touching secrets, `'use server'` actions files) MUST start with `import 'server-only'` (the npm package, add as dependency) — ENFORCED BY AGENT: no ESLint rule checks this, add it when creating such modules and flag it when reviewing
15
15
  - `package.json` MUST ALWAYS have version of Next.js, NEVER `*`, otherwise Vercel will fall into legacy mode instead of serverless
16
16
  - ALWAYS create `next.config.ts` with `defineNextConfig` from `@kirill.konshin/next/config` (the `/config` subpath, NEVER the barrel — Next transpiles `next.config.ts` to CJS and `require`s it outside any bundler): sets `cacheComponents`, `typedRoutes`, `experimental.typedEnv`, `reactStrictMode: false` and an exhaustive `experimental.optimizePackageImports` (`@mui/*`, `@toolpad/core`, `@fortawesome/*`, `@gravity-ui/*`, `lodash`, `@heroui/react`, `react-bootstrap`, `@kirill.konshin/icons` — extra entries are ignored, missing ones cost dev startup and bundle size, see mui.md)
17
17
  - Use `@kirill.konshin/icons` for FontAwesome / Gravity UI icons — the barrel is safe with `optimizePackageImports` (`defineNextConfig` sets it)
18
+ - Do not make dummy pages that only import components, pages can be client, and should have most logic baked in, including one-off components (not exported)
19
+ - Reusable components should be in `src/components`
20
+ - As exception, separate component files are allowed to be in `src/app` next to relevant pages if one-off component is large so page itself becomes bloated, but `src/components` should not be polluted with one-offs, ask user if not sure
21
+ - Example: `actions.ts` for `'use server'` actions while page is `'use client'`
18
22
 
19
23
  # Admin Pages & Login
20
24
 
package/rules/redux.md CHANGED
@@ -1,4 +1,10 @@
1
1
  ---
2
2
  type: always_apply
3
- description: Set of rules for projects which use Redux
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
 
@@ -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`