@kirill.konshin/lint 0.5.3 → 0.5.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/README.md +10 -5
- package/dist/configs/testing.d.ts.map +1 -1
- package/dist/configs/testing.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lintPrepare.d.ts +20 -21
- package/dist/lintPrepare.d.ts.map +1 -1
- package/dist/lintPrepare.js +53 -62
- package/dist/restrictions.d.ts +23 -0
- package/dist/restrictions.d.ts.map +1 -0
- package/dist/restrictions.js +24 -0
- package/package.json +1 -1
- package/rules/agent.md +5 -4
- package/rules/github.md +0 -76
- package/rules/gitlab.md +0 -72
- package/rules/nextjs.md +2 -55
- package/rules/storybook.md +2 -0
- package/rules/tailwind.md +1 -1
- package/rules/webstorm.md +6 -214
- package/skills/lint-github/SKILL.md +78 -0
- package/skills/lint-gitlab/SKILL.md +76 -0
- package/skills/lint-nextjs/SKILL.md +59 -0
- package/skills/{lint-repo.md → lint-repo/SKILL.md} +1 -1
- package/skills/lint-webstorm/SKILL.md +201 -0
- package/skills/lint-worktree/SKILL.md +28 -0
- package/skills/spec-steward/SKILL.md +1 -1
- package/skills/spec-steward/references/contract.md +4 -4
- package/skills/spec-steward/references/model.md +1 -1
- package/skills/spec-steward/references/wiring.md +2 -2
- package/skills/spec-steward/scripts/lib/align.mjs +7 -6
- package/skills/spec-steward/scripts/lib/checks.mjs +6 -1
- package/skills/spec-steward/scripts/lib/corpus.mjs +4 -7
- package/skills/spec-steward/scripts/lib/coverage.mjs +2 -3
- package/skills/spec-steward/scripts/lib/evidence.mjs +0 -1
package/rules/gitlab.md
CHANGED
|
@@ -14,76 +14,4 @@ paths:
|
|
|
14
14
|
|
|
15
15
|
# Example
|
|
16
16
|
|
|
17
|
-
```yml
|
|
18
|
-
image: node:lts
|
|
19
|
-
|
|
20
|
-
variables:
|
|
21
|
-
YARN_ENABLE_GLOBAL_CACHE: false # so that .yarn/cache is written
|
|
22
|
-
|
|
23
|
-
cache:
|
|
24
|
-
- key:
|
|
25
|
-
prefix: yarn
|
|
26
|
-
files:
|
|
27
|
-
- yarn.lock # dependencies cached based on lockfile
|
|
28
|
-
paths:
|
|
29
|
-
- .yarn/cache
|
|
30
|
-
policy: pull-push
|
|
31
|
-
# Job-specific keys prevent parallel jobs from replacing each other's local build cache.
|
|
32
|
-
- key: build-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
|
|
33
|
-
fallback_keys:
|
|
34
|
-
- build-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH
|
|
35
|
-
paths:
|
|
36
|
-
- .turbo
|
|
37
|
-
- .nx/cache
|
|
38
|
-
- '**/.tscache'
|
|
39
|
-
- '**/.tsbuildinfo'
|
|
40
|
-
- '**/.next/cache'
|
|
41
|
-
policy: pull-push
|
|
42
|
-
|
|
43
|
-
stages:
|
|
44
|
-
- install
|
|
45
|
-
- test
|
|
46
|
-
- build
|
|
47
|
-
|
|
48
|
-
# separate so that cache can pre-populate if other steps would fail, it speeds things up
|
|
49
|
-
before_script:
|
|
50
|
-
- corepack enable
|
|
51
|
-
- yarn install --immutable
|
|
52
|
-
- yarn prepare # Add this if Yarn 2+ is used and package is NOT private, otherwise postinstall should be configured, and this line skipped
|
|
53
|
-
|
|
54
|
-
install:
|
|
55
|
-
stage: install
|
|
56
|
-
script:
|
|
57
|
-
- echo Done
|
|
58
|
-
|
|
59
|
-
lint:
|
|
60
|
-
stage: test
|
|
61
|
-
script:
|
|
62
|
-
- yarn lint
|
|
63
|
-
|
|
64
|
-
test:
|
|
65
|
-
stage: test
|
|
66
|
-
image: mcr.microsoft.com/playwright:v1.50.0-noble # keep in sync with installed Playwright version
|
|
67
|
-
artifacts:
|
|
68
|
-
when: always
|
|
69
|
-
paths:
|
|
70
|
-
- test-results
|
|
71
|
-
- test-results-html
|
|
72
|
-
reports:
|
|
73
|
-
junit: test-results/junit.xml
|
|
74
|
-
script:
|
|
75
|
-
- yarn test:playwright # https://playwright.dev/docs/ci#running-headed xvfb-run yarn test:playwright
|
|
76
|
-
|
|
77
|
-
# Not needed for Vercel-hosted projects
|
|
78
|
-
build:
|
|
79
|
-
stage: build
|
|
80
|
-
script:
|
|
81
|
-
- yarn build
|
|
82
|
-
only:
|
|
83
|
-
- master
|
|
84
|
-
artifacts:
|
|
85
|
-
paths:
|
|
86
|
-
- web/build
|
|
87
|
-
```
|
|
88
|
-
|
|
89
17
|
- Use Nx Cloud or Turbo Remote Cache when build results must be shared safely across parallel jobs.
|
package/rules/nextjs.md
CHANGED
|
@@ -5,6 +5,8 @@ description: Set of rules for projects which use Next.js
|
|
|
5
5
|
|
|
6
6
|
_EVERY_ Next.js page, layout, route handler or component must adhere to policy unless explicitly prohibited in comment before the component definition.
|
|
7
7
|
|
|
8
|
+
Use `lint-nextjs` skill when working with Next.js projet.
|
|
9
|
+
|
|
8
10
|
# General Guidelines
|
|
9
11
|
|
|
10
12
|
- Prefer Route Handlers for redirects
|
|
@@ -26,58 +28,3 @@ _EVERY_ Next.js page, layout, route handler or component must adhere to policy u
|
|
|
26
28
|
- ALWAYS prefer `@kirill.konshin/mui/admin` (`AdminAppProvider`, `AdminDashboardLayout`, `AdminSignInPage`) — encapsulates the Toolpad boilerplate and wires `@kirill.konshin/auth`, see mui.md
|
|
27
29
|
- Use as less custom JSX as possible — prefer Toolpad built-ins (`DashboardLayout`, `PageContainer`, `SignInPage`) over hand-rolled components
|
|
28
30
|
- Tailwind is ONLY for user-facing sites, NEVER for admin (see tailwind.md)
|
|
29
|
-
|
|
30
|
-
# Layouts
|
|
31
|
-
|
|
32
|
-
Always use https://nextjs.org/docs/app/api-reference/file-conventions/layout#layout-props-helper:
|
|
33
|
-
|
|
34
|
-
```tsx
|
|
35
|
-
import React from 'react';
|
|
36
|
-
|
|
37
|
-
export default function Layout({ children, analytics }: LayoutProps<'/dashboard'>) {
|
|
38
|
-
return (
|
|
39
|
-
<>
|
|
40
|
-
{children}
|
|
41
|
-
{/* If you have app/dashboard/@analytics, it appears as a typed slot: */}
|
|
42
|
-
{analytics}
|
|
43
|
-
</>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Check auth in layouts pattern
|
|
49
|
-
|
|
50
|
-
Prefer `/app/(auth)/layout.tsx` as root layout for auth protection. This won't create path segment, but will protect all routes under it.
|
|
51
|
-
|
|
52
|
-
Route Handlers are not protected by layouts, so add auth check there too.
|
|
53
|
-
|
|
54
|
-
```tsx
|
|
55
|
-
import React from 'react';
|
|
56
|
-
import { redirect } from 'next/navigation';
|
|
57
|
-
import { getToken } from '@/lib/auth';
|
|
58
|
-
|
|
59
|
-
export default async function Layout({ children }: LayoutProps<'/dashboard'>) {
|
|
60
|
-
if (!(await getToken())) {
|
|
61
|
-
redirect('/login');
|
|
62
|
-
}
|
|
63
|
-
return <>{children}</>;
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
# Pages
|
|
68
|
-
|
|
69
|
-
- https://nextjs.org/docs/app/api-reference/file-conventions/dynamic-routes
|
|
70
|
-
- https://nextjs.org/docs/app/getting-started/layouts-and-pages#rendering-with-search-params
|
|
71
|
-
- https://nextjs.org/docs/app/getting-started/layouts-and-pages#creating-a-dynamic-segment
|
|
72
|
-
|
|
73
|
-
Always use https://nextjs.org/docs/app/api-reference/file-conventions/page#page-props-helper.
|
|
74
|
-
|
|
75
|
-
Always use the following pattern for all pages:
|
|
76
|
-
|
|
77
|
-
```tsx
|
|
78
|
-
export default async function Page({ params, searchParams }: PageProps<'/blog/[slug]'>) {
|
|
79
|
-
const { slug } = await params;
|
|
80
|
-
const { filter } = await searchParams;
|
|
81
|
-
return <h1>Blog post: {slug}</h1>;
|
|
82
|
-
}
|
|
83
|
-
```
|
package/rules/storybook.md
CHANGED
package/rules/tailwind.md
CHANGED
package/rules/webstorm.md
CHANGED
|
@@ -2,219 +2,11 @@
|
|
|
2
2
|
type: always_apply
|
|
3
3
|
description: IDEA / WebStorm patterns
|
|
4
4
|
paths:
|
|
5
|
-
- '**/.idea
|
|
6
|
-
- '**/.
|
|
5
|
+
- '**/.idea/**/*.*'
|
|
6
|
+
- '**/.gitignore'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
**ALL** IDEA / WebStorm projects must adhere to
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Configure `.idea/%projectName%.iml`
|
|
14
|
-
|
|
15
|
-
```xml
|
|
16
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
17
|
-
<module type="WEB_MODULE" version="4">
|
|
18
|
-
<component name="NewModuleRootManager">
|
|
19
|
-
<content url="file://$MODULE_DIR$">
|
|
20
|
-
<excludeFolder url="file://$MODULE_DIR$/.yarn" />
|
|
21
|
-
<excludePattern pattern=".turbo" />
|
|
22
|
-
<excludePattern pattern=".nx" />
|
|
23
|
-
<excludePattern pattern="build" />
|
|
24
|
-
<excludePattern pattern="coverage" />
|
|
25
|
-
<excludePattern pattern="dist" />
|
|
26
|
-
</content>
|
|
27
|
-
<orderEntry type="inheritedJdk" />
|
|
28
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
29
|
-
</component>
|
|
30
|
-
</module>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
# Configure `.idea/jsLibraryMappings.xml`
|
|
34
|
-
|
|
35
|
-
```xml
|
|
36
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
37
|
-
<project version="4">
|
|
38
|
-
<component name="JavaScriptLibraryMappings">
|
|
39
|
-
<includedPredefinedLibrary name="Node.js Core" />
|
|
40
|
-
</component>
|
|
41
|
-
</project>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
# Configure `.idea/prettier.xml`
|
|
45
|
-
|
|
46
|
-
```xml
|
|
47
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
48
|
-
<project version="4">
|
|
49
|
-
<component name="PrettierConfiguration">
|
|
50
|
-
<option name="myConfigurationMode" value="AUTOMATIC" />
|
|
51
|
-
<option name="myRunOnSave" value="true" />
|
|
52
|
-
<option name="myRunOnReformat" value="true" />
|
|
53
|
-
<option name="myFilesPattern" value="{**/*,*}.{js,jsx,ts,tsx,cjs,cts,mjs,mts,md,mdx,htm,html,vue,css,scss,sass,less,yml,yaml,json,json5,graphql,graphqls,xml}" />
|
|
54
|
-
</component>
|
|
55
|
-
</project>
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
# Configure `.idea/jsLinters/eslint.xml`
|
|
59
|
-
|
|
60
|
-
```xml
|
|
61
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
62
|
-
<project version="4">
|
|
63
|
-
<component name="EslintConfiguration">
|
|
64
|
-
<files-pattern value="**/*.{js,jsx,ts,tsx,cjs,cts,mjs,mts,md,mdx,htm,html,vue}" />
|
|
65
|
-
<option name="fix-on-save" value="true" />
|
|
66
|
-
</component>
|
|
67
|
-
</project>
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
# Configure `.idea/vcs.xml`
|
|
71
|
-
|
|
72
|
-
```xml
|
|
73
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
74
|
-
<project version="4">
|
|
75
|
-
<component name="CommitMessageInspectionProfile">
|
|
76
|
-
<profile version="1.0">
|
|
77
|
-
<inspection_tool class="BodyLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
|
78
|
-
<option name="RIGHT_MARGIN" value="100" />
|
|
79
|
-
</inspection_tool>
|
|
80
|
-
<inspection_tool class="SubjectBodySeparation" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
81
|
-
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
|
82
|
-
<option name="RIGHT_MARGIN" value="100" />
|
|
83
|
-
</inspection_tool>
|
|
84
|
-
</profile>
|
|
85
|
-
</component>
|
|
86
|
-
<component name="GitSharedSettings">
|
|
87
|
-
<option name="FORCE_PUSH_PROHIBITED_PATTERNS">
|
|
88
|
-
<list />
|
|
89
|
-
</option>
|
|
90
|
-
</component>
|
|
91
|
-
<component name="VcsDirectoryMappings">
|
|
92
|
-
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
93
|
-
</component>
|
|
94
|
-
</project>
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
# GitIgnore
|
|
98
|
-
|
|
99
|
-
Folders defined in `.gitignore` should match with `.idea/%project_name%.iml` (usually only one IML file).
|
|
100
|
-
|
|
101
|
-
## Configure `.idea/.gitignore`:
|
|
102
|
-
|
|
103
|
-
```gitignore
|
|
104
|
-
# Default ignored files
|
|
105
|
-
/shelf/
|
|
106
|
-
/workspace.xml
|
|
107
|
-
# Editor-based HTTP Client requests
|
|
108
|
-
/httpRequests/
|
|
109
|
-
AugmentWebviewStateStore.xml
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
# Configure `.idea/codeStyles/codeStyleConfig.xml`
|
|
113
|
-
|
|
114
|
-
```xml
|
|
115
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
116
|
-
<state>
|
|
117
|
-
<option name="PREFERRED_PROJECT_CODE_STYLE" value="DiS" />
|
|
118
|
-
</state>
|
|
119
|
-
</component>
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
# Configure `.idea/tailwindcss.xml`
|
|
123
|
-
|
|
124
|
-
Applies if project is using Tailwind.
|
|
125
|
-
|
|
126
|
-
```xml
|
|
127
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
128
|
-
<project version="4">
|
|
129
|
-
<component name="TailwindSettings">
|
|
130
|
-
<option name="lspConfiguration" value="{ "inspectPort": null, "emmetCompletions": false, "classAttributes": ["class", "className", "activeClassName", "disabledClassName", "ngClass", "class:list"], "classFunctions": [], "codeActions": true, "codeLens": true, "hovers": true, "suggestions": true, "validate": true, "colorDecorators": true, "rootFontSize": 16, "lint": { "cssConflict": "warning", "invalidApply": "error", "invalidScreen": "error", "invalidVariant": "error", "invalidConfigPath": "error", "invalidTailwindDirective": "error", "invalidSourceDirective": "error", "recommendedVariantOrder": "warning", "usedBlocklistedClass": "warning" }, "showPixelEquivalents": true, "includeLanguages": { "ftl": "html", "jinja": "html", "jinja2": "html", "smarty": "html", "tmpl": "gohtml", "cshtml": "html", "vbhtml": "html", "razor": "html" }, "files": { "exclude": [ "**/.git/**", "**/.hg/**", "**/.svn/**", "**/node_modules/**", "**/.yarn/**", "**/.venv/**", "**/venv/**", "**/.next/**", "**/.parcel-cache/**", "**/.svelte-kit/**", "**/.turbo/**", "**/__pycache__/**" ] }, "experimental": { "configFile": null, "classRegex": [ "Classes\\s*=\\s*['\"`]([^'\"`]*?)['\"`]", "['\"`]([^'\"`]*?)['\"`]", "Styles\\s*=\\s*['\"`]([^'\"`]*?)['\"`]", "['\"`]([^'\"`]*?)['\"`]" ] } }" />
|
|
131
|
-
</component>
|
|
132
|
-
</project>
|
|
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
|
-
```
|
|
180
|
-
|
|
181
|
-
# Configure `indexLayout.xml`
|
|
182
|
-
|
|
183
|
-
Ban build directories from search using examples:
|
|
184
|
-
|
|
185
|
-
```xml
|
|
186
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
187
|
-
<project version="4">
|
|
188
|
-
<component name="UserContentModel">
|
|
189
|
-
<attachedFolders />
|
|
190
|
-
<explicitIncludes>
|
|
191
|
-
</explicitIncludes>
|
|
192
|
-
<explicitExcludes>
|
|
193
|
-
<Path>path-to-eve/.eve</Path>
|
|
194
|
-
<Path>path-to-vite/dist</Path>
|
|
195
|
-
<Path>path-to-next/.next</Path>
|
|
196
|
-
</explicitExcludes>
|
|
197
|
-
</component>
|
|
198
|
-
</project>
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
# Git Worktrees
|
|
202
|
-
|
|
203
|
-
`.idea/%projectName%.iml`, `.idea/modules.xml` and `.idea/.name` are usually tracked. Every git worktree therefore checks out a module with the same name as the main checkout's, and WebStorm refuses to attach it: `Cannot attach project: Module name '%projectName%' already exists`.
|
|
204
|
-
|
|
205
|
-
- When creating a worktree, ALWAYS give it a distinct module and project name derived from the branch, e.g. `Packing Travel App` for `travel-app`:
|
|
206
|
-
1. **Rename** — do not copy — `.idea/%projectName%.iml` to `.idea/%projectName% %Branch Title%.iml`. The module name is the file name, and attaching the worktree registers whichever `.iml` it finds: a copy beside the original still attaches as `%projectName%`.
|
|
207
|
-
2. Point `.idea/modules.xml` at the renamed file.
|
|
208
|
-
3. Write the same name into `.idea/.name`.
|
|
209
|
-
4. A main project the worktree is attached to lists it in its own `.idea/modules.xml`: point that entry at the renamed file too.
|
|
210
|
-
- Keep the rename local, and NEVER commit it or merge it back:
|
|
211
|
-
- The tracked `.iml` first: stage the branch's own edits to it (`git add .idea/%projectName%.iml`), then `git update-index --skip-worktree .idea/%projectName%.iml`, then rename. The staged content is what the branch commits; the rename never shows as a deletion. An edit the branch later makes to the renamed file has to be staged back the same way.
|
|
212
|
-
- Ignore the renamed file in the shared `.git/info/exclude` with the pattern `.idea/%projectName% *.iml`.
|
|
213
|
-
- A **tracked** `.idea/modules.xml` or `.idea/.name`: run `git update-index --skip-worktree` on it.
|
|
214
|
-
- An **untracked** one (often `modules.xml` is in `.idea/.gitignore` and `.name` does not exist yet): `skip-worktree` fails on it, so leave it to `.idea/.gitignore` or add it to the shared `.git/info/exclude` as well (e.g. `.idea/.name`).
|
|
215
|
-
- Verify with `git status --short .idea`: nothing from the rename is listed, only the staged edits.
|
|
216
|
-
- Before a rebase, merge or checkout that updates those files (tracked ones only):
|
|
217
|
-
1. Rename the `.iml` back and run `git update-index --no-skip-worktree` on every file marked above.
|
|
218
|
-
2. Restore them with `git checkout -- <files>`.
|
|
219
|
-
3. Redo the rename afterwards.
|
|
220
|
-
- A worktree created **inside** the main checkout (e.g. `.claude/worktrees/<name>`, where agents put theirs) is indexed by the main project as part of itself, a second copy of every source and `node_modules`, and the main project's save actions start reformatting the worktree's files. Exclude its folder in the main checkout's `.idea/%projectName%.iml` (`<excludeFolder url="file://$MODULE_DIR$/.claude/worktrees" />`) and list it in `.gitignore`, so the folder rule under [GitIgnore](#gitignore) holds. Attaching such a worktree can replace the main checkout's own entry in its `.idea/modules.xml`: keep both — the main `.idea/%projectName%.iml` and the worktree's renamed one — then reload the project. A nested worktree shows as its own module node inside the tree, not as a separate top-level project; for a top-level entry, create the worktree outside the main checkout.
|
|
9
|
+
- **ALL** IDEA / WebStorm projects must adhere to the `lint-webstorm` skill templates unless explicitly prohibited - use the skill to set up or check `.idea` files
|
|
10
|
+
- Preserve already existing settings, add what's safe, ask user how to merge if there are conflicts
|
|
11
|
+
- Heavy folders nothing needs to search (`dist`, `build`, `coverage`, `.next`, `.nx`, `.turbo`, `.worktrees`, ...) are excluded in three places: `.gitignore`, "Mark as excluded" (`excludeFolder` / `excludePattern` in `.idea/%projectName%.iml`) and index exclusion (`.idea/indexLayout.xml`) - keep the three in sync, or at least on a shared baseline: some folders are only git-ignored, others only marked as excluded
|
|
12
|
+
- Git worktrees clash with IDEA module names - use the `lint-worktree` skill
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-github
|
|
3
|
+
description: Describes how to work with Github & example workflow as a reference which essential jobs and concepts usual Github Workflow should have
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
```yml
|
|
7
|
+
name: Release
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
branches:
|
|
12
|
+
- main
|
|
13
|
+
|
|
14
|
+
# If project publishes to NPM
|
|
15
|
+
permissions:
|
|
16
|
+
id-token: write # Required for OIDC
|
|
17
|
+
contents: read
|
|
18
|
+
|
|
19
|
+
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
release:
|
|
23
|
+
name: Release
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
env:
|
|
26
|
+
TURBO_CACHE_DIR: .turbo # if project uses Turbo
|
|
27
|
+
YARN_ENABLE_GLOBAL_CACHE: false # so that .yarn/cache is written
|
|
28
|
+
|
|
29
|
+
# If project publishes to NPM
|
|
30
|
+
# https://davistobias.com/articles/adding-changeset/#2.1.b-adding-changeset-to-github-workflows
|
|
31
|
+
if: github.repository == 'kirill-konshin/utils'
|
|
32
|
+
permissions:
|
|
33
|
+
id-token: write # Required for OIDC trusted publishing
|
|
34
|
+
contents: write
|
|
35
|
+
pull-requests: write
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- name: Checkout Repo
|
|
39
|
+
uses: actions/checkout@v4
|
|
40
|
+
|
|
41
|
+
- name: Enable Corepack
|
|
42
|
+
run: corepack enable
|
|
43
|
+
|
|
44
|
+
- name: Setup Node.js
|
|
45
|
+
uses: actions/setup-node@v6
|
|
46
|
+
with:
|
|
47
|
+
node-version: 24
|
|
48
|
+
registry-url: 'https://registry.npmjs.org'
|
|
49
|
+
cache: yarn
|
|
50
|
+
cache-dependency-path: yarn.lock
|
|
51
|
+
|
|
52
|
+
#TODO https://turbo.build/repo/docs/guides/ci-vendors/github-actions#remote-caching
|
|
53
|
+
#TODO https://turborepo.dev/docs/guides/ci-vendors/github-actions#remote-caching-with-github-actionscache
|
|
54
|
+
- name: Cache Turbo
|
|
55
|
+
uses: actions/cache@v6
|
|
56
|
+
with:
|
|
57
|
+
path: .turbo
|
|
58
|
+
key: ${{ runner.os }}-turbo-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
|
|
59
|
+
restore-keys: |
|
|
60
|
+
${{ runner.os }}-turbo-${{ github.run_id }}-${{ github.run_attempt }}-
|
|
61
|
+
${{ runner.os }}-turbo-
|
|
62
|
+
|
|
63
|
+
- name: Cache Nx
|
|
64
|
+
uses: actions/cache@v6
|
|
65
|
+
with:
|
|
66
|
+
path: .nx/cache
|
|
67
|
+
key: ${{ runner.os }}-nx-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
|
|
68
|
+
restore-keys: |
|
|
69
|
+
${{ runner.os }}-nx-${{ github.run_id }}-${{ github.run_attempt }}-
|
|
70
|
+
${{ runner.os }}-nx-
|
|
71
|
+
|
|
72
|
+
- name: Install dependencies
|
|
73
|
+
run: yarn install --immutable
|
|
74
|
+
|
|
75
|
+
# Add this if Yarn 2+ is used and package is NOT private, otherwise postinstall should be configured, and this block skipped
|
|
76
|
+
- name: Prepare
|
|
77
|
+
run: yarn prepare
|
|
78
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-gitlab
|
|
3
|
+
description: Describes how to work with Gitlab Pipelines & example pipeline as a reference which essential jobs and concepts usual Gitlab project should have
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
```yml
|
|
7
|
+
image: node:lts
|
|
8
|
+
|
|
9
|
+
variables:
|
|
10
|
+
YARN_ENABLE_GLOBAL_CACHE: false # so that .yarn/cache is written
|
|
11
|
+
|
|
12
|
+
cache:
|
|
13
|
+
- key:
|
|
14
|
+
prefix: yarn
|
|
15
|
+
files:
|
|
16
|
+
- yarn.lock # dependencies cached based on lockfile
|
|
17
|
+
paths:
|
|
18
|
+
- .yarn/cache
|
|
19
|
+
policy: pull-push
|
|
20
|
+
# Job-specific keys prevent parallel jobs from replacing each other's local build cache.
|
|
21
|
+
- key: build-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
|
|
22
|
+
fallback_keys:
|
|
23
|
+
- build-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH
|
|
24
|
+
paths:
|
|
25
|
+
- .turbo
|
|
26
|
+
- .nx/cache
|
|
27
|
+
- '**/.tscache'
|
|
28
|
+
- '**/.tsbuildinfo'
|
|
29
|
+
- '**/.next/cache'
|
|
30
|
+
policy: pull-push
|
|
31
|
+
|
|
32
|
+
stages:
|
|
33
|
+
- install
|
|
34
|
+
- test
|
|
35
|
+
- build
|
|
36
|
+
|
|
37
|
+
# separate so that cache can pre-populate if other steps would fail, it speeds things up
|
|
38
|
+
before_script:
|
|
39
|
+
- corepack enable
|
|
40
|
+
- yarn install --immutable
|
|
41
|
+
- yarn prepare # Add this if Yarn 2+ is used and package is NOT private, otherwise postinstall should be configured, and this line skipped
|
|
42
|
+
|
|
43
|
+
install:
|
|
44
|
+
stage: install
|
|
45
|
+
script:
|
|
46
|
+
- echo Done
|
|
47
|
+
|
|
48
|
+
lint:
|
|
49
|
+
stage: test
|
|
50
|
+
script:
|
|
51
|
+
- yarn lint
|
|
52
|
+
|
|
53
|
+
test:
|
|
54
|
+
stage: test
|
|
55
|
+
image: mcr.microsoft.com/playwright:v1.50.0-noble # keep in sync with installed Playwright version
|
|
56
|
+
artifacts:
|
|
57
|
+
when: always
|
|
58
|
+
paths:
|
|
59
|
+
- test-results
|
|
60
|
+
- test-results-html
|
|
61
|
+
reports:
|
|
62
|
+
junit: test-results/junit.xml
|
|
63
|
+
script:
|
|
64
|
+
- yarn test:playwright # https://playwright.dev/docs/ci#running-headed xvfb-run yarn test:playwright
|
|
65
|
+
|
|
66
|
+
# Not needed for Vercel-hosted projects
|
|
67
|
+
build:
|
|
68
|
+
stage: build
|
|
69
|
+
script:
|
|
70
|
+
- yarn build
|
|
71
|
+
only:
|
|
72
|
+
- master
|
|
73
|
+
artifacts:
|
|
74
|
+
paths:
|
|
75
|
+
- web/build
|
|
76
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-nextjs
|
|
3
|
+
description: Describes key patterns how to work with Next.js
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Layouts
|
|
7
|
+
|
|
8
|
+
Always use https://nextjs.org/docs/app/api-reference/file-conventions/layout#layout-props-helper:
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import React from 'react';
|
|
12
|
+
|
|
13
|
+
export default function Layout({ children, analytics }: LayoutProps<'/dashboard'>) {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
{children}
|
|
17
|
+
{/* If you have app/dashboard/@analytics, it appears as a typed slot: */}
|
|
18
|
+
{analytics}
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Check auth in layouts pattern
|
|
25
|
+
|
|
26
|
+
Prefer `/app/(auth)/layout.tsx` as root layout for auth protection. This won't create path segment, but will protect all routes under it.
|
|
27
|
+
|
|
28
|
+
Route Handlers are not protected by layouts, so add auth check there too.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import React from 'react';
|
|
32
|
+
import { redirect } from 'next/navigation';
|
|
33
|
+
import { getToken } from '@/lib/auth';
|
|
34
|
+
|
|
35
|
+
export default async function Layout({ children }: LayoutProps<'/dashboard'>) {
|
|
36
|
+
if (!(await getToken())) {
|
|
37
|
+
redirect('/login');
|
|
38
|
+
}
|
|
39
|
+
return <>{children}</>;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
# Pages
|
|
44
|
+
|
|
45
|
+
- https://nextjs.org/docs/app/api-reference/file-conventions/dynamic-routes
|
|
46
|
+
- https://nextjs.org/docs/app/getting-started/layouts-and-pages#rendering-with-search-params
|
|
47
|
+
- https://nextjs.org/docs/app/getting-started/layouts-and-pages#creating-a-dynamic-segment
|
|
48
|
+
|
|
49
|
+
Always use https://nextjs.org/docs/app/api-reference/file-conventions/page#page-props-helper.
|
|
50
|
+
|
|
51
|
+
Always use the following pattern for all pages:
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
export default async function Page({ params, searchParams }: PageProps<'/blog/[slug]'>) {
|
|
55
|
+
const { slug } = await params;
|
|
56
|
+
const { filter } = await searchParams;
|
|
57
|
+
return <h1>Blog post: {slug}</h1>;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
@@ -20,7 +20,7 @@ Follow @README.md, reconciling (never blindly overwriting project-specific overr
|
|
|
20
20
|
2. **Config** — create/reconcile `.editorconfig`, `eslint.config.mjs` and `.prettierrc.mjs` (pass `defineLintConfig` options as needed — e.g. `defaultIgnore: { importMetaUrl: import.meta.url }`, `next: { rootDir }` — and keep project rule overrides).
|
|
21
21
|
3. **Lint-staged** — create/reconcile `.lintstagedrc.mjs`.
|
|
22
22
|
4. **Husky** — `prepare/postinstall` (`prepare` by default, `postinstall` if Yarn 2+ is used AND root package.json is **private**) script; `.husky/pre-commit`, plus `eslint`/`prettier`/`lint`/`lint:staged` scripts. Drop a legacy `lint:all` if it duplicates `lint`.
|
|
23
|
-
5. **IDEA** — apply
|
|
23
|
+
5. **IDEA** — apply `lint-webstorm` if the repo has a JetBrains `.idea`.
|
|
24
24
|
6. **Install** — run the package manager (`yarn` / `npm install` / `pnpm install`) so the new deps and Husky hooks land. Under Yarn 2+ check if root `package.json` has `prepare` script, and if it does, run it.
|
|
25
25
|
|
|
26
26
|
Check the README's "Issues" section before debugging a lint crash.
|