@evertondgn/solid-tooling 0.4.0 → 0.5.0
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 +68 -12
- package/dist/commitlint.d.mts +3 -0
- package/dist/commitlint.mjs +28 -0
- package/lefthook.yml +55 -0
- package/package.json +31 -5
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# @evertondgn/solid-tooling
|
|
2
2
|
|
|
3
3
|
Lint preset, formatter config, TypeScript configs, test configs, the Knip and
|
|
4
|
-
Stylelint configs
|
|
5
|
-
built with
|
|
4
|
+
Stylelint configs, the Vite+ application config, the commitlint config and the
|
|
5
|
+
Git hooks for SolidJS 2 applications built with
|
|
6
|
+
[Vite+](https://viteplus.dev/guide/).
|
|
6
7
|
|
|
7
|
-
The package contains the lint, format, TypeScript, test, build, dead code
|
|
8
|
-
|
|
8
|
+
The package contains the lint, format, TypeScript, test, build, dead code, CSS
|
|
9
|
+
lint, commit message and Git hook setup of
|
|
9
10
|
[boilerplate_solidjs](https://github.com/everton-dgn/boilerplate_solidjs), a
|
|
10
11
|
SolidJS application template. Applications created from it install the package
|
|
11
12
|
instead of copying the files, so a rule change reaches them through a version
|
|
@@ -31,11 +32,13 @@ package, so the application does not declare them.
|
|
|
31
32
|
|
|
32
33
|
Some entries need tools the application already runs:
|
|
33
34
|
|
|
34
|
-
| Entry
|
|
35
|
-
|
|
|
36
|
-
| `./vitest`
|
|
37
|
-
| `./playwright`
|
|
38
|
-
| `./knip`
|
|
35
|
+
| Entry | The application installs |
|
|
36
|
+
| ---------------- | ------------------------------------------------------------------------------- |
|
|
37
|
+
| `./vitest` | `@vitest/browser-playwright`, `@vitest/coverage-v8`, `happy-dom`, `playwright` |
|
|
38
|
+
| `./playwright` | `@playwright/test`, an optional peer dependency pinned like the others |
|
|
39
|
+
| `./knip` | `knip` and `filesystem-routing`, optional peer dependencies pinned the same way |
|
|
40
|
+
| `./commitlint` | `@commitlint/cli`, an optional peer dependency pinned the same way |
|
|
41
|
+
| `./lefthook.yml` | `lefthook`, an optional peer dependency pinned the same way |
|
|
39
42
|
|
|
40
43
|
`./vite` also needs the test tools of `./vitest`, and loads four plugin
|
|
41
44
|
packages: `@solidjs/vite-plugin`, `nitro`, `filesystem-routing` and
|
|
@@ -403,6 +406,56 @@ config passes the plugin by a path resolved from the package, because Stylelint
|
|
|
403
406
|
looks up a plugin name from the application and its working directory, where it
|
|
404
407
|
is not installed.
|
|
405
408
|
|
|
409
|
+
## Commit messages and Git hooks
|
|
410
|
+
|
|
411
|
+
`./commitlint` is the commitlint config: the Conventional Commits rules of
|
|
412
|
+
`@commitlint/config-conventional`, with the header limited to 100 characters, a
|
|
413
|
+
blank line required before the footer, and a warning for body and footer lines
|
|
414
|
+
over 100 characters. The application installs `@commitlint/cli` and points its
|
|
415
|
+
config to the package:
|
|
416
|
+
|
|
417
|
+
```json
|
|
418
|
+
// .commitlintrc
|
|
419
|
+
{ "extends": ["@evertondgn/solid-tooling/commitlint"] }
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
`./lefthook.yml` holds the Git hooks. The application installs `lefthook`,
|
|
423
|
+
allows its install script and extends the file from its own `.lefthook.yml`:
|
|
424
|
+
|
|
425
|
+
```json
|
|
426
|
+
// package.json
|
|
427
|
+
{ "trustedDependencies": ["lefthook"] }
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
```yaml
|
|
431
|
+
# .lefthook.yml
|
|
432
|
+
extends:
|
|
433
|
+
- node_modules/@evertondgn/solid-tooling/lefthook.yml
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
| Hook | Jobs |
|
|
437
|
+
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
438
|
+
| `commit-msg` | `commitlint` on the message |
|
|
439
|
+
| `pre-commit` | `check:fix` on the staged files, which are staged again after the fix, and `scan:secrets --staged` when `kingfisher` is installed. Skipped in merge and rebase |
|
|
440
|
+
| `pre-push` | `check:ci`, `typecheck:node` and `test:ci` in order, then `test:tooling` and `dead-code` together. The first failure stops the rest |
|
|
441
|
+
|
|
442
|
+
The jobs call `package.json` scripts by name, so the application defines
|
|
443
|
+
`check:fix`, `scan:secrets`, `check:ci`, `typecheck:node`, `test:ci`,
|
|
444
|
+
`test:tooling` and `dead-code`.
|
|
445
|
+
|
|
446
|
+
Lefthook applies the files in `extends` over `.lefthook.yml`, so:
|
|
447
|
+
|
|
448
|
+
- A job added in `.lefthook.yml` runs before the shared jobs of the same hook.
|
|
449
|
+
- A job declared there with the name of a shared job does not change it.
|
|
450
|
+
- To change or skip a shared job, declare a job with the same name in
|
|
451
|
+
`lefthook-local.yml`, which Lefthook applies last, also inside a group. The
|
|
452
|
+
rest keeps its order, and new jobs in that file run after the shared ones.
|
|
453
|
+
Commit the file to change the job for everyone, or keep it out of Git to
|
|
454
|
+
change it on one machine.
|
|
455
|
+
|
|
456
|
+
Create `.lefthook.yml` before the first install. Without it, the install script
|
|
457
|
+
of Lefthook writes a `lefthook.yml` of its own, which Lefthook reads first.
|
|
458
|
+
|
|
406
459
|
## Project layout the preset expects
|
|
407
460
|
|
|
408
461
|
The rules match file paths relative to the folder where lint runs, so run it
|
|
@@ -558,12 +611,15 @@ overrides: [
|
|
|
558
611
|
| `./css-filename` | `cssFilenameError(path)`, the CSS naming check, for a script outside lint |
|
|
559
612
|
| `./knip` | `defineKnipConfig(options)`, the Knip config |
|
|
560
613
|
| `./stylelint` | `checkCss(root)` and `defineStylelintConfig(root)`, the CSS lint |
|
|
614
|
+
| `./commitlint` | The commitlint config |
|
|
615
|
+
| `./lefthook.yml` | The Git hooks, extended from the application's `.lefthook.yml` |
|
|
561
616
|
|
|
562
617
|
An application imports `./vite`, which brings `./lint`, `./fmt` and `./vitest`
|
|
563
618
|
along, `./playwright`, `./knip`, `./stylelint` and one of the TypeScript
|
|
564
|
-
configs
|
|
565
|
-
|
|
566
|
-
|
|
619
|
+
configs, and extends `./commitlint` and `./lefthook.yml`. An application that
|
|
620
|
+
only lints imports `./lint` and `./fmt`. The plugin entries exist because Oxlint
|
|
621
|
+
loads plugins by specifier, from the application; the setup and teardown entries
|
|
622
|
+
are loaded by the test presets.
|
|
567
623
|
|
|
568
624
|
## Formatter
|
|
569
625
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import conventional from "@commitlint/config-conventional";
|
|
2
|
+
// src/commitlint/index.ts
|
|
3
|
+
const WARNING = 1;
|
|
4
|
+
const ERROR = 2;
|
|
5
|
+
const MAX_LINE_LENGTH = 100;
|
|
6
|
+
const commitlint = {
|
|
7
|
+
...conventional,
|
|
8
|
+
rules: {
|
|
9
|
+
...conventional.rules,
|
|
10
|
+
"header-max-length": [
|
|
11
|
+
ERROR,
|
|
12
|
+
"always",
|
|
13
|
+
MAX_LINE_LENGTH
|
|
14
|
+
],
|
|
15
|
+
"body-max-line-length": [
|
|
16
|
+
WARNING,
|
|
17
|
+
"always",
|
|
18
|
+
MAX_LINE_LENGTH
|
|
19
|
+
],
|
|
20
|
+
"footer-leading-blank": [ERROR, "always"],
|
|
21
|
+
"footer-max-line-length": [
|
|
22
|
+
WARNING,
|
|
23
|
+
"always",
|
|
24
|
+
MAX_LINE_LENGTH
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export { commitlint as default };
|
package/lefthook.yml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Git hooks shared by the applications. The application extends this file from
|
|
2
|
+
# its .lefthook.yml and defines the package.json scripts the jobs call.
|
|
3
|
+
|
|
4
|
+
commit-msg:
|
|
5
|
+
jobs:
|
|
6
|
+
- name: commitlint
|
|
7
|
+
run: vp exec commitlint --edit {1}
|
|
8
|
+
|
|
9
|
+
pre-commit:
|
|
10
|
+
skip:
|
|
11
|
+
- merge
|
|
12
|
+
- rebase
|
|
13
|
+
jobs:
|
|
14
|
+
- name: check
|
|
15
|
+
glob: '*.{ts,tsx,mts,cts,js,mjs,cjs,json,css,md,yml,yaml,toml,html}'
|
|
16
|
+
run: vp run check:fix {staged_files}
|
|
17
|
+
stage_fixed: true
|
|
18
|
+
|
|
19
|
+
- name: secret-scan
|
|
20
|
+
run: |
|
|
21
|
+
if ! command -v kingfisher > /dev/null 2>&1; then
|
|
22
|
+
echo "kingfisher is not installed; the secret scan was skipped."
|
|
23
|
+
echo "With Homebrew (macOS/Linux): brew install kingfisher"
|
|
24
|
+
echo "Without Homebrew (Linux/Windows): download the binary for your system and add it to PATH: https://github.com/mongodb/kingfisher/releases"
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
27
|
+
vp run scan:secrets --staged
|
|
28
|
+
|
|
29
|
+
pre-push:
|
|
30
|
+
# Without piped, Lefthook runs the next jobs after a failure.
|
|
31
|
+
piped: true
|
|
32
|
+
jobs:
|
|
33
|
+
# check:ci restores the Paraglide output from the Vite Task cache. Ending it
|
|
34
|
+
# before the tests avoids concurrent restores.
|
|
35
|
+
- name: check-ci
|
|
36
|
+
run: vp run check:ci
|
|
37
|
+
|
|
38
|
+
- name: typecheck-node
|
|
39
|
+
run: vp run typecheck:node
|
|
40
|
+
|
|
41
|
+
# Vitest has short windows (per-test timeout and waitFor). Running it
|
|
42
|
+
# without sharing the CPU with the tooling tests avoids timeouts that are
|
|
43
|
+
# not logic failures.
|
|
44
|
+
- name: test
|
|
45
|
+
run: vp run test:ci
|
|
46
|
+
|
|
47
|
+
- name: tooling-and-dead-code
|
|
48
|
+
group:
|
|
49
|
+
parallel: true
|
|
50
|
+
jobs:
|
|
51
|
+
- name: tooling
|
|
52
|
+
run: vp run test:tooling
|
|
53
|
+
|
|
54
|
+
- name: dead-code
|
|
55
|
+
run: vp run dead-code
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evertondgn/solid-tooling",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Lint, formatter, TypeScript, test and Vite app presets for SolidJS applications built with Vite+.",
|
|
5
5
|
"author": "Éverton Toffanetto",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,20 +11,36 @@
|
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"solidjs",
|
|
14
|
+
"solid",
|
|
15
|
+
"vite",
|
|
14
16
|
"vite-plus",
|
|
17
|
+
"nitro",
|
|
18
|
+
"ssr",
|
|
15
19
|
"oxlint",
|
|
20
|
+
"oxfmt",
|
|
16
21
|
"lint",
|
|
17
|
-
"
|
|
22
|
+
"formatter",
|
|
23
|
+
"tsconfig",
|
|
24
|
+
"typescript",
|
|
25
|
+
"vitest",
|
|
26
|
+
"playwright",
|
|
27
|
+
"knip",
|
|
28
|
+
"stylelint",
|
|
29
|
+
"paraglide",
|
|
30
|
+
"i18n",
|
|
31
|
+
"preset"
|
|
18
32
|
],
|
|
19
33
|
"type": "module",
|
|
20
34
|
"files": [
|
|
21
35
|
"dist",
|
|
22
36
|
"tsconfig.base.json",
|
|
23
|
-
"tsconfig.app.json"
|
|
37
|
+
"tsconfig.app.json",
|
|
38
|
+
"lefthook.yml"
|
|
24
39
|
],
|
|
25
40
|
"exports": {
|
|
26
41
|
"./architecture-plugin": "./dist/architecture-plugin.mjs",
|
|
27
42
|
"./backend-plugin": "./dist/backend-plugin.mjs",
|
|
43
|
+
"./commitlint": "./dist/commitlint.mjs",
|
|
28
44
|
"./css-filename": "./dist/css-filename.mjs",
|
|
29
45
|
"./fmt": "./dist/fmt.mjs",
|
|
30
46
|
"./knip": "./dist/knip.mjs",
|
|
@@ -39,7 +55,8 @@
|
|
|
39
55
|
"./vitest-setup/browser": "./dist/vitest-setup/browser.mjs",
|
|
40
56
|
"./package.json": "./package.json",
|
|
41
57
|
"./tsconfig.base.json": "./tsconfig.base.json",
|
|
42
|
-
"./tsconfig.app.json": "./tsconfig.app.json"
|
|
58
|
+
"./tsconfig.app.json": "./tsconfig.app.json",
|
|
59
|
+
"./lefthook.yml": "./lefthook.yml"
|
|
43
60
|
},
|
|
44
61
|
"publishConfig": {
|
|
45
62
|
"access": "public"
|
|
@@ -51,6 +68,7 @@
|
|
|
51
68
|
"test:tarball": "vp run test-tarball"
|
|
52
69
|
},
|
|
53
70
|
"dependencies": {
|
|
71
|
+
"@commitlint/config-conventional": "21.2.4",
|
|
54
72
|
"eslint-plugin-solid": "0.19.0",
|
|
55
73
|
"stylelint": "18.0.0",
|
|
56
74
|
"stylelint-use-nesting": "6.0.2"
|
|
@@ -63,7 +81,9 @@
|
|
|
63
81
|
"filesystem-routing": "0.5.0",
|
|
64
82
|
"knip": "6.45.1",
|
|
65
83
|
"nitro": "3.0.261103-rc",
|
|
66
|
-
"unplugin-icons": "24.0.0"
|
|
84
|
+
"unplugin-icons": "24.0.0",
|
|
85
|
+
"@commitlint/cli": "21.2.4",
|
|
86
|
+
"lefthook": "2.2.2"
|
|
67
87
|
},
|
|
68
88
|
"devDependencies": {
|
|
69
89
|
"@inlang/paraglide-js": "3.2.2",
|
|
@@ -79,6 +99,9 @@
|
|
|
79
99
|
"unplugin-icons": "24.0.0"
|
|
80
100
|
},
|
|
81
101
|
"peerDependenciesMeta": {
|
|
102
|
+
"@commitlint/cli": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
82
105
|
"@playwright/test": {
|
|
83
106
|
"optional": true
|
|
84
107
|
},
|
|
@@ -91,6 +114,9 @@
|
|
|
91
114
|
"knip": {
|
|
92
115
|
"optional": true
|
|
93
116
|
},
|
|
117
|
+
"lefthook": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
94
120
|
"nitro": {
|
|
95
121
|
"optional": true
|
|
96
122
|
},
|