@leyman/configs 0.0.0-stage → 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jacob Ley
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,114 @@
1
- # Temporary Holding Version
1
+ <div style="text-align:center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # @leyman/configs
4
+
5
+ Strict shared configs for TypeScript ESM packages: tsconfig bases per Node.js support floor, SWC, c8 at 100% coverage, Biome and Vitest, each consumed by extending or pointing at the installed file.
6
+
7
+ [![npm package](https://badge.fury.io/js/@leyman%2Fconfigs.svg)](https://www.npmjs.com/package/@leyman/configs)
8
+ [![License](https://img.shields.io/npm/l/@leyman/configs.svg)](https://github.com/JacobLey/leyman/blob/main/leyman/configs/LICENSE)
9
+
10
+ </div>
11
+
12
+ - **A tsconfig per support floor** — `tsconfig.node-22.json` and `tsconfig.node-24.json` hold only the `lib` and `target` that Node.js version has, so using a newer API is a compile error, not a crash for users on the oldest supported version.
13
+ - **Strict type checking** — `strict`, `exactOptionalPropertyTypes`, `noUncheckedIndexedAccess`, `noImplicitOverride` and more, with declarations emitted for project references.
14
+ - **Tests checked as consumers see them** — `tsconfig.test.json` type-checks tests without emitting, against the package's built declarations.
15
+ - **100% coverage** — c8 fails below 100% of lines, statements, functions and branches.
16
+ - **One formatter config** — Biome formats TypeScript, JSON, Markdown and YAML; linting is left to ESLint ([`@leyman/eslint-config`](https://www.npmjs.com/package/@leyman/eslint-config)).
17
+
18
+ It is the config of the [leyman](https://github.com/JacobLey/leyman) monorepo, published as-is. Expect it to be strict and to change: see [Versioning](#versioning).
19
+
20
+ ## Contents
21
+
22
+ - [Install](#install)
23
+ - [Usage](#usage)
24
+ - [Files](#files)
25
+ - [Versioning](#versioning)
26
+
27
+ ## Install
28
+
29
+ ```sh
30
+ npm i -D @leyman/configs
31
+ ```
32
+
33
+ The configs are written for TypeScript 6 or newer (the `ES2025` libs), Biome 2.6, c8 12, `@swc/core` 1.16 and Vitest 5. Install the tools you use; none is a dependency.
34
+
35
+ ## Usage
36
+
37
+ Each package that uses a config installs this package, so its tools find the files in its own `node_modules`.
38
+
39
+ ### TypeScript
40
+
41
+ `tsconfig.json` extends the config of the package's support floor, the major version of `engines.node`:
42
+
43
+ ```json
44
+ {
45
+ "extends": "@leyman/configs/tsconfig.node-22.json",
46
+ "compilerOptions": {
47
+ "outDir": "dist",
48
+ "rootDir": "src",
49
+ "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo"
50
+ },
51
+ "include": ["src"]
52
+ }
53
+ ```
54
+
55
+ A package that isn't published, and so has no floor, extends `@leyman/configs/tsconfig.build.json`, which targets `ESNext`. Install `@types/node` with the floor's major version as well, so Node.js's own APIs are held to the floor too.
56
+
57
+ `test/tsconfig.json` extends the test config and references the package:
58
+
59
+ ```json
60
+ {
61
+ "extends": "@leyman/configs/tsconfig.test.json",
62
+ "references": [{ "path": ".." }]
63
+ }
64
+ ```
65
+
66
+ ### Biome
67
+
68
+ `biome.json` extends it:
69
+
70
+ ```json
71
+ {
72
+ "extends": ["@leyman/configs/biome.base.json"]
73
+ }
74
+ ```
75
+
76
+ Biome resolves the package from the directory of `biome.json`, so the package must be installed there. In a monorepo whose root installs no packages, extend the file by its path instead.
77
+
78
+ ### c8
79
+
80
+ `.c8rc.json` extends it:
81
+
82
+ ```json
83
+ {
84
+ "extends": "@leyman/configs/c8rc.json"
85
+ }
86
+ ```
87
+
88
+ Or pass it to c8 directly: `c8 -c node_modules/@leyman/configs/c8rc.json`.
89
+
90
+ ### SWC and Vitest
91
+
92
+ Neither extends a config from a package, so pass the installed file:
93
+
94
+ ```sh
95
+ swc src -d dist --config-file node_modules/@leyman/configs/swcrc.jsonc
96
+ vitest run --config node_modules/@leyman/configs/vitest.config.js --root .
97
+ ```
98
+
99
+ ## Files
100
+
101
+ | File | What it is |
102
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
+ | `tsconfig.build.json` | Strict compiler options for source, `ESNext`, with `composite` and declarations only (SWC emits the JavaScript). Excludes declarations under `dist`, `coverage` and `nyc`. |
104
+ | `tsconfig.node-22.json` | `tsconfig.build.json` limited to Node.js 22: `ES2024`, plus the Set methods, iterator helpers and `Array.fromAsync` it has. |
105
+ | `tsconfig.node-24.json` | `tsconfig.build.json` limited to Node.js 24: `ES2025`, plus `Array.fromAsync`, `using` with `DisposableStack`, and `Error.isError`. |
106
+ | `tsconfig.test.json` | `tsconfig.build.json` without emitting or `composite`, for tests. |
107
+ | `swcrc.jsonc` | TypeScript and TSX to `esnext` ESM (`nodenext` modules), with source maps, import attributes kept, React's automatic runtime and helpers inlined, so `@swc/helpers` is never a dependency. |
108
+ | `c8rc.json` | 100% thresholds on every metric; HTML, lcov and summary reports; tests, configs and declarations excluded. |
109
+ | `biome.base.json` | Formatting only: 4 spaces, single quotes, width 100 for JavaScript and TypeScript; 2 spaces for JSON; Markdown and YAML. Linting off. Follows `.gitignore`. Changelogs are left alone. Not named `biome.json`, which Biome would take as the config of the folder it is in. |
110
+ | `vitest.config.js` | Runs compiled tests from `dist-test/unit` in worker threads (so c8 sees their coverage), with hooks in registration order and native `import` instead of Vite's module runner. |
111
+
112
+ ## Versioning
113
+
114
+ Before 1.0, a release that can make passing code fail (a stricter compiler option, a higher threshold, a formatting change) is a minor, and other changes are patches.
@@ -0,0 +1,82 @@
1
+ {
2
+ "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
3
+ "assist": {
4
+ "enabled": false
5
+ },
6
+ "vcs": {
7
+ "clientKind": "git",
8
+ "enabled": true,
9
+ "useIgnoreFile": true
10
+ },
11
+ "formatter": {
12
+ "enabled": true,
13
+ "formatWithErrors": true,
14
+ "indentStyle": "space",
15
+ "lineEnding": "lf",
16
+ "lineWidth": 100
17
+ },
18
+ "javascript": {
19
+ "formatter": {
20
+ "arrowParentheses": "asNeeded",
21
+ "bracketSameLine": false,
22
+ "bracketSpacing": true,
23
+ "indentWidth": 4,
24
+ "jsxQuoteStyle": "double",
25
+ "quoteProperties": "asNeeded",
26
+ "quoteStyle": "single",
27
+ "semicolons": "always",
28
+ "trailingCommas": "es5"
29
+ },
30
+ "linter": {
31
+ "enabled": false
32
+ },
33
+ "parser": {
34
+ "unsafeParameterDecoratorsEnabled": false
35
+ }
36
+ },
37
+ "json": {
38
+ "formatter": {
39
+ "indentWidth": 2,
40
+ "lineWidth": 1
41
+ },
42
+ "linter": {
43
+ "enabled": false
44
+ }
45
+ },
46
+ "linter": {
47
+ "enabled": false
48
+ },
49
+ "markdown": {
50
+ "formatter": {
51
+ "enabled": true,
52
+ "formatEmbeds": false
53
+ },
54
+ "linter": {
55
+ "enabled": false
56
+ },
57
+ "parser": {
58
+ "frontmatter": true
59
+ }
60
+ },
61
+ "yaml": {
62
+ "formatter": {
63
+ "enabled": true,
64
+ "quoteStyle": "single"
65
+ },
66
+ "linter": {
67
+ "enabled": false
68
+ }
69
+ },
70
+ "overrides": [
71
+ {
72
+ "includes": [
73
+ "**/CHANGELOG.md"
74
+ ],
75
+ "markdown": {
76
+ "formatter": {
77
+ "enabled": false
78
+ }
79
+ }
80
+ }
81
+ ]
82
+ }
package/c8rc.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "reporter": [
3
+ "html",
4
+ "lcovonly",
5
+ "text-summary"
6
+ ],
7
+ "exclude": [
8
+ "coverage/**",
9
+ "*.config.{,c,m}js",
10
+ "test/**",
11
+ "dist-test/**",
12
+ "**/*.d.{,c,m}ts",
13
+ "**/*.d.*.{,c,m}ts"
14
+ ],
15
+ "exclude-after-remap": true,
16
+ "extension": [
17
+ ".js",
18
+ ".cjs",
19
+ ".mjs",
20
+ ".ts",
21
+ ".cts",
22
+ ".mts",
23
+ ".tsx",
24
+ ".jsx"
25
+ ],
26
+
27
+ "lines": 100,
28
+ "statements": 100,
29
+ "functions": 100,
30
+ "branches": 100,
31
+
32
+ "watermarks": {
33
+ "lines": [
34
+ 100,
35
+ 95
36
+ ],
37
+ "functions": [
38
+ 100,
39
+ 95
40
+ ],
41
+ "branches": [
42
+ 100,
43
+ 95
44
+ ],
45
+ "statements": [
46
+ 100,
47
+ 95
48
+ ]
49
+ }
50
+ }
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "@leyman/configs",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.1",
4
+ "description": "Strict shared configs for TypeScript ESM packages: tsconfig bases per Node.js support floor, SWC, c8 at 100% coverage, Biome and Vitest, each consumed by extending or pointing at the installed file.",
5
+ "type": "module",
6
+ "author": "JacobLey",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/JacobLey/leyman.git",
11
+ "directory": "leyman/configs"
12
+ },
13
+ "homepage": "https://github.com/JacobLey/leyman/tree/main/leyman/configs#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/JacobLey/leyman/issues"
16
+ },
17
+ "keywords": [
18
+ "tsconfig",
19
+ "typescript",
20
+ "swc",
21
+ "swcrc",
22
+ "c8",
23
+ "coverage",
24
+ "biome",
25
+ "vitest",
26
+ "config",
27
+ "strict",
28
+ "esm"
29
+ ],
30
+ "files": [
31
+ "biome.base.json",
32
+ "c8rc.json",
33
+ "swcrc.jsonc",
34
+ "tsconfig.build.json",
35
+ "tsconfig.node-22.json",
36
+ "tsconfig.node-24.json",
37
+ "tsconfig.test.json",
38
+ "vitest.config.js"
39
+ ],
40
+ "devDependencies": {
41
+ "@biomejs/biome": "^2.6.4"
42
+ }
6
43
  }
package/swcrc.jsonc ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "https://swc.rs/schema.json",
3
+ "isModule": true,
4
+ "sourceMaps": true,
5
+ "inlineSourcesContent": false,
6
+ "jsc": {
7
+ "target": "esnext",
8
+ "externalHelpers": false,
9
+ "parser": {
10
+ "syntax": "typescript",
11
+ "decorators": false,
12
+ "dynamicImport": true,
13
+ "tsx": true
14
+ },
15
+ "transform": {
16
+ "react": {
17
+ // Use `__jsx` instead of `React`
18
+ "runtime": "automatic"
19
+ }
20
+ },
21
+ "experimental": {
22
+ "keepImportAttributes": true
23
+ },
24
+ // Removes comments
25
+ "minify": {
26
+ "compress": false,
27
+ "mangle": false
28
+ }
29
+ },
30
+ "module": {
31
+ "type": "nodenext",
32
+ "strict": true,
33
+ "strictMode": true,
34
+ // Prevents path rewrites from cjs -> cjs
35
+ "resolveFully": false,
36
+ "ignoreDynamic": true
37
+ }
38
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": false,
4
+ "allowSyntheticDefaultImports": true,
5
+ "allowUnreachableCode": false,
6
+ "allowUnusedLabels": false,
7
+ "composite": true,
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+ "emitDeclarationOnly": true,
11
+ "exactOptionalPropertyTypes": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "incremental": true,
14
+ "isolatedDeclarations": false,
15
+ "isolatedModules": true,
16
+ "jsx": "react-jsx",
17
+ "lib": [
18
+ "DOM",
19
+ "ESNext"
20
+ ],
21
+ "module": "NodeNext",
22
+ "moduleResolution": "nodenext",
23
+ "newLine": "lf",
24
+ "noImplicitReturns": true,
25
+ "noImplicitOverride": true,
26
+ "noEmitOnError": true,
27
+ "noFallthroughCasesInSwitch": true,
28
+ "noPropertyAccessFromIndexSignature": false,
29
+ "noUncheckedIndexedAccess": true,
30
+ "noUncheckedSideEffectImports": true,
31
+ "noUnusedLocals": true,
32
+ "noUnusedParameters": false,
33
+ "pretty": true,
34
+ "preserveConstEnums": true,
35
+ "removeComments": false,
36
+ "resolveJsonModule": true,
37
+ "skipLibCheck": true,
38
+ "sourceMap": true,
39
+ "strict": true,
40
+ "target": "ESNext",
41
+ "types": [
42
+ "node"
43
+ ],
44
+ "useDefineForClassFields": true,
45
+ "useUnknownInCatchVariables": true
46
+ },
47
+ "exclude": [
48
+ "${configDir}/**/coverage/**/*.d.*ts",
49
+ "${configDir}/**/dist/**/*.d.*ts",
50
+ "${configDir}/**/nyc/**/*.d.*ts"
51
+ ]
52
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "./tsconfig.build.json",
3
+ "compilerOptions": {
4
+ // Node.js 22 has ES2024, plus Set methods, iterator helpers and `Array.fromAsync` from later years, but not
5
+ // `Promise.try`, `RegExp.escape`, `Error.isError` or `Float16Array`
6
+ "lib": [
7
+ "DOM",
8
+ "ES2024",
9
+ "ES2025.Collection",
10
+ "ES2025.Iterator",
11
+ "ESNext.Array"
12
+ ],
13
+ "target": "ES2024"
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "./tsconfig.build.json",
3
+ "compilerOptions": {
4
+ // Node.js 24 has ES2025, plus `Array.fromAsync`, `using` with `DisposableStack`, and `Error.isError`, but not
5
+ // `Uint8Array.fromBase64` or `Iterator.concat`
6
+ "lib": [
7
+ "DOM",
8
+ "ES2025",
9
+ "ESNext.Array",
10
+ "ESNext.Disposable",
11
+ "ESNext.Error"
12
+ ],
13
+ "target": "ES2025"
14
+ }
15
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "./tsconfig.build.json",
3
+ "compilerOptions": {
4
+ "composite": false,
5
+ "declaration": false,
6
+ "declarationMap": false,
7
+ "emitDeclarationOnly": false,
8
+ "incremental": false,
9
+ "noEmit": true
10
+ }
11
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Vitest config for tests compiled to `dist-test/unit` before they run.
3
+ *
4
+ * Plain object (rather than `defineConfig`) so it can be loaded without resolving `vitest` from this directory.
5
+ */
6
+ export default {
7
+ test: {
8
+ include: ['dist-test/unit/**/*.spec.js'],
9
+ // Forked workers are killed before V8 can flush coverage, so c8 would see nothing.
10
+ // Worker threads write their coverage on exit.
11
+ pool: 'threads',
12
+ sequence: {
13
+ // vitest-chain passes context forward through hooks, so hooks must run in registration order.
14
+ // The default (`stack`) runs afterEach/afterAll in reverse.
15
+ hooks: 'list',
16
+ },
17
+ experimental: {
18
+ // Tests are pre-compiled, so load them with native `import`.
19
+ // Keeps V8 coverage attributed to the real files on disk, for c8 to collect.
20
+ viteModuleRunner: false,
21
+ },
22
+ },
23
+ };