@trajectonomics/tooling 0.0.0-stage → 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +88 -2
- package/biome/base.json +50 -0
- package/biome/deterministic.json +5 -0
- package/biome-manifest.json +9 -0
- package/package.json +48 -5
- package/plugins/no-nondeterminism.grit +16 -0
- package/tsconfig/base.json +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 trajectonomics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,89 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @trajectonomics/tooling
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared Biome and TypeScript presets, a GritQL plugin, and reusable GitHub Actions workflows for Trajectonomics.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/trajectonomics/cicd/actions/workflows/check.yml)
|
|
6
|
+
[](./LICENSE)
|
|
7
|
+
|
|
8
|
+
This package ships config files only: no JavaScript. Each consuming repo keeps its own pinned
|
|
9
|
+
`@biomejs/biome` (2.6 or later) and `typescript`.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bun add -d --exact @trajectonomics/tooling @biomejs/biome typescript
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Presets
|
|
18
|
+
|
|
19
|
+
| Preset | Use in | What it gives you |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| `configs/base` | `biome.json` `extends` | Tabs, line width 100, 100 lines per file (200 in tests), complexity 10, import sorting, unused-code and `any` errors |
|
|
22
|
+
| `configs/deterministic` | `biome.json` `extends` | Everything in `base`, plus the no-nondeterminism rule |
|
|
23
|
+
| `tsconfig/base.json` | `tsconfig.json` `extends` | Strict ES2022 settings with `isolatedDeclarations` |
|
|
24
|
+
|
|
25
|
+
```jsonc
|
|
26
|
+
// biome.json
|
|
27
|
+
{ "root": true, "extends": ["@trajectonomics/tooling/configs/deterministic"] }
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```jsonc
|
|
31
|
+
// tsconfig.json
|
|
32
|
+
{ "extends": "@trajectonomics/tooling/tsconfig/base.json", "include": ["src"] }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The no-nondeterminism rule rejects `Math.pow`, `exp`, `expm1`, `log`, `log1p`, `log2`, `log10`,
|
|
36
|
+
`random`, and any use of `Date`. Use it in pure-core packages; use `configs/base` elsewhere.
|
|
37
|
+
|
|
38
|
+
## Reusable workflows
|
|
39
|
+
|
|
40
|
+
```yaml
|
|
41
|
+
# .github/workflows/check.yml
|
|
42
|
+
on: [push, pull_request]
|
|
43
|
+
jobs:
|
|
44
|
+
check:
|
|
45
|
+
uses: trajectonomics/cicd/.github/workflows/check.yml@v1
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
# .github/workflows/pr-title.yml
|
|
50
|
+
on:
|
|
51
|
+
pull_request:
|
|
52
|
+
types: [opened, edited, synchronize, reopened]
|
|
53
|
+
jobs:
|
|
54
|
+
title:
|
|
55
|
+
uses: trajectonomics/cicd/.github/workflows/pr-title.yml@v1
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`check.yml` installs Bun, runs `bun install --frozen-lockfile`, then `bun run check`. It takes
|
|
59
|
+
optional `bun-version` and `script` inputs. `pr-title.yml` requires a conventional-commit PR title.
|
|
60
|
+
|
|
61
|
+
## Development
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
bun install
|
|
65
|
+
bun run check # lint, typecheck, tests, publint
|
|
66
|
+
bun run format # fix formatting and import order
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The tests install a copy of the published files into a temporary project and run Biome and `tsc`
|
|
70
|
+
against it, so they exercise the same resolution path a consuming repo uses.
|
|
71
|
+
|
|
72
|
+
## Releasing
|
|
73
|
+
|
|
74
|
+
PR titles are conventional commits because they pick the next version (`feat:` minor, `feat!:`
|
|
75
|
+
major, anything else patch). Merges to `main` that change package files publish an alpha
|
|
76
|
+
(dist-tag `alpha`). Running the **Release** workflow by hand on `main` publishes a stable version
|
|
77
|
+
(dist-tag `latest`), creates the `vX.Y.Z` tag and GitHub release, and moves the floating `vX` tag
|
|
78
|
+
that consumers pin to. To cut `1.0.0`, run it with `bump` set to `major`.
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
- [GLOSSARY.md](./GLOSSARY.md): domain terms.
|
|
83
|
+
- [AGENTS.md](./AGENTS.md): rules for AI coding agents.
|
|
84
|
+
- [CODING_STANDARDS.md](./CODING_STANDARDS.md): review conventions.
|
|
85
|
+
- [docs/adr/](./docs/adr/): architecture decisions.
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
[MIT](./LICENSE)
|
package/biome/base.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.6.3/schema.json",
|
|
3
|
+
"formatter": { "indentStyle": "tab", "lineWidth": 100 },
|
|
4
|
+
"javascript": { "formatter": { "semicolons": "asNeeded", "quoteStyle": "double" } },
|
|
5
|
+
"linter": {
|
|
6
|
+
"enabled": true,
|
|
7
|
+
"rules": {
|
|
8
|
+
"complexity": {
|
|
9
|
+
"noExcessiveCognitiveComplexity": {
|
|
10
|
+
"level": "error",
|
|
11
|
+
"options": { "maxAllowedComplexity": 10 }
|
|
12
|
+
},
|
|
13
|
+
"useLiteralKeys": "off"
|
|
14
|
+
},
|
|
15
|
+
"correctness": {
|
|
16
|
+
"noUnusedImports": "error",
|
|
17
|
+
"noUnusedVariables": "error"
|
|
18
|
+
},
|
|
19
|
+
"style": {
|
|
20
|
+
"noExcessiveLinesPerFile": {
|
|
21
|
+
"level": "error",
|
|
22
|
+
"options": { "maxLines": 100, "skipBlankLines": true }
|
|
23
|
+
},
|
|
24
|
+
"noNonNullAssertion": "off",
|
|
25
|
+
"useImportType": "error",
|
|
26
|
+
"useExportType": "error"
|
|
27
|
+
},
|
|
28
|
+
"suspicious": {
|
|
29
|
+
"noExplicitAny": "error",
|
|
30
|
+
"noImplicitAnyLet": "error"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"overrides": [
|
|
35
|
+
{
|
|
36
|
+
"includes": ["**/*.test.ts"],
|
|
37
|
+
"linter": {
|
|
38
|
+
"rules": {
|
|
39
|
+
"style": {
|
|
40
|
+
"noExcessiveLinesPerFile": {
|
|
41
|
+
"level": "error",
|
|
42
|
+
"options": { "maxLines": 200, "skipBlankLines": true }
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"assist": { "actions": { "source": { "organizeImports": "on" } } }
|
|
50
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@biomejs/biome/manifest_schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"configs": [{ "base": "./biome/base.json" }, { "deterministic": "./biome/deterministic.json" }],
|
|
5
|
+
"plugins": {
|
|
6
|
+
"rules": [{ "noNondeterminism": "./plugins/no-nondeterminism.grit" }],
|
|
7
|
+
"presets": { "deterministic": ["noNondeterminism"] }
|
|
8
|
+
}
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@trajectonomics/tooling",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Shared Biome and TypeScript presets, GritQL plugins, and reusable GitHub Actions workflows for Trajectonomics",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/trajectonomics/cicd.git"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"packageManager": "bun@1.4.4",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=20.0.0"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"biome": "./biome-manifest.json"
|
|
18
|
+
},
|
|
19
|
+
"./tsconfig/base.json": "./tsconfig/base.json",
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"biome-manifest.json",
|
|
24
|
+
"biome",
|
|
25
|
+
"plugins",
|
|
26
|
+
"tsconfig"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public",
|
|
30
|
+
"provenance": true,
|
|
31
|
+
"tag": "latest"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"test": "bun test",
|
|
35
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
36
|
+
"lint": "biome ci --error-on-warnings .",
|
|
37
|
+
"format": "biome check --write .",
|
|
38
|
+
"check": "bun run lint && bun run typecheck && bun run test && bun run lint:package",
|
|
39
|
+
"lint:package": "publint --strict",
|
|
40
|
+
"skills:check": "bunx skills@latest check",
|
|
41
|
+
"skills:update": "bunx skills@latest update"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@biomejs/biome": "2.6.3",
|
|
45
|
+
"@types/bun": "^1.4.4",
|
|
46
|
+
"publint": "^0.3.25",
|
|
47
|
+
"typescript": "^7.0.2"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
language js
|
|
2
|
+
|
|
3
|
+
or {
|
|
4
|
+
`Math.pow($args)`,
|
|
5
|
+
`Math.exp($args)`,
|
|
6
|
+
`Math.expm1($args)`,
|
|
7
|
+
`Math.log($args)`,
|
|
8
|
+
`Math.log1p($args)`,
|
|
9
|
+
`Math.log2($args)`,
|
|
10
|
+
`Math.log10($args)`,
|
|
11
|
+
`Math.random($args)`,
|
|
12
|
+
`Date.$member`,
|
|
13
|
+
`new Date($args)`
|
|
14
|
+
} as $call where {
|
|
15
|
+
register_diagnostic(span=$call, message="Nondeterministic API: Math.pow/exp/log/random can differ between JavaScript engines (V8 vs JavaScriptCore), and Date reads the wall clock. Pass values and time in as arguments instead.", severity="error")
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
|
|
9
|
+
"strict": true,
|
|
10
|
+
"exactOptionalPropertyTypes": true,
|
|
11
|
+
"noUncheckedIndexedAccess": true,
|
|
12
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
13
|
+
"noImplicitReturns": true,
|
|
14
|
+
"noImplicitOverride": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"noUnusedLocals": true,
|
|
17
|
+
"noUnusedParameters": true,
|
|
18
|
+
"allowUnreachableCode": false,
|
|
19
|
+
"allowUnusedLabels": false,
|
|
20
|
+
"noUncheckedSideEffectImports": true,
|
|
21
|
+
"forceConsistentCasingInFileNames": true,
|
|
22
|
+
"isolatedModules": true,
|
|
23
|
+
"verbatimModuleSyntax": true,
|
|
24
|
+
"isolatedDeclarations": true,
|
|
25
|
+
"declaration": true
|
|
26
|
+
}
|
|
27
|
+
}
|