@kirill.konshin/lint 0.3.2 → 0.3.3
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/README.md +3 -1
- package/package.json +2 -1
- package/rules/monorepo-turbo-nx.md +5 -2
- package/rules/mui.md +6 -0
- package/rules/nextjs.md +6 -0
- package/rules/tailwind.md +1 -0
- package/rules/turbo.md +47 -21
- package/rules/typescript.md +1 -0
- package/rules/webstorm.md +46 -0
package/README.md
CHANGED
|
@@ -155,6 +155,7 @@ end_of_line = lf
|
|
|
155
155
|
charset = utf-8
|
|
156
156
|
trim_trailing_whitespace = true
|
|
157
157
|
insert_final_newline = false
|
|
158
|
+
max_line_length = 120
|
|
158
159
|
|
|
159
160
|
[*.{js,jsx,ts,tsx,cjs,cts,mjs,mts,md,mdx,htm,html,vue}]
|
|
160
161
|
indent_size = 4
|
|
@@ -215,10 +216,11 @@ By default, always use the `prepare` script, as [Husky recommends](https://typic
|
|
|
215
216
|
|
|
216
217
|
```bash
|
|
217
218
|
#!/bin/zsh
|
|
218
|
-
source ~/.zshrc # for VSCode terminal
|
|
219
219
|
yarn lint:staged
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
+
Note `source ~/.zshrc # for VSCode terminal` may be added for VSCode terminal that is not aware of ZSH. Do not add unless specifically asked, and remove if present.
|
|
223
|
+
|
|
222
224
|
## AI Agent Rules
|
|
223
225
|
|
|
224
226
|
The package also ships a standardized set of coding conventions (`rules/*.md`) and skills for AI coding assistants, wired into a repo by the `lint-prepare` CLI.
|
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.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"skipGenerate": true,
|
|
7
7
|
"bin": {
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"prettier": "^3",
|
|
71
71
|
"storybook": "^10.5.2",
|
|
72
72
|
"tailwindcss": "*",
|
|
73
|
+
"typescript": "^6",
|
|
73
74
|
"vite": "*",
|
|
74
75
|
"vitest": "*"
|
|
75
76
|
},
|
|
@@ -27,8 +27,9 @@ ALWAYS verify `turbo.json` or `nx.json` task definitions when modifying scripts
|
|
|
27
27
|
|
|
28
28
|
# The `dependsOn: ["^wait"]` Pattern
|
|
29
29
|
|
|
30
|
-
https://github.com/vercel/turborepo/issues/1497
|
|
31
|
-
https://github.com/vercel/turborepo/discussions/1299
|
|
30
|
+
- https://github.com/vercel/turborepo/issues/1497
|
|
31
|
+
- https://github.com/vercel/turborepo/discussions/1299
|
|
32
|
+
- https://turborepo.dev/docs/guides/coordinating-runtime-dependencies
|
|
32
33
|
|
|
33
34
|
Neither Turbo nor NX can run `persistent` or `continuous` dependent tasks in order. If package `A` depends on `B` and both have `start` command, in freshly checked out repo `A` will fail as `B` does not have anything built yet. Besides, two continuous tasks can't depend on each other as neither will ever exit. Options are:
|
|
34
35
|
|
|
@@ -54,3 +55,5 @@ The `start` task uses `"dependsOn": ["^wait"]` (upstream):
|
|
|
54
55
|
3. `B` also runs `"start": "build --watch"` task (for example) which produces `dist/index.js`
|
|
55
56
|
4. Once the file exists, `B`'s `wait-on` unblocks and exits, and `A`'s `start` can proceed
|
|
56
57
|
5. If file existed before, `A` starts immediately, the only issue could be `A`'s double-build if `B`'s `start` will eventually modify the file, causing `A`'s watcher to rebuild
|
|
58
|
+
|
|
59
|
+
For Turbo sibling runtime services (`web` <> `api`, not a package dependency) see the `with` + `wait` pattern in turbo.md.
|
package/rules/mui.md
CHANGED
|
@@ -8,3 +8,9 @@ paths:
|
|
|
8
8
|
- To use MUI default classes always use following notation because it's the only one that works with minification:
|
|
9
9
|
- Import: `import Input, { inputClasses } from '@mui/material/Input';`
|
|
10
10
|
- Usage: `<Box sx={{ [``& .${inputClasses.root}``]: { /* styles */ } }}><Input /></Box>`
|
|
11
|
+
|
|
12
|
+
# Admin Pages & Login
|
|
13
|
+
|
|
14
|
+
- ALWAYS use MUI for admin interfaces (Tailwind is ONLY for user-facing sites, see tailwind.md)
|
|
15
|
+
- ALWAYS use [`@toolpad/core`](https://mui.com/toolpad/core/introduction/) for admin page layouts and login screens: `AppProvider`, `DashboardLayout`, `PageContainer`, `SignInPage`
|
|
16
|
+
- Use as less custom JSX as possible — prefer Toolpad built-ins (navigation, dialogs, notifications, CRUD) over hand-rolled components
|
package/rules/nextjs.md
CHANGED
|
@@ -13,6 +13,12 @@ _EVERY_ Next.js page, layout, route handler or component must adhere to policy u
|
|
|
13
13
|
- Use `iron-session` for authentication
|
|
14
14
|
- `package.json` MUST ALWAYS have version of Next.js, NEVER `*`, otherwise Vercel will fall into legacy mode instead of serverless
|
|
15
15
|
|
|
16
|
+
# Admin Pages & Login
|
|
17
|
+
|
|
18
|
+
- ALWAYS use MUI + [`@toolpad/core`](https://mui.com/toolpad/core/introduction/) for admin page layouts and login screens, with the App Router integration (`NextAppProvider` from `@toolpad/core/nextjs`), see mui.md
|
|
19
|
+
- Use as less custom JSX as possible — prefer Toolpad built-ins (`DashboardLayout`, `PageContainer`, `SignInPage`) over hand-rolled components
|
|
20
|
+
- Tailwind is ONLY for user-facing sites, NEVER for admin (see tailwind.md)
|
|
21
|
+
|
|
16
22
|
# Layouts
|
|
17
23
|
|
|
18
24
|
Always use https://nextjs.org/docs/app/api-reference/file-conventions/layout#layout-props-helper:
|
package/rules/tailwind.md
CHANGED
|
@@ -3,6 +3,7 @@ type: always_apply
|
|
|
3
3
|
description: Set of rules for projects which use Tailwind
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
- Use Tailwind ONLY for user-facing sites, NEVER for admin — admin interfaces ALWAYS use MUI + `@toolpad/core` (see mui.md)
|
|
6
7
|
- Always use latest version of Tailwind
|
|
7
8
|
- Default UI library for use with Tailwind is Hero UI v3+
|
|
8
9
|
- Use the smallest possible configuration of Tailwind and Hero UI, adhere to their best practices (for Vite, Next.js integration, etc.)
|
package/rules/turbo.md
CHANGED
|
@@ -10,31 +10,30 @@ paths:
|
|
|
10
10
|
|
|
11
11
|
```jsonc
|
|
12
12
|
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// define task defaults
|
|
13
|
+
"$schema": "https://turbo.build/schema.json",
|
|
14
|
+
"globalDependencies": ["tsconfig.json"],
|
|
15
|
+
"tasks": {
|
|
16
|
+
// define task defaults
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
"build": {},
|
|
19
|
+
"wait": {
|
|
20
|
+
"cache": false,
|
|
21
|
+
},
|
|
22
|
+
"test": {
|
|
23
|
+
"outputs": ["coverage/**/*"],
|
|
24
|
+
},
|
|
25
|
+
"start": {
|
|
26
|
+
"persistent": true,
|
|
27
|
+
"cache": false,
|
|
28
|
+
"dependsOn": ["^wait"],
|
|
29
|
+
},
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
// root tasks
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
"//#lint": {
|
|
34
|
+
"cache": false,
|
|
35
|
+
},
|
|
36
36
|
},
|
|
37
|
-
}
|
|
38
37
|
}
|
|
39
38
|
```
|
|
40
39
|
|
|
@@ -56,3 +55,30 @@ paths:
|
|
|
56
55
|
},
|
|
57
56
|
}
|
|
58
57
|
```
|
|
58
|
+
|
|
59
|
+
# Runtime Services: `with` + `wait` (e.g. `web` <> `api`)
|
|
60
|
+
|
|
61
|
+
https://turborepo.dev/docs/guides/coordinating-runtime-dependencies
|
|
62
|
+
|
|
63
|
+
When an app needs a sibling service running in dev (`web` needs `api`), combine:
|
|
64
|
+
|
|
65
|
+
- `"with": ["api#start"]` — launches the service alongside, so `turbo run start --filter=web` brings up both (convenience instead of whole-repo `start`)
|
|
66
|
+
- `"dependsOn": ["api#wait"]` — blocks `web#start` until the readiness probe exits
|
|
67
|
+
- Name the probe task `wait` (NOT `dev:ready` as in the Turbo guide) — same task the `^wait` pattern uses (see monorepo-turbo-nx.md)
|
|
68
|
+
- NEVER put persistent tasks in `dependsOn` — they never exit, so dependents never unblock; depend on the finite `wait` probe
|
|
69
|
+
- `wait` lives in the service package so it self-identifies readiness: `"wait": "wait-on http://localhost:3001/health"` (URL, TCP port, file, socket)
|
|
70
|
+
- Task overrides replace, they don't merge — keep `^wait` when overriding `start`
|
|
71
|
+
- Run with at least `--concurrency=3` (a slot per persistent task + the probe)
|
|
72
|
+
|
|
73
|
+
```jsonc
|
|
74
|
+
// ./apps/web/turbo.json
|
|
75
|
+
{
|
|
76
|
+
"extends": ["//"],
|
|
77
|
+
"tasks": {
|
|
78
|
+
"start": {
|
|
79
|
+
"with": ["api#start"],
|
|
80
|
+
"dependsOn": ["^wait", "api#wait"],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
```
|
package/rules/typescript.md
CHANGED
|
@@ -11,6 +11,7 @@ paths:
|
|
|
11
11
|
|
|
12
12
|
- ALL projects must use TypeScript by default
|
|
13
13
|
- JavaScript is acceptable for service scripts, but discouraged, use `ts-node`
|
|
14
|
+
- Do NOT upgrade to TypeScript 7 until `typescript-eslint` supports it
|
|
14
15
|
- ALL configs should use TypeScript if possible via `defineConfig` or at least import TS type for configuration.
|
|
15
16
|
- Prefer short-circuit evaluation and early exit
|
|
16
17
|
- Use structured logging with context, consider adding function arguments to log:
|
package/rules/webstorm.md
CHANGED
|
@@ -131,3 +131,49 @@ Applies if project is using Tailwind.
|
|
|
131
131
|
</component>
|
|
132
132
|
</project>
|
|
133
133
|
```
|
|
134
|
+
|
|
135
|
+
# Configure `.idea/jsonSchemas.xml`
|
|
136
|
+
|
|
137
|
+
```xml
|
|
138
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
139
|
+
<project version="4">
|
|
140
|
+
<component name="JsonSchemaMappingsProjectConfiguration">
|
|
141
|
+
<state>
|
|
142
|
+
<map>
|
|
143
|
+
<entry key="Gemini CLI settings">
|
|
144
|
+
<value>
|
|
145
|
+
<SchemaInfo>
|
|
146
|
+
<option name="name" value="Gemini CLI settings" />
|
|
147
|
+
<option name="relativePathToSchema" value="https://raw.githubusercontent.com/google-gemini/gemini-cli/refs/heads/main/schemas/settings.schema.json" />
|
|
148
|
+
<option name="applicationDefined" value="true" />
|
|
149
|
+
<option name="patterns">
|
|
150
|
+
<list>
|
|
151
|
+
<Item>
|
|
152
|
+
<option name="path" value=".gemini/settings.json" />
|
|
153
|
+
</Item>
|
|
154
|
+
</list>
|
|
155
|
+
</option>
|
|
156
|
+
</SchemaInfo>
|
|
157
|
+
</value>
|
|
158
|
+
</entry>
|
|
159
|
+
<entry key="Yarn Config (.yarnrc.yml)">
|
|
160
|
+
<value>
|
|
161
|
+
<SchemaInfo>
|
|
162
|
+
<option name="name" value="Yarn Config (.yarnrc.yml)" />
|
|
163
|
+
<option name="relativePathToSchema" value="https://yarnpkg.com/configuration/yarnrc.json" />
|
|
164
|
+
<option name="applicationDefined" value="true" />
|
|
165
|
+
<option name="patterns">
|
|
166
|
+
<list>
|
|
167
|
+
<Item>
|
|
168
|
+
<option name="path" value=".yarnrc.yml" />
|
|
169
|
+
</Item>
|
|
170
|
+
</list>
|
|
171
|
+
</option>
|
|
172
|
+
</SchemaInfo>
|
|
173
|
+
</value>
|
|
174
|
+
</entry>
|
|
175
|
+
</map>
|
|
176
|
+
</state>
|
|
177
|
+
</component>
|
|
178
|
+
</project>
|
|
179
|
+
```
|