@kirill.konshin/lint 0.3.4 → 0.3.6

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 CHANGED
@@ -374,6 +374,7 @@ paths:
374
374
  - [ ] Yarn 1 (classic) — root detection now delegates to `@manypkg/find-root` (workspace-manifest walk); unverified since the switch
375
375
  - [ ] pnpm — root detection via `@manypkg/find-root` (`pnpm-workspace.yaml`); `public-hoist-pattern` guidance unverified in a real pnpm workspace
376
376
  - [ ] npm — env fast-path (`npm_config_local_prefix`) verified previously; `@manypkg/find-root` fallback unverified since the switch
377
+ - [ ] Explore Yarn [constraints](https://yarnpkg.com/features/constraints) & add a helper to Lint package so Yarn enforces version consistency w/o `overrides`, but be careful not to screw up NPM dependencies
377
378
  - ESLint 9
378
379
  - [x] https://github.com/microsoft/rushstack/issues/4635 Failed to patch ESLint because the calling module was not recognized
379
380
  - [x] https://github.com/microsoft/rushstack/issues/4965 Failed to patch ESLint because the calling module was not recognized
package/lintPrepare.js CHANGED
@@ -38,8 +38,7 @@ This file is auto-generated by @kirill.konshin/lint. Do not edit directly - cust
38
38
 
39
39
  ---`;
40
40
 
41
- const FOOTER = `
42
- ---
41
+ const FOOTER = `---
43
42
 
44
43
  # Custom Rules
45
44
 
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",
4
+ "version": "0.3.6",
5
5
  "type": "module",
6
6
  "skipGenerate": true,
7
7
  "bin": {
package/rules/github.md CHANGED
@@ -28,6 +28,7 @@ jobs:
28
28
  runs-on: ubuntu-latest
29
29
  env:
30
30
  TURBO_CACHE_DIR: .turbo # if project uses Turbo
31
+ YARN_ENABLE_GLOBAL_CACHE: false # so that .yarn/cache is written
31
32
 
32
33
  # If project publishes to NPM
33
34
  # https://davistobias.com/articles/adding-changeset/#2.1.b-adding-changeset-to-github-workflows
@@ -52,20 +53,40 @@ jobs:
52
53
  - name: Enable Corepack
53
54
  run: corepack enable
54
55
 
55
- - name: Install dependencies
56
- run: yarn install --immutable
56
+ - name: Get yarn cache directory path
57
+ id: yarn-cache-dir-path
58
+ run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
57
59
 
58
- # Add this if Yarn 2+ is used and package is NOT private
59
- - name: Prepare
60
- run: yarn prepare
60
+ - uses: actions/cache@v6
61
+ id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
62
+ with:
63
+ path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
64
+ key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
65
+ restore-keys: |
66
+ ${{ runner.os }}-yarn-
61
67
 
62
- #TODO https://turbo.build/repo/docs/guides/ci-vendors/github-actions#remote-caching
68
+ #TODO https://turbo.build/repo/docs/guides/ci-vendors/github-actions#remote-caching
63
69
  #TODO https://turborepo.dev/docs/guides/ci-vendors/github-actions#remote-caching-with-github-actionscache
64
- - name: Cache turbo build setup
65
- uses: actions/cache@v4
70
+ - name: Cache Turbo
71
+ uses: actions/cache@v6
66
72
  with:
67
73
  path: .turbo
68
74
  key: ${{ runner.os }}-turbo-${{ github.sha }}
69
75
  restore-keys: |
70
76
  ${{ runner.os }}-turbo-
77
+
78
+ - name: Cache NX
79
+ uses: actions/cache@v6
80
+ with:
81
+ path: .nx
82
+ key: ${{ runner.os }}-turbo-${{ github.sha }}
83
+ restore-keys: |
84
+ ${{ runner.os }}-turbo-
85
+
86
+ - name: Install dependencies
87
+ run: yarn install --immutable
88
+
89
+ # Add this if Yarn 2+ is used and package is NOT private, otherwise postinstall should be configured, and this block skipped
90
+ - name: Prepare
91
+ run: yarn prepare
71
92
  ```
package/rules/gitlab.md CHANGED
@@ -11,23 +11,67 @@ paths:
11
11
  # Example
12
12
 
13
13
  ```yml
14
- build:
15
- image: node:24
16
- cache:
17
- key:
18
- files:
19
- - yarn.lock
14
+ image: node:lts
15
+
16
+ variables:
17
+ YARN_ENABLE_GLOBAL_CACHE: false # so that .yarn/cache is written
18
+
19
+ cache:
20
+ - key:
21
+ files:
22
+ - yarn.lock # dependencies cached based on lockfile
23
+ paths:
24
+ - .yarn
25
+ - .pnp.js
26
+ - yarn.lock
27
+ - node_modules
28
+ - '**/node_modules'
29
+ - key: $CI_COMMIT_REF_NAME # build-related files cached per-branch
30
+ paths:
31
+ - '**/.turbo'
32
+ - '**/.nx'
33
+ - '**/.tscache'
34
+ - '**/.tsbuildinfo'
35
+ - '**/.next/cache'
36
+
37
+ stages:
38
+ - install
39
+ - test
40
+ - build
41
+
42
+ # separate so that cache can pre-populate if other steps would fail, it speeds things up
43
+ before_script:
44
+ - corepack enable
45
+ - yarn install --immutable
46
+ - yarn prepare # Add this if Yarn 2+ is used and package is NOT private, otherwise postinstall should be configured, and this line skipped
47
+
48
+ install:
49
+ stage: install
50
+ script:
51
+ - echo Done
52
+
53
+ lint:
54
+ stage: test
55
+ script:
56
+ - yarn lint
57
+
58
+ test:
59
+ stage: test
60
+ image: mcr.microsoft.com/playwright:v1.50.0-noble # keep in sync with installed Playwright version
61
+ artifacts:
62
+ when: always
20
63
  paths:
21
- - .yarn/cache
22
- - yarn.lock
23
- - node_modules
24
- - '**/node_modules'
25
- - '**/.turbo'
26
- - '**/.tscache'
27
- - web/.next/cache
64
+ - test-results
65
+ - test-results-html
66
+ reports:
67
+ junit: test-results/junit.xml
68
+ script:
69
+ - yarn test:playwright # https://playwright.dev/docs/ci#running-headed xvfb-run yarn test:playwright
70
+
71
+ # Not needed for Vercel-hosted projects
72
+ build:
73
+ stage: build
28
74
  script:
29
- - yarn --immutable
30
- - yarn prepare # Add this if Yarn 2+ is used and package is NOT private
31
75
  - yarn build
32
76
  only:
33
77
  - master
@@ -35,3 +79,12 @@ build:
35
79
  paths:
36
80
  - web/build
37
81
  ```
82
+
83
+ Cache `.yarn` individually is possible but not needed:
84
+
85
+ ```yaml
86
+ - .yarn/cache
87
+ - .yarn/unplugged
88
+ - .yarn/build-state.yml
89
+ - .yarn/install-state.gz
90
+ ```
package/rules/npm-yarn.md CHANGED
@@ -30,7 +30,7 @@ description: NPM & Yarn patterns
30
30
 
31
31
  # Consistent versions
32
32
 
33
- In Monorepos pin versions of sub-packages to main.
33
+ In Monorepos pin versions of sub-packages to main. Listed packages were seen to cause issues when versions drift.
34
34
 
35
35
  https://github.com/raineorshine/npm-check-updates/issues/1332#issuecomment-1717862332
36
36
  https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides
@@ -40,9 +40,22 @@ Root `package.json`:
40
40
  ```json
41
41
  {
42
42
  "overrides": {
43
+ "@types/node": "$@types/node",
44
+ "@types/react": "$@types/react",
45
+ "@types/react-dom": "$@types/react-dom",
43
46
  "next": "$next",
44
47
  "eslint": "$eslint",
45
- "typescript": "$typescript"
48
+ "typescript": "$typescript",
49
+ "vite": "$vite"
50
+ },
51
+ "resolutions": {
52
+ "@types/node": "^26",
53
+ "@types/react": "^19",
54
+ "@types/react-dom": "^19",
55
+ "eslint": "^10",
56
+ "next": "^16",
57
+ "typescript": "^6",
58
+ "vite": "^8"
46
59
  }
47
60
  }
48
61
  ```
@@ -58,12 +71,25 @@ All other `package.json`:
58
71
  }
59
72
  ```
60
73
 
74
+ ⚠️ Attention! Yarn does not support `overrides` with `$xxx` syntax, use `resolutions` instead. AI Agent MUST keep versions listed in `resolutions` in sync with real ones from `dependencies` and `devDependencies`, if it breaks anything, drop `resolutions` field and fix by changing actual dependencies in leaves to match root.
75
+
61
76
  # `.yarnrc.yml`
62
77
 
78
+ Make sure `yarnPath` is not specified, rely on `packageManager` in `package.json` and Corepack.
79
+
63
80
  ```yml
64
- yarnPath: .yarn/releases/yarn-4.5.1.cjs
81
+ approvedGitRepositories:
82
+ - '**'
83
+
84
+ compressionLevel: mixed
85
+
86
+ enableScripts: true
87
+
65
88
  nodeLinker: node-modules
66
- # compressionLevel: mixed
67
- # enableGlobalCache: false
68
- # checksumBehavior: update
89
+
90
+ npmMinimalAgeGate: 0
91
+
92
+ # own packages are exempt from the minimum-release-age quarantine (npmMinimalAgeGate)
93
+ npmPreapprovedPackages:
94
+ - '@kirill.konshin/*'
69
95
  ```