@kirill.konshin/lint 0.4.3 → 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 +1 -1
- package/rules/mui.md +2 -6
- 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/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/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`
|