@20baht/strict 0.0.0-stage → 0.1.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 +68 -2
- package/bin/cli.js +68 -0
- package/ci/ci.yml +138 -0
- package/ci/setup/action.yml +15 -0
- package/package.json +106 -4
- package/src/depcruise/index.d.ts +54 -0
- package/src/depcruise/index.js +241 -0
- package/src/eslint/bahtui.js +335 -0
- package/src/eslint/index.d.ts +36 -0
- package/src/eslint/index.js +207 -0
- package/src/presets/commitlint.d.ts +2 -0
- package/src/presets/commitlint.js +1 -0
- package/src/presets/gitleaks.toml +6 -0
- package/src/presets/husky/commit-msg +1 -0
- package/src/presets/husky/pre-commit +8 -0
- package/src/presets/husky/pre-push +1 -0
- package/src/presets/jscpd.d.ts +10 -0
- package/src/presets/jscpd.js +40 -0
- package/src/presets/knip.d.ts +10 -0
- package/src/presets/knip.js +13 -0
- package/src/presets/lint-staged.d.ts +2 -0
- package/src/presets/lint-staged.js +5 -0
- package/src/presets/renovate.json +32 -0
- package/src/prettier/index.d.ts +5 -0
- package/src/prettier/index.js +10 -0
- package/src/tsconfig/base.json +22 -0
- package/src/tsconfig/node.json +5 -0
- package/src/tsconfig/web.json +19 -0
package/README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @20baht/strict
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared lint, type, format, structure, commit and CI config for bank20baht apps. One package,
|
|
4
|
+
subpath exports, no build step. Spec: `docs/CONFIG_LIB_SPEC.md`.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
bun add -d @20baht/strict
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
| Subpath | What |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `@20baht/strict/eslint` | `base`, `angular({ files, restrictedImports })`, `bahtui({ files, tokenFiles })`, `cssRules()`, `bahtuiPlugin` |
|
|
13
|
+
| `@20baht/strict/tsconfig/{base,node,web}.json` | strict flags; `web` adds Angular compiler strictness |
|
|
14
|
+
| `@20baht/strict/prettier` | default export config, `ignore` list for `.prettierignore` |
|
|
15
|
+
| `@20baht/strict/depcruise` | `makeConfig({ serverApps, webApps, moduleDeps, overrides, generic, federation, packages, packagesMayImport })` |
|
|
16
|
+
| `@20baht/strict/knip`, `/jscpd` | factories; jscpd `threshold` is required |
|
|
17
|
+
| `@20baht/strict/commitlint`, `/lint-staged` | plain configs |
|
|
18
|
+
| `@20baht/strict/gitleaks.toml`, `/renovate.json`, `/husky/*` | copy or extend |
|
|
19
|
+
| `@20baht/strict/ci/ci.yml`, `/ci/setup/action.yml` | reusable CI workflow and setup action templates |
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
// eslint.config.ts
|
|
23
|
+
import { defineConfig } from 'eslint/config'
|
|
24
|
+
import { base, angular, bahtui } from '@20baht/strict/eslint'
|
|
25
|
+
|
|
26
|
+
export default defineConfig([
|
|
27
|
+
...base,
|
|
28
|
+
...angular({ files: ['apps/web/src/**'], restrictedImports: [] }),
|
|
29
|
+
...bahtui({ files: ['apps/web/src/**'], tokenFiles: ['apps/web/src/styles.css'] }),
|
|
30
|
+
// app overrides last, each with a reason: -- why
|
|
31
|
+
])
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`tokenFiles` are the app's own token stylesheets: `bahtui/known-token` reads the `--baht-*` names
|
|
35
|
+
they define, and `bahtui/no-raw-color` treats them as the theme, the only files where a `--baht-*`
|
|
36
|
+
definition may hold a colour literal (`--baht-primary: #2e4a9e`). Everywhere else a token points at
|
|
37
|
+
another token. Used on its own, the rule takes the same list as `themeFiles` (paths or globs
|
|
38
|
+
relative to the eslint cwd); without it, a literal definition is allowed in any file.
|
|
39
|
+
|
|
40
|
+
A Native Federation host with several remotes (no app imports another; `services/` and `shared/`
|
|
41
|
+
in a remote, and `core/` in the host, know no page under `modules/`; the listed packages import
|
|
42
|
+
no app except the paths in `packagesMayImport`):
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// .dependency-cruiser.mjs
|
|
46
|
+
import { makeConfig } from '@20baht/strict/depcruise'
|
|
47
|
+
|
|
48
|
+
export default makeConfig({
|
|
49
|
+
generic: true,
|
|
50
|
+
federation: { host: 'shell', remotes: ['orders-web', 'billing-web'] },
|
|
51
|
+
packages: ['web-kit'],
|
|
52
|
+
packagesMayImport: ['server/dist/types/'],
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`federation` also takes `pages` (default `'modules'`), `remoteLayers` (default
|
|
57
|
+
`['services', 'shared']`) and `hostLayers` (default `['core']`).
|
|
58
|
+
|
|
59
|
+
`{ "extends": "@20baht/strict/tsconfig/base.json" }`, `"prettier": "@20baht/strict/prettier"`.
|
|
60
|
+
|
|
61
|
+
Peers (owned by the app): `eslint`, `@eslint/js`, `@eslint/css`, `typescript-eslint`,
|
|
62
|
+
`eslint-config-prettier`, `eslint-plugin-sonarjs`; `angular-eslint` only for `angular()`.
|
|
63
|
+
|
|
64
|
+
## Locked rules
|
|
65
|
+
|
|
66
|
+
`no-explicit-any`, `no-non-null-assertion`, tsconfig `strict`. Check an app with
|
|
67
|
+
`bunx @20baht/strict verify [--file eslint.config.ts] [--tsconfig tsconfig.json]`; exit 1 if unlocked.
|
|
68
|
+
|
|
69
|
+
Stays in each app: coverage thresholds, jscpd threshold, `moduleDeps`, budgets, `wrangler.toml`, Playwright config.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// 20baht-strict verify [--file <ts file>] [--tsconfig <path>...]
|
|
3
|
+
// Fails when an app turned off a locked rule: no-explicit-any, no-non-null-assertion (eslint),
|
|
4
|
+
// strict (tsconfig). Removing a lock is a decision for this lib, not for an app.
|
|
5
|
+
import { existsSync, realpathSync } from 'node:fs';
|
|
6
|
+
import { resolve } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const LOCKED_ESLINT = [
|
|
10
|
+
'@typescript-eslint/no-explicit-any',
|
|
11
|
+
'@typescript-eslint/no-non-null-assertion',
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const isError = (entry) => (Array.isArray(entry) ? entry[0] : entry) in { error: 1, 2: 1 };
|
|
15
|
+
|
|
16
|
+
/** @returns {Promise<string[]>} */
|
|
17
|
+
export async function verifyEslint(file) {
|
|
18
|
+
const { ESLint } = await import('eslint');
|
|
19
|
+
const config = await new ESLint().calculateConfigForFile(file);
|
|
20
|
+
if (!config) return [`${file}: no eslint config applies`];
|
|
21
|
+
return LOCKED_ESLINT.filter((rule) => !isError(config.rules?.[rule])).map(
|
|
22
|
+
(rule) => `eslint: ${rule} must be "error" for ${file}`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** @returns {Promise<string[]>} */
|
|
27
|
+
export async function verifyTsconfig(path) {
|
|
28
|
+
const ts = (await import('typescript')).default;
|
|
29
|
+
const abs = resolve(path);
|
|
30
|
+
const read = ts.readConfigFile(abs, ts.sys.readFile);
|
|
31
|
+
if (read.error)
|
|
32
|
+
return [`${path}: ${ts.flattenDiagnosticMessageText(read.error.messageText, ' ')}`];
|
|
33
|
+
const parsed = ts.parseJsonConfigFileContent(read.config, ts.sys, resolve(abs, '..'));
|
|
34
|
+
return parsed.options.strict === true ? [] : [`tsconfig: strict must be true in ${path}`];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function main(argv) {
|
|
38
|
+
const [cmd, ...rest] = argv;
|
|
39
|
+
if (cmd !== 'verify') {
|
|
40
|
+
console.error('usage: 20baht-strict verify [--file <ts file>] [--tsconfig <path>...]');
|
|
41
|
+
return 2;
|
|
42
|
+
}
|
|
43
|
+
const files = [];
|
|
44
|
+
const tsconfigs = [];
|
|
45
|
+
for (let i = 0; i < rest.length; i++) {
|
|
46
|
+
if (rest[i] === '--file') files.push(rest[++i]);
|
|
47
|
+
else if (rest[i] === '--tsconfig') tsconfigs.push(rest[++i]);
|
|
48
|
+
}
|
|
49
|
+
if (files.length === 0) files.push('eslint.config.ts');
|
|
50
|
+
if (tsconfigs.length === 0 && existsSync('tsconfig.json')) tsconfigs.push('tsconfig.json');
|
|
51
|
+
const problems = [
|
|
52
|
+
...(await Promise.all(files.map(verifyEslint))).flat(),
|
|
53
|
+
...(await Promise.all(tsconfigs.map(verifyTsconfig))).flat(),
|
|
54
|
+
];
|
|
55
|
+
for (const p of problems) console.error(p);
|
|
56
|
+
return problems.length === 0 ? 0 : 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Installed bins are symlinks (node_modules/.bin), so compare real paths, not URLs.
|
|
60
|
+
const isEntry = () => {
|
|
61
|
+
try {
|
|
62
|
+
return realpathSync(process.argv[1] ?? '') === realpathSync(fileURLToPath(import.meta.url));
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if (isEntry()) process.exit(await main(process.argv.slice(2)));
|
package/ci/ci.yml
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Reusable CI for bank20baht apps. Copy to the config repo's .github/workflows/ci.yml, or call:
|
|
2
|
+
# jobs:
|
|
3
|
+
# ci:
|
|
4
|
+
# uses: bank20baht/bahtui/.github/workflows/ci.yml@<tag> # once published from a workflows dir
|
|
5
|
+
# with: { run-e2e: true }
|
|
6
|
+
# The app supplies the scripts: lint, format:check, typecheck, knip, madge, deps, dup, test, build, e2e.
|
|
7
|
+
name: CI
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
workflow_call:
|
|
11
|
+
inputs:
|
|
12
|
+
run-e2e: { type: boolean, default: false }
|
|
13
|
+
pre-build-command: { type: string, default: '', description: 'e.g. bun run build:types' }
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
lint:
|
|
20
|
+
name: lint · prettier
|
|
21
|
+
runs-on: ubuntu-latest
|
|
22
|
+
timeout-minutes: 10
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
- uses: ./.github/actions/setup
|
|
26
|
+
- if: inputs.pre-build-command != ''
|
|
27
|
+
run: ${{ inputs.pre-build-command }}
|
|
28
|
+
- run: bun run lint
|
|
29
|
+
- run: bun run format:check
|
|
30
|
+
- run: bunx @20baht/strict verify
|
|
31
|
+
|
|
32
|
+
typecheck:
|
|
33
|
+
name: typecheck
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
timeout-minutes: 10
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
- uses: ./.github/actions/setup
|
|
39
|
+
- run: bun run typecheck
|
|
40
|
+
|
|
41
|
+
structure:
|
|
42
|
+
name: knip · madge · boundaries
|
|
43
|
+
runs-on: ubuntu-latest
|
|
44
|
+
timeout-minutes: 10
|
|
45
|
+
steps:
|
|
46
|
+
- uses: actions/checkout@v4
|
|
47
|
+
- uses: ./.github/actions/setup
|
|
48
|
+
- if: inputs.pre-build-command != ''
|
|
49
|
+
run: ${{ inputs.pre-build-command }}
|
|
50
|
+
- run: bun run knip
|
|
51
|
+
- run: bun run madge
|
|
52
|
+
- run: bun run deps
|
|
53
|
+
|
|
54
|
+
dup:
|
|
55
|
+
name: duplication
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
timeout-minutes: 10
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/checkout@v4
|
|
60
|
+
- uses: ./.github/actions/setup
|
|
61
|
+
- run: bun run dup -- --reporters console,json --output jscpd-report
|
|
62
|
+
- uses: actions/upload-artifact@v4
|
|
63
|
+
if: failure()
|
|
64
|
+
with: { name: jscpd-report, path: jscpd-report, retention-days: 7 }
|
|
65
|
+
|
|
66
|
+
test:
|
|
67
|
+
name: test
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
timeout-minutes: 15
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v4
|
|
72
|
+
- uses: ./.github/actions/setup
|
|
73
|
+
- if: inputs.pre-build-command != ''
|
|
74
|
+
run: ${{ inputs.pre-build-command }}
|
|
75
|
+
- run: bun run test
|
|
76
|
+
- uses: actions/upload-artifact@v4
|
|
77
|
+
if: failure()
|
|
78
|
+
with: { name: coverage, path: '**/coverage', retention-days: 7 }
|
|
79
|
+
|
|
80
|
+
build:
|
|
81
|
+
name: build
|
|
82
|
+
runs-on: ubuntu-latest
|
|
83
|
+
timeout-minutes: 10
|
|
84
|
+
steps:
|
|
85
|
+
- uses: actions/checkout@v4
|
|
86
|
+
- uses: ./.github/actions/setup
|
|
87
|
+
- run: bun run build
|
|
88
|
+
|
|
89
|
+
e2e:
|
|
90
|
+
name: e2e
|
|
91
|
+
if: inputs.run-e2e
|
|
92
|
+
runs-on: ubuntu-latest
|
|
93
|
+
timeout-minutes: 15
|
|
94
|
+
steps:
|
|
95
|
+
- uses: actions/checkout@v4
|
|
96
|
+
- uses: ./.github/actions/setup
|
|
97
|
+
- if: inputs.pre-build-command != ''
|
|
98
|
+
run: ${{ inputs.pre-build-command }}
|
|
99
|
+
- run: bunx playwright install --with-deps chromium
|
|
100
|
+
- run: bun run e2e
|
|
101
|
+
env: { E2E_LOCAL: 'true' }
|
|
102
|
+
- uses: actions/upload-artifact@v4
|
|
103
|
+
if: failure()
|
|
104
|
+
with: { name: playwright-report, path: '**/playwright-report', retention-days: 7 }
|
|
105
|
+
|
|
106
|
+
gitleaks:
|
|
107
|
+
name: gitleaks
|
|
108
|
+
runs-on: ubuntu-latest
|
|
109
|
+
timeout-minutes: 5
|
|
110
|
+
steps:
|
|
111
|
+
- uses: actions/checkout@v4
|
|
112
|
+
with: { fetch-depth: 0 }
|
|
113
|
+
- uses: gitleaks/gitleaks-action@v2
|
|
114
|
+
env: { GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' }
|
|
115
|
+
|
|
116
|
+
audit:
|
|
117
|
+
name: dependency audit
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
timeout-minutes: 5
|
|
120
|
+
steps:
|
|
121
|
+
- uses: actions/checkout@v4
|
|
122
|
+
- uses: ./.github/actions/setup
|
|
123
|
+
# Advisory endpoint answers 503 now and then; retry, never block a merge on it.
|
|
124
|
+
- run: |
|
|
125
|
+
for i in 1 2 3; do bun run audit && exit 0; echo "audit attempt $i failed"; sleep 15; done
|
|
126
|
+
exit 1
|
|
127
|
+
continue-on-error: true
|
|
128
|
+
|
|
129
|
+
commitlint:
|
|
130
|
+
name: commitlint
|
|
131
|
+
if: github.event_name == 'pull_request'
|
|
132
|
+
runs-on: ubuntu-latest
|
|
133
|
+
timeout-minutes: 5
|
|
134
|
+
steps:
|
|
135
|
+
- uses: actions/checkout@v4
|
|
136
|
+
with: { fetch-depth: 0 }
|
|
137
|
+
- uses: ./.github/actions/setup
|
|
138
|
+
- run: bunx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Setup
|
|
2
|
+
description: Bun at the version pinned in package.json, with the install cache restored, and dependencies installed.
|
|
3
|
+
runs:
|
|
4
|
+
using: composite
|
|
5
|
+
steps:
|
|
6
|
+
- uses: oven-sh/setup-bun@v2
|
|
7
|
+
with:
|
|
8
|
+
bun-version-file: package.json
|
|
9
|
+
- uses: actions/cache@v4
|
|
10
|
+
with:
|
|
11
|
+
path: ~/.bun/install/cache
|
|
12
|
+
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
|
|
13
|
+
restore-keys: bun-${{ runner.os }}-
|
|
14
|
+
- run: bun install --frozen-lockfile
|
|
15
|
+
shell: bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,108 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@20baht/strict",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Shared lint, type, format, structure, commit and CI config for bank20baht apps: eslint presets + bahtui plugin, tsconfig, prettier, dependency-cruiser, knip, jscpd, commitlint, lint-staged, gitleaks, renovate, husky.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Nattapong Promthong",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/bank20baht/20baht.git",
|
|
11
|
+
"directory": "packages/tooling/strict"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/bank20baht/20baht/tree/main/packages/tooling/strict#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/bank20baht/20baht/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"eslint",
|
|
19
|
+
"prettier",
|
|
20
|
+
"tsconfig",
|
|
21
|
+
"dependency-cruiser",
|
|
22
|
+
"knip",
|
|
23
|
+
"jscpd",
|
|
24
|
+
"config"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"src",
|
|
31
|
+
"bin",
|
|
32
|
+
"ci"
|
|
33
|
+
],
|
|
34
|
+
"bin": {
|
|
35
|
+
"20baht-strict": "./bin/cli.js"
|
|
36
|
+
},
|
|
37
|
+
"exports": {
|
|
38
|
+
"./eslint": {
|
|
39
|
+
"types": "./src/eslint/index.d.ts",
|
|
40
|
+
"default": "./src/eslint/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./prettier": {
|
|
43
|
+
"types": "./src/prettier/index.d.ts",
|
|
44
|
+
"default": "./src/prettier/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./depcruise": {
|
|
47
|
+
"types": "./src/depcruise/index.d.ts",
|
|
48
|
+
"default": "./src/depcruise/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./knip": {
|
|
51
|
+
"types": "./src/presets/knip.d.ts",
|
|
52
|
+
"default": "./src/presets/knip.js"
|
|
53
|
+
},
|
|
54
|
+
"./jscpd": {
|
|
55
|
+
"types": "./src/presets/jscpd.d.ts",
|
|
56
|
+
"default": "./src/presets/jscpd.js"
|
|
57
|
+
},
|
|
58
|
+
"./commitlint": {
|
|
59
|
+
"types": "./src/presets/commitlint.d.ts",
|
|
60
|
+
"default": "./src/presets/commitlint.js"
|
|
61
|
+
},
|
|
62
|
+
"./lint-staged": {
|
|
63
|
+
"types": "./src/presets/lint-staged.d.ts",
|
|
64
|
+
"default": "./src/presets/lint-staged.js"
|
|
65
|
+
},
|
|
66
|
+
"./tsconfig/*.json": "./src/tsconfig/*.json",
|
|
67
|
+
"./gitleaks.toml": "./src/presets/gitleaks.toml",
|
|
68
|
+
"./renovate.json": "./src/presets/renovate.json",
|
|
69
|
+
"./husky/*": "./src/presets/husky/*",
|
|
70
|
+
"./ci/*": "./ci/*",
|
|
71
|
+
"./package.json": "./package.json"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"test": "vitest run",
|
|
75
|
+
"test:watch": "vitest",
|
|
76
|
+
"test:coverage": "vitest run --coverage"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"@eslint/css": "^1 || ^2",
|
|
80
|
+
"@eslint/js": "^9 || ^10",
|
|
81
|
+
"angular-eslint": "^20 || ^21 || ^22",
|
|
82
|
+
"eslint": "^9 || ^10",
|
|
83
|
+
"eslint-config-prettier": "^10",
|
|
84
|
+
"eslint-plugin-sonarjs": "^3 || ^4",
|
|
85
|
+
"typescript-eslint": "^8",
|
|
86
|
+
"@20baht/ui": ">=0.1.0 <1"
|
|
87
|
+
},
|
|
88
|
+
"peerDependenciesMeta": {
|
|
89
|
+
"angular-eslint": {
|
|
90
|
+
"optional": true
|
|
91
|
+
},
|
|
92
|
+
"@20baht/ui": {
|
|
93
|
+
"optional": true
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"devDependencies": {
|
|
97
|
+
"@eslint/css": "2.0.0",
|
|
98
|
+
"angular-eslint": "22.5.0",
|
|
99
|
+
"@eslint/js": "^10.0.1",
|
|
100
|
+
"eslint": "^10.10.0",
|
|
101
|
+
"eslint-config-prettier": "^10.1.8",
|
|
102
|
+
"eslint-plugin-sonarjs": "^4.2.1",
|
|
103
|
+
"typescript-eslint": "^8.70.0",
|
|
104
|
+
"typescript": "^5.9.3",
|
|
105
|
+
"vitest": "^3.2.4"
|
|
106
|
+
},
|
|
107
|
+
"sideEffects": false
|
|
108
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface DepcruiseOptions {
|
|
2
|
+
/** App folder names under `apps/` that run on the server. */
|
|
3
|
+
serverApps?: string[];
|
|
4
|
+
/** App folder names under `apps/` that run in the browser. */
|
|
5
|
+
webApps?: string[];
|
|
6
|
+
/** Per server module, the other modules it may import. */
|
|
7
|
+
moduleDeps?: Record<string, string[]>;
|
|
8
|
+
overrides?: {
|
|
9
|
+
/** Composition pages allowed to import sibling pages. */
|
|
10
|
+
webCrossPageAllowed?: string[];
|
|
11
|
+
};
|
|
12
|
+
/** Path (under an app) of test helpers production code must not import. */
|
|
13
|
+
testSupport?: string;
|
|
14
|
+
/** Add layout-agnostic rules: no-circular, production code does not import tests. */
|
|
15
|
+
generic?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* A Native Federation host and its remotes under `apps/`: no app imports another, and each
|
|
18
|
+
* app's lower layers (under `src/app/`) import no page. Default: none.
|
|
19
|
+
*/
|
|
20
|
+
federation?: FederationOptions;
|
|
21
|
+
/** Folder names under `packages/` that import no app (see `packagesMayImport`). Default: none. */
|
|
22
|
+
packages?: string[];
|
|
23
|
+
/**
|
|
24
|
+
* Paths under `apps/` that `packages` may still import, as regex sources without the leading
|
|
25
|
+
* `^apps/`, e.g. `'server/dist/types/'` for a server's built declarations. Default: none.
|
|
26
|
+
*/
|
|
27
|
+
packagesMayImport?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface FederationOptions {
|
|
31
|
+
/** App folder name of the host (shell) under `apps/`. */
|
|
32
|
+
host: string;
|
|
33
|
+
/** App folder names of the remotes under `apps/`. */
|
|
34
|
+
remotes: string[];
|
|
35
|
+
/** Folder under each app's `src/app/` that holds the pages. Default `'modules'`. */
|
|
36
|
+
pages?: string;
|
|
37
|
+
/** Folders under a remote's `src/app/` that know no page. Default `['services', 'shared']`. */
|
|
38
|
+
remoteLayers?: string[];
|
|
39
|
+
/** Folders under the host's `src/app/` that know no page. Default `['core']`. */
|
|
40
|
+
hostLayers?: string[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface DepcruiseRule {
|
|
44
|
+
name: string;
|
|
45
|
+
severity: string;
|
|
46
|
+
comment?: string;
|
|
47
|
+
from: Record<string, unknown>;
|
|
48
|
+
to: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export declare function makeConfig(options?: DepcruiseOptions): {
|
|
52
|
+
forbidden: DepcruiseRule[];
|
|
53
|
+
options: Record<string, unknown>;
|
|
54
|
+
};
|