@kirill.konshin/lint 0.7.0 → 0.7.1
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
|
@@ -164,6 +164,8 @@ Not carried over: `@nx/dependency-checks` (Oxlint does not lint JSON), `@typescr
|
|
|
164
164
|
"postinstall": "lint-prepare init && vp config", // this order: vp config fills the Vite+ section lint-prepare writes; `prepare` for published roots, see npm-yarn rule
|
|
165
165
|
"lint": "vp check --fix",
|
|
166
166
|
"lint:staged": "vp staged",
|
|
167
|
+
"build": "vp run -r build", // every workspace package, in dependency order
|
|
168
|
+
"start": "vp run -r --parallel start",
|
|
167
169
|
},
|
|
168
170
|
}
|
|
169
171
|
```
|
package/package.json
CHANGED
package/rules/npm-yarn.md
CHANGED
|
@@ -9,6 +9,7 @@ description: NPM & Yarn patterns
|
|
|
9
9
|
# Vite+
|
|
10
10
|
|
|
11
11
|
- IF `vite-plus` is installed, use `vp` commands: `vp check` (format + lint + type checks), `vp lint`, `vp fmt`, `vp test`, `vp pack` (libraries), `vp build` (apps), `vp staged`, `vp config` (git hooks)
|
|
12
|
+
- Workspace-wide root scripts use `vp run`, not `yarn workspaces foreach`: `"build": "vp run -r build"` (dependency order), `"start": "vp run -r --parallel start"`, `"clean": "vp run -r clean && rm -rf node_modules"`; `-r` includes the root package, so the root script's other steps run too
|
|
12
13
|
- IF `vite-plus` is not installed, use the old style: package scripts with ESLint, Prettier, lint-staged, Husky
|
|
13
14
|
- Vite+ requires the `node-modules` linker (no Yarn PnP) and pins `vite` to its core and `vitest` to its bundled version at the root (see the `@kirill.konshin/lint` README)
|
|
14
15
|
|
|
@@ -27,7 +28,8 @@ description: NPM & Yarn patterns
|
|
|
27
28
|
|
|
28
29
|
- Hoist everything: keep the package manager's DEFAULT hoisting — do not set `installConfig.hoistingLimits`/`nmHoistingLimits` or Yarn 1 `nohoist`; the historical React Native/Expo/Electron reasons are obsolete (Metro follows symlinks since RN 0.72, Expo SDK 54+ supports monorepos with any strategy, hoisting limits break Electron Forge and duplicate React instances)
|
|
29
30
|
- Electron + pnpm needs MORE hoisting, not less: set `node-linker=hoisted` (or `shamefully-hoist=true`) in `.npmrc`, otherwise packaged apps miss dependencies (electron-builder/electron-vite guidance)
|
|
30
|
-
-
|
|
31
|
+
- Electron + Next.js `output: 'standalone'` in a hoisted workspace: Next.js traces dependencies into `.next/standalone/node_modules`, beside the app folder `.next/standalone/<app>` — package that folder too (electron-builder `files`), never limit hoisting for it; see the `lint-electron` skill
|
|
32
|
+
- Binary packagers don't need hoisting limits either: bundle to a single file first, then package — node_modules layout becomes irrelevant; build Node SEA executables with `vp pack` (`exe`, Node ≥ 25.7) when Vite+ is used, else `@yao-pkg/pkg` (maintained fork of the deprecated `vercel/pkg`); a Next.js standalone server cannot be bundled into one file: ship its files as SEA assets and extract them on the first start
|
|
31
33
|
- Shared root configs (e.g. `@kirill.konshin/lint`) must be able to resolve leaf tools (`next`, `tailwindcss`, `storybook`, `jest`) from the workspace root:
|
|
32
34
|
- npm / Yarn: default hoisting already exposes them
|
|
33
35
|
- pnpm: add to `.npmrc`: `public-hoist-pattern[]=next`, `public-hoist-pattern[]=tailwindcss`, `public-hoist-pattern[]=storybook`, `public-hoist-pattern[]=jest` (`*eslint*`/`*prettier*` are hoisted by default)
|
|
@@ -1,8 +1,61 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lint-electron
|
|
3
|
-
description: Skill for Electron-based apps
|
|
3
|
+
description: Skill for Electron-based apps - dev runner that restarts Electron (vp pack --watch), packaging a Next.js standalone server with electron-builder in a hoisted monorepo, CI builds. Use when setting up, running or packaging an Electron app.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
# Dev Runner
|
|
7
|
+
|
|
8
|
+
ALWAYS run the main process in development with `vp pack --watch` (Vite+, tsdown), never `tsc-watch`, `nodemon` or `electron .` alone: it rebuilds the entrypoint and restarts Electron through `onSuccess` (tsdown stops the previous process). Files outside the main process module graph that need a restart (`next.config.*`: Next.js applies config only on a restart, like `next dev`; a linked library build) go in through a plugin — the `watch` option cannot list them, `--watch` overrides it with `true`:
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
|
|
13
|
+
import { defineConfig } from 'vite-plus';
|
|
14
|
+
|
|
15
|
+
const isWatch = process.argv.includes('--watch');
|
|
16
|
+
|
|
17
|
+
// absolute: Rolldown's `addWatchFile` takes them as is
|
|
18
|
+
const restartOn = ['next.config.ts'].map((file) => path.resolve(import.meta.dirname, file));
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
pack: {
|
|
22
|
+
entry: ['src-electron/index.ts'],
|
|
23
|
+
outDir: 'build',
|
|
24
|
+
format: 'esm',
|
|
25
|
+
platform: 'node',
|
|
26
|
+
fixedExtension: false,
|
|
27
|
+
dts: false,
|
|
28
|
+
deps: { neverBundle: true },
|
|
29
|
+
tsconfig: 'tsconfig-electron.json',
|
|
30
|
+
...(isWatch && {
|
|
31
|
+
plugins: [
|
|
32
|
+
{
|
|
33
|
+
name: 'restart-on',
|
|
34
|
+
buildStart() {
|
|
35
|
+
for (const file of restartOn) this.addWatchFile(file);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
onSuccess: 'cross-env NODE_ENV=development electron .',
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Scripts: `"start": "vp pack --watch"`, `"build:main": "vp pack"`.
|
|
46
|
+
|
|
47
|
+
# Packaging a Next.js Standalone Server
|
|
48
|
+
|
|
49
|
+
In a hoisted workspace (see npm-yarn rule) Next.js traces the server's dependencies into `.next/standalone/node_modules`, beside the app folder; package both, without Electron:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
files:
|
|
53
|
+
- build
|
|
54
|
+
- '.next/standalone/<app>/**/*'
|
|
55
|
+
- '.next/standalone/node_modules/**/*'
|
|
56
|
+
- '!.next/standalone/node_modules/electron'
|
|
57
|
+
```
|
|
58
|
+
|
|
6
59
|
# CI Builds
|
|
7
60
|
|
|
8
61
|
## Gitlab
|
|
@@ -24,7 +24,7 @@ Write the config by hand. `vp migrate` is only an optional first pass: it copies
|
|
|
24
24
|
|
|
25
25
|
1. **Install** — add `vite-plus`, `@kirill.konshin/lint` (+ `eslint` only for Nx module-boundary rules); pin `vite`/`vitest` at the root (README "Yarn constraints").
|
|
26
26
|
2. **Config** — root `vite.config.ts`: `defineConfig(vitePlusConfig({ ...project blocks }, { ...toggles }))`; move project rule overrides into `lint.rules` / `lint.overrides`, ignores into `ignorePatterns`. Keep `.editorconfig`.
|
|
27
|
-
3. **Hooks** — `lint-prepare init && vp config` in `prepare`/`postinstall` — in this order: `vp config` fills the Vite+ section `lint-prepare` writes into `AGENTS.md` (same choice as below), `.vite-hooks/pre-commit` with `vp staged`; scripts `lint: vp check --fix`, `lint:staged: vp staged
|
|
27
|
+
3. **Hooks** — `lint-prepare init && vp config` in `prepare`/`postinstall` — in this order: `vp config` fills the Vite+ section `lint-prepare` writes into `AGENTS.md` (same choice as below), `.vite-hooks/pre-commit` with `vp staged`; scripts `lint: vp check --fix`, `lint:staged: vp staged`; workspace-wide scripts move from `yarn workspaces foreach` to `vp run -r` (npm-yarn rule).
|
|
28
28
|
4. **Tests/builds** — tests import from `vite-plus/test`; libraries `vp pack`, apps `vp build`.
|
|
29
29
|
5. **CI** — `vp check` (no `--fix`), see `lint-github` / `lint-gitlab`.
|
|
30
30
|
6. **IDEA** — apply `lint-webstorm` if the repo has a JetBrains `.idea`.
|
|
@@ -164,6 +164,8 @@ AugmentWebviewStateStore.xml
|
|
|
164
164
|
|
|
165
165
|
# Configure `.idea/codeStyles/codeStyleConfig.xml`
|
|
166
166
|
|
|
167
|
+
`DiS` is the owner's personal IDE scheme; other developers may not have it. With Vite+ Oxfmt drives the IDE code style (`preferOxfmtCodeStyleSettings` in `OxfmtSettings.xml`) whatever this file selects, so the project never depends on it:
|
|
168
|
+
|
|
167
169
|
```xml
|
|
168
170
|
<component name="ProjectCodeStyleConfiguration">
|
|
169
171
|
<state>
|