@shivaedev/quality 0.74.1 → 0.74.2
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/CHANGELOG.md +10 -0
- package/README.md +4 -4
- package/dist/adapters/imports/departures.d.ts.map +1 -1
- package/dist/adapters/imports/departures.js +7 -1
- package/dist/adapters/imports/departures.js.map +1 -1
- package/dist/adapters/isToolConfig.d.ts.map +1 -1
- package/dist/adapters/isToolConfig.js +5 -1
- package/dist/adapters/isToolConfig.js.map +1 -1
- package/dist/adapters/outsideImportFindings.d.ts.map +1 -1
- package/dist/adapters/outsideImportFindings.js +18 -15
- package/dist/adapters/outsideImportFindings.js.map +1 -1
- package/dist/imports/isTooling.d.ts +1 -0
- package/dist/imports/isTooling.d.ts.map +1 -1
- package/dist/imports/isTooling.js +6 -3
- package/dist/imports/isTooling.js.map +1 -1
- package/dist/rules/effect/adapterImports.js +1 -1
- package/dist/rules/effect/adapterImports.js.map +1 -1
- package/dist/rules/effect/boundary.d.ts.map +1 -1
- package/dist/rules/effect/boundary.js +9 -7
- package/dist/rules/effect/boundary.js.map +1 -1
- package/dist/rules/effect/boundaryReference.d.ts +3 -0
- package/dist/rules/effect/boundaryReference.d.ts.map +1 -1
- package/dist/rules/effect/boundaryReference.js +23 -2
- package/dist/rules/effect/boundaryReference.js.map +1 -1
- package/dist/rules/imports/aliased.js +1 -1
- package/dist/rules/imports/aliased.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/imports/departures.ts +7 -1
- package/src/adapters/isToolConfig.ts +7 -3
- package/src/adapters/outsideImportFindings.ts +18 -15
- package/src/imports/isTooling.ts +7 -3
- package/src/rules/effect/adapterImports.ts +1 -1
- package/src/rules/effect/boundary.ts +25 -17
- package/src/rules/effect/boundaryReference.ts +30 -2
- package/src/rules/imports/aliased.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.74.2 - 2026-11-08
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `effect/adapter-imports` and `effect/boundary` accept a tool config directly in a package's folder, such as `vitest.config.ts`, because the tool loads it from that fixed path; configs deeper in the package stay checked.
|
|
8
|
+
- `effect/adapter-imports` accepts `node:process` in entry modules (cli, main and entry files, `runMain` callers and the `import.meta.url` argv guard), so it no longer contradicts Biome's `noProcessGlobal`; other builtins there, and `node:process` elsewhere, stay reported.
|
|
9
|
+
- `effect/adapter-imports` accepts Vitest imports in every test and spec, also in packages that list Vitest as a peer; Vitest in shipped source stays reported.
|
|
10
|
+
- `code/unused` and `files/named-after-export` treat `.railway/postgres-schedules.ts`, which `@shivaedev/deploy` loads from its default path, as an entry that keeps its name.
|
|
11
|
+
- `imports/aliased` accepts relative imports between tool configs directly in a package's folder, which no `#` alias reaches.
|
|
12
|
+
|
|
3
13
|
## 0.74.1 - 2026-11-08
|
|
4
14
|
|
|
5
15
|
### Fixed
|
package/README.md
CHANGED
|
@@ -130,7 +130,7 @@ It also reports synchronous calls imported from `node:fs` and `node:child_proces
|
|
|
130
130
|
|
|
131
131
|
`Effect.run*` references in core are reported even without Clock, Config or Random. Yield the computation so it uses the caller's runtime. Runners are accepted in `cli.ts`, `main.ts(x)`, `entry.ts(x)`, `*-cli.ts`, tool configs and tests, modules that call `runMain`, and modules with the `fileURLToPath(import.meta.url) === process.argv[1]` entry guard. Browser bootstraps use the `main` or `entry` filename convention; the starter uses `examples/starter/src/client/main.tsx`. These entry-point conventions accept runners only; the other boundary checks still apply.
|
|
132
132
|
|
|
133
|
-
Within Effect code, folders named `adapters/` or `test-support/`, at any depth, are exempt from this boundary rule. An `adapters/` folder bridges an outside library and hands the rest of the application Effect values. The name is fixed by convention, with no config or copied Biome plugin globs. Adapter code still follows `effect/service-parameters` and the ambient time, randomness, console and environment bans.
|
|
133
|
+
Within Effect code, folders named `adapters/` or `test-support/`, at any depth, are exempt from this boundary rule, and so is a tool config directly in a package's folder (`*.config.ts` beside its `package.json`, such as `vitest.config.ts`), because the tool loads it from that fixed path. A config deeper in the package, such as `src/domEnvironment.config.ts`, is checked. An `adapters/` folder bridges an outside library and hands the rest of the application Effect values. The name is fixed by convention, with no config or copied Biome plugin globs. Adapter code still follows `effect/service-parameters` and the ambient time, randomness, console and environment bans.
|
|
134
134
|
|
|
135
135
|
The `ambient-runtime` Biome plugin also reports `Effect.run*` calls whose computation contains `Clock`, `Config` or `Random`, `currentTimeMillisUnsafe`, crypto UUIDs and bytes, `performance.now`, process arguments, working directory and exit state, `globalThis.process.env`, timeouts and microtasks. Yield service computations in the caller's Effect so its environment controls them. These additional checks apply to core TypeScript code. They accept `cli.ts`, `main.ts(x)`, `entry.ts(x)`, `*-cli.ts`, modules that call `runMain`, use `NodeRuntime.runMain` or guard execution with `fileURLToPath(import.meta.url) === process.argv[1]`, tool configs, tests, `adapters/` and `test-support/`. The existing `Date.now()`, `new Date()`, `Math.random()`, console and direct `process.env` bans still apply there.
|
|
136
136
|
|
|
@@ -160,7 +160,7 @@ The rule reports hidden configurations and method records, configuration and ope
|
|
|
160
160
|
|
|
161
161
|
`effect/adapter-imports` reports value imports of non-Effect dependencies, peers and optional dependencies, and Node builtins, at the import site. It includes side-effect imports, value re-exports, literal dynamic imports and `require` calls. Each package is checked against its own manifest; dev-only tools and workspace modules are accepted. Type-only imports and re-exports are accepted, including inline `type` specifiers when every binding is a type.
|
|
162
162
|
|
|
163
|
-
Move the integration into an `adapters/` folder and expose Effect values to the rest of the application. Use `import type` when only a type is needed. Folders named `adapters/` and `test-support/`, Effect packages (`effect` and `@effect/*`, including `@effect/platform-node`), native `@shivaedev/*` framework packages,
|
|
163
|
+
Move the integration into an `adapters/` folder and expose Effect values to the rest of the application. Use `import type` when only a type is needed. Folders named `adapters/` and `test-support/`, tool configs directly in a package's folder (such as `vitest.config.ts`, which the tool loads from that fixed path), Effect packages (`effect` and `@effect/*`, including `@effect/platform-node`), native `@shivaedev/*` framework packages, Vitest imports in every test and spec, and rendering libraries in `client/` folders are accepted. The client rendering libraries are `react`, `react-dom`, `recharts`, `lucide-react`, `@base-ui/react`, `@tanstack/react-router`, `@tanstack/react-table`, `class-variance-authority`, `cn`, `clsx` and `tailwind-merge`, including their subpath imports. Import UI components, routing and styling helpers directly in client code. Recharts is the stack's charting library; build charts with shadcn's Chart component (`ChartContainer` and friends) rather than raw recharts primitives where shadcn covers the case. Libraries that perform I/O or manage external state, such as `axios`, `better-auth/react`, `@tanstack/react-query` and `zustand`, still need adapters there. Other outside libraries and non-client rendering imports still need adapters. Entry modules (`cli.ts`, `main.ts(x)`, `entry.ts(x)`, `*-cli.ts`, modules that call `runMain` and modules with the `fileURLToPath(import.meta.url) === process.argv[1]` guard) may import `node:process` to read arguments and the working directory; their other imports, and `node:process` in any other module, test or config, still need adapters. Vitest in shipped source and configs deeper in a package are still reported.
|
|
164
164
|
|
|
165
165
|
The rule refuses config exceptions and inline suppressions. For existing debt, run `quality baseline write --rule effect/adapter-imports`; baseline shards keep one entry per file with its finding count. Run `quality baseline tighten` after moving integrations.
|
|
166
166
|
|
|
@@ -436,7 +436,7 @@ Git calls `quality baseline merge <ancestor> <current> <other>`. Entries are key
|
|
|
436
436
|
|
|
437
437
|
### Unused code
|
|
438
438
|
|
|
439
|
-
`code/unused` uses knip to report unused files, value and type exports, unused dependencies (including development and optional peer dependencies), and imports missing from the package manifest in every workspace. It runs through `quality lint` and the normal report and baseline. The rule accepts no options or permanent exceptions; Quality supplies knip’s entry points without a repository knip config. It follows package scripts through their imports to esbuild `build`, `buildSync` and `context` calls, Rolldown `build` and `watch` calls (including config arrays), and `Bun.build`, reading literal entry lists or maps, local constants, array spreads, arguments passed through local or imported build helpers, mapped config array elements, builds inside Effect acquisition callbacks, and Node path `join`, `resolve` and `dirname` calls, including `fileURLToPath(import.meta.url)`. Conventional tool configs, including dependency-cruiser configs and nested Vitest configs, are entries too. Relative paths use the script package’s working directory (or esbuild’s `absWorkingDir`); `import.meta.dirname` and `__dirname` refer to the build helper’s folder. Node path calls use the script package’s process directory even when the bundler sets a different working directory. Entry files and their imports count as used without fake imports. Package names in a traced build's `external` option, including a list imported from another module or narrowed with `.filter`, count as use of the bundling package's declared dependencies, because the bundle imports them at runtime. Node module resolution through `createRequire(...).resolve(...)` also counts as dependency use; an ordinary object’s `resolve` method does not. Unrelated strings and entries in abandoned build helpers do not establish reachability. Runtime modules supplied by a host can be declared in an ambient script included by the importing file’s TypeScript project. These declarations satisfy the missing-dependency check only in that project; undeclared imports still fail.
|
|
439
|
+
`code/unused` uses knip to report unused files, value and type exports, unused dependencies (including development and optional peer dependencies), and imports missing from the package manifest in every workspace. It runs through `quality lint` and the normal report and baseline. The rule accepts no options or permanent exceptions; Quality supplies knip’s entry points without a repository knip config. It follows package scripts through their imports to esbuild `build`, `buildSync` and `context` calls, Rolldown `build` and `watch` calls (including config arrays), and `Bun.build`, reading literal entry lists or maps, local constants, array spreads, arguments passed through local or imported build helpers, mapped config array elements, builds inside Effect acquisition callbacks, and Node path `join`, `resolve` and `dirname` calls, including `fileURLToPath(import.meta.url)`. Conventional tool configs, including dependency-cruiser configs and nested Vitest configs, are entries too, and so is `.railway/postgres-schedules.ts`, which `@shivaedev/deploy` loads from its default path; `files/named-after-export` lets it keep that name. Other modules in `.railway/` are checked as usual. Relative paths use the script package’s working directory (or esbuild’s `absWorkingDir`); `import.meta.dirname` and `__dirname` refer to the build helper’s folder. Node path calls use the script package’s process directory even when the bundler sets a different working directory. Entry files and their imports count as used without fake imports. Package names in a traced build's `external` option, including a list imported from another module or narrowed with `.filter`, count as use of the bundling package's declared dependencies, because the bundle imports them at runtime. Node module resolution through `createRequire(...).resolve(...)` also counts as dependency use; an ordinary object’s `resolve` method does not. Unrelated strings and entries in abandoned build helpers do not establish reachability. Runtime modules supplied by a host can be declared in an ambient script included by the importing file’s TypeScript project. These declarations satisfy the missing-dependency check only in that project; undeclared imports still fail.
|
|
440
440
|
|
|
441
441
|
Declare files reached only through runtime-built paths with repository-relative `entries` paths or globs. Quality passes these entries to knip, so the files and their imports count as used. A path or glob that matches no file fails the run and names the unmatched pattern. This covers spawned scripts and roots chosen at runtime:
|
|
442
442
|
|
|
@@ -460,7 +460,7 @@ For adoption, run `quality baseline write --rule code/unused` and review the rec
|
|
|
460
460
|
- **Documentation:** `docs/references` checks every Markdown file in the sources except `CHANGELOG.md`, whose released history keeps the links of its release. Relative links, reference definitions and `href`/`src` attributes reach an existing file or folder inside the repository, and a heading anchor matches one GitHub forms from the target's headings. A link to the repository's own GitHub tree, named by the root `package.json` `repository` field, is checked like a relative one unless it is pinned to a commit or a release tag. A published workspace package's README is shown on npm without the repository around it, so its links that leave the package use absolute URLs. Imports in TypeScript and JavaScript code blocks, workspace module paths such as `@scope/lib/repository.ts` written as inline code, `` `name` from `module` `` phrases and a package README's API rows resolve through the owning package's `exports` to an exported module, and every named import exists in that module unless it re-exports another. A linked document such as `CLAUDE.md` beside `AGENTS.md` is checked once, through its target. `docs/unversioned-installs` rejects a version after a package name in install commands, in shell code blocks and inline code; the package's own version ranges decide what installs, and a written version goes stale with the next release. A dist-tag such as `latest` passes.
|
|
461
461
|
- **Hidden casts:** `suppressions/no-double-cast` also checks code outside `adapters/` and `test-support/` for concrete annotations on `JSON.parse` results, unchecked `Reflect.get` bindings, SQL tagged-template row generics, identity overloads whose implementation returns `unknown`, context retagging through `Context.makeUnsafe(...mapUnsafe)`, and writes to readonly properties or native Scope state. Keep untrusted values as `unknown` and decode them with `Schema.decodeUnknownEffect`; decode SQL rows with `SqlSchema` rather than declaring their shape. Give an identity implementation its declared return type, preserve the Context service type, and use native constructors or lifecycle operations instead of changing native fields. Constructor initialization, mutable object writes and extensions that do not replace readonly fields are accepted. These checks read syntax and TypeScript declarations; they do not prove that arbitrary helper functions validate their input.
|
|
462
462
|
- **Suppressions:** the `suppressions/*` rules reject inline lint and compiler directives, casts through `unknown`, `any` or `never`, Biome settings that weaken a check, recommended Biome rules the preset leaves below `error`, and `ignoreDeprecations`. None of them takes exceptions. A type test (`*.typecheck.test.ts`) may use `@ts-expect-error`; a test that must pass a rejected value at run time calls the API through `Reflect.apply`.
|
|
463
|
-
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports of own modules (including same-folder files and registration subtrees; use the package’s `#` aliases), production imports of test code, runtime folders and fences, as described above.
|
|
463
|
+
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports of own modules (including same-folder files and registration subtrees; use the package’s `#` aliases, except between tool configs directly in a package's folder, such as `vitest.coverage.config.ts` importing `./vitest.config.ts`, which no alias reaches), production imports of test code, runtime folders and fences, as described above.
|
|
464
464
|
- **Names and files:** `files/folder-names` accepts an unscoped package name matching any trailing run of its folder path joined with hyphens, with singular or plural segments. For example, `packages/server/domains/agents` accepts `domain-agents` or `agents`, and `apps/testing` accepts `app-testing`; unrelated or stale package names still fail. The Biome preset's naming rules and plugins, together with the remaining `files/*` rules, name a file after its main export with its folders as the prefix. Root authority documents such as `DESIGN.md`, `ARCHITECTURE.md` and `GLOSSARY.md` are accepted beside `AGENTS.md`. `files/named-after-export` accepts programmatic bundler entries, including main and preload adapters, and tool-discovered config names such as `.dependency-cruiser.ts`. Tool config recognition follows the shared Biome default-export policy, so these configs may also use their required default export. The Quality gate also accepts Vitest configs and reporters named by explicit `--config` or `--reporter` paths in package scripts, and adapter plugins whose default export implements an imported foreign Plugin type. Ordinary modules retain their naming and default-export checks. `files/named-after-export` names a constants module in camelCase for what its exported data shares: `maxItems.ts` exports `MAX_ITEMS`, `timeouts.ts` holds `INSPECT_TIMEOUT_MILLIS` and `REMOTE_TIMEOUT_MILLIS`, `limits.ts` holds constants carrying max, min or limit, and `defaults.ts` holds constants carrying default. Each constant must carry every word of the module name, singular or plural; split unrelated constants or put heterogeneous copy in a single exported record named after itself. Only literal data, arrays and objects of it, and CONSTANT_CASE references count, with types derived from those constants allowed. Schemas, Layers, services, Effects, functions, classes and computed values stay runtime exports. One remaining runtime export names the file even beside constants; two or more use a camelCase topic file. Private constants do not name a file. The same model applies in `src/test-support`. It keeps the export’s full name while the file name omits words already supplied by any folder above it. In `spaces/client/`, a component exporting `CreateSpace` lives in `Create.tsx`: `spaces/` supplies “Space” even across the intervening `client/` folder. Keep the export named `CreateSpace`; `CreateSpace.tsx` would repeat a folder name. Inside a module’s `client/admin/` or `server/admin/` subtree, file names may repeat words from above `admin/`: `src/modules/inbox/client/admin/inboxRoutes.ts` may export `inboxRoutes`. Names must still match their exports and omit words repeated by folders within the admin subtree. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `options.toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
465
465
|
- **Change keys:** `boundaries/imported-change-keys` reports literal collection and bucket names in Reactivity invalidations and mutations, SQL `invalidateOnCommit`, and the `changes` key encoders. Import the owning declaration and use its name, list, item or bucket key. Literal record IDs and bucket values are accepted, as are names at their collection declaration.
|
|
466
466
|
- **SQL transactions:** `effect/sql-transact` reports native `sql.withTransaction` calls around repository writes, `transact` or `invalidateOnCommit`. Begin the outer transaction with `transact(effect, { onSqlError })` so changed keys follow its commit. The rule resolves native SQL and repository declarations and follows direct calls, pipes, local aliases and source helpers. Native read-only and raw SQL transactions and unrelated transaction methods remain supported.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"departures.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/departures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"departures.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/departures.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIxD,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAuC3C,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,SAAS,SAAS,EAAE,CAY1G"}
|
|
@@ -2,6 +2,7 @@ import { realpathSync } from "node:fs";
|
|
|
2
2
|
import { posix } from "node:path";
|
|
3
3
|
import { projectsFor } from "#adapters/imports/projects.ts";
|
|
4
4
|
import { resolveImport } from "#adapters/imports/resolve.ts";
|
|
5
|
+
import { isPackageRootConfig } from "#imports/isTooling.ts";
|
|
5
6
|
import { specifierSites } from "#imports/specifiers.ts";
|
|
6
7
|
import { packageOf } from "#imports/workspace.ts";
|
|
7
8
|
import { parse } from "#rules/parse.ts";
|
|
@@ -20,7 +21,12 @@ function departureAt(context, site) {
|
|
|
20
21
|
const target = resolveImport(context.root, noAmbient, request, context.from, context.project);
|
|
21
22
|
const local = target?.kind === "file" ? target.path : undefined;
|
|
22
23
|
const owner = local === undefined ? undefined : packageOf(context.packages, local);
|
|
23
|
-
const
|
|
24
|
+
const home = packageOf(context.packages, context.path);
|
|
25
|
+
const directory = home?.directory ?? ".";
|
|
26
|
+
if (local !== undefined && isPackageRootConfig(directory, context.path) && isPackageRootConfig(directory, local)) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const workspace = owner !== undefined && owner !== home ? owner.name : undefined;
|
|
24
30
|
return { ...site, file: context.path, installed: target?.kind === "external" ? target.package : undefined, workspace };
|
|
25
31
|
}
|
|
26
32
|
export function departures(inputs, packages) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"departures.js","sourceRoot":"","sources":["../../../src/adapters/imports/departures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAgB,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAsB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAAyB,MAAM,uBAAuB,CAAC;AAEzE,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,MAAM,KAAK,GAAG,QAAQ,CAAC;AAEvB,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEnC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAE/C,SAAS,SAAS;IACjB,OAAO,KAAK,CAAC;AACd,CAAC;AAUD,SAAS,WAAW,CAAC,OAAoB,EAAE,IAAmB;IAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,OAAO,GAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/G,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO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AC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC;AACxH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAkB,EAAE,QAAqC;IACnF,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACzE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,EAAE,CAAC;QACX,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;QACpF,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isToolConfig.d.ts","sourceRoot":"","sources":["../../src/adapters/isToolConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isToolConfig.d.ts","sourceRoot":"","sources":["../../src/adapters/isToolConfig.ts"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import preset from "#biome-preset" with { type: "json" };
|
|
3
|
-
const PATTERNS =
|
|
3
|
+
const PATTERNS = [
|
|
4
|
+
...preset.overrides.flatMap((override) => override.includes.includes("**/*.config.*") && override.linter?.rules?.style?.noDefaultExport === "off" ? override.includes : []),
|
|
5
|
+
// @shivaedev/deploy loads this module from its default path, so no import reaches it.
|
|
6
|
+
"**/.railway/postgres-schedules.ts",
|
|
7
|
+
];
|
|
4
8
|
export function isToolConfig(path) {
|
|
5
9
|
return PATTERNS.some((pattern) => posix.matchesGlob(path, pattern));
|
|
6
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isToolConfig.js","sourceRoot":"","sources":["../../src/adapters/isToolConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,MAAM,MAAM,eAAe,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEzD,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"isToolConfig.js","sourceRoot":"","sources":["../../src/adapters/isToolConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,MAAM,MAAM,eAAe,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEzD,MAAM,QAAQ,GAAG;IAChB,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CACxC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAChI;IACD,sFAAsF;IACtF,mCAAmC;CACnC,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outsideImportFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/outsideImportFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"outsideImportFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/outsideImportFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAOhF,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA6BpD,eAAO,MAAM,qBAAqB,yFA6ChC,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
3
3
|
import { importGraph } from "#imports/graph.ts";
|
|
4
|
+
import { isPackageRootConfig } from "#imports/isTooling.ts";
|
|
4
5
|
import { packageNameOf } from "#imports/packageName.ts";
|
|
5
6
|
import { packageOf } from "#imports/workspace.ts";
|
|
6
7
|
import { testName } from "#naming/testName.ts";
|
|
8
|
+
import { entryModules } from "#rules/effect/boundaryReference.ts";
|
|
7
9
|
const CLIENT_RENDERING_LIBRARIES = new Set([
|
|
8
10
|
"react",
|
|
9
11
|
"react-dom",
|
|
@@ -17,9 +19,10 @@ const CLIENT_RENDERING_LIBRARIES = new Set([
|
|
|
17
19
|
"clsx",
|
|
18
20
|
"tailwind-merge",
|
|
19
21
|
]);
|
|
20
|
-
function exempt(path, name) {
|
|
22
|
+
function exempt(directory, path, name) {
|
|
21
23
|
return (/(?:^|\/)(?:adapters|test-support)\//u.test(path)
|
|
22
|
-
|| (
|
|
24
|
+
|| isPackageRootConfig(directory, path)
|
|
25
|
+
|| (name === "vitest" && testName(path) !== undefined)
|
|
23
26
|
|| name === "effect"
|
|
24
27
|
|| name.startsWith("@effect/")
|
|
25
28
|
|| name.startsWith("@shivaedev/")
|
|
@@ -42,22 +45,22 @@ export const outsideImportFindings = Effect.fn("Imports.outsideImportFindings")(
|
|
|
42
45
|
.filter((edge) => edge.missing === undefined && !/^[.#/]/u.test(edge.specifier))
|
|
43
46
|
.map((edge) => ({ ...edge, name: packageNameOf(edge.specifier) })),
|
|
44
47
|
];
|
|
45
|
-
|
|
48
|
+
const outside = sites.filter((site) => {
|
|
46
49
|
const directory = packageOf(graph.packages, site.from)?.directory ?? ".";
|
|
47
|
-
|
|
50
|
+
return !(workspace.has(site.name)
|
|
48
51
|
|| site.type
|
|
49
52
|
|| site.kind !== "import"
|
|
50
|
-
|| exempt(site.from, site.name)
|
|
51
|
-
|| !(site.name.startsWith("node:") || runtime.get(directory)?.has(site.name)))
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
return [
|
|
55
|
-
{
|
|
56
|
-
file: site.from,
|
|
57
|
-
line: site.line,
|
|
58
|
-
message: `Imports outside library "${site.specifier}" as a value. Move the integration into an adapters/ module with explicit imports that exposes Effect values; use import type for types. Read environment variables with Config instead of process.env, including in adapters/.`,
|
|
59
|
-
},
|
|
60
|
-
];
|
|
53
|
+
|| exempt(directory, site.from, site.name)
|
|
54
|
+
|| !(site.name.startsWith("node:") || runtime.get(directory)?.has(site.name)));
|
|
61
55
|
});
|
|
56
|
+
const processImporters = new Set(outside.flatMap((site) => (site.name === "node:process" ? [site.from] : [])));
|
|
57
|
+
const entries = entryModules(inputs.sources.filter((file) => processImporters.has(file.path)));
|
|
58
|
+
return outside
|
|
59
|
+
.filter((site) => !(site.name === "node:process" && entries.has(site.from)))
|
|
60
|
+
.map((site) => ({
|
|
61
|
+
file: site.from,
|
|
62
|
+
line: site.line,
|
|
63
|
+
message: `Imports outside library "${site.specifier}" as a value. Move the integration into an adapters/ module with explicit imports that exposes Effect values; use import type for types. Read environment variables with Config instead of process.env, including in adapters/.`,
|
|
64
|
+
}));
|
|
62
65
|
});
|
|
63
66
|
//# sourceMappingURL=outsideImportFindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outsideImportFindings.js","sourceRoot":"","sources":["../../src/adapters/outsideImportFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"outsideImportFindings.js","sourceRoot":"","sources":["../../src/adapters/outsideImportFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EA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QACf,OAAO,EAAE,4BAA4B,IAAI,CAAC,SAAS,iOAAiO;KACpR,CAAC,CAAC,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTooling.d.ts","sourceRoot":"","sources":["../../src/imports/isTooling.ts"],"names":[],"mappings":"AAMA,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"isTooling.d.ts","sourceRoot":"","sources":["../../src/imports/isTooling.ts"],"names":[],"mappings":"AAMA,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG5E;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAGlE"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
const TOOL_FOLDERS = new Set(["script", "scripts", "tooling"]);
|
|
3
3
|
const CONFIG_FILE = /(?:^|\.)config\.[cm]?[jt]sx?$/u;
|
|
4
|
-
export function
|
|
4
|
+
export function isPackageRootConfig(directory, path) {
|
|
5
5
|
const local = posix.relative(directory, path);
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
return !local.includes("/") && CONFIG_FILE.test(local);
|
|
7
|
+
}
|
|
8
|
+
export function isTooling(directory, path) {
|
|
9
|
+
const [folder = ""] = posix.relative(directory, path).split("/");
|
|
10
|
+
return TOOL_FOLDERS.has(folder) || isPackageRootConfig(directory, path);
|
|
8
11
|
}
|
|
9
12
|
//# sourceMappingURL=isTooling.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTooling.js","sourceRoot":"","sources":["../../src/imports/isTooling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAE/D,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAErD,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"isTooling.js","sourceRoot":"","sources":["../../src/imports/isTooling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAE/D,MAAM,WAAW,GAAG,gCAAgC,CAAC;AAErD,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,IAAY;IAClE,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,SAAiB,EAAE,IAAY;IACxD,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjE,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { outsideImportFindings } from "#adapters/outsideImportFindings.ts";
|
|
|
2
2
|
import { defineRule } from "#rule.ts";
|
|
3
3
|
export const adapterImports = defineRule({
|
|
4
4
|
check: outsideImportFindings,
|
|
5
|
-
description: "Keep value imports of non-Effect runtime dependencies, peers, optional dependencies and Node builtins in adapters/. Type-only imports, workspace modules, test-support/ kits, Effect and @shivaedev packages, supported UI, routing and styling libraries in client/ folders and
|
|
5
|
+
description: "Keep value imports of non-Effect runtime dependencies, peers, optional dependencies and Node builtins in adapters/. Type-only imports, workspace modules, test-support/ kits, tool configs directly in a package's folder, Effect and @shivaedev packages, supported UI, routing and styling libraries in client/ folders, Vitest in tests and specs, and node:process in entry modules (cli/main/entry files, runMain callers and the import.meta.url === process.argv[1] guard) are accepted. Recharts is the stack's charting library, accepted in client/ folders; build charts with shadcn's Chart component (ChartContainer and friends) rather than raw recharts primitives where shadcn covers the case. Libraries that perform I/O or manage external state still need adapters/. Move integrations into adapters/ and expose Effect values. No config exceptions or inline suppressions; baseline existing debt.",
|
|
6
6
|
id: "effect/adapter-imports",
|
|
7
7
|
registrable: false,
|
|
8
8
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapterImports.js","sourceRoot":"","sources":["../../../src/rules/effect/adapterImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACxC,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACV,
|
|
1
|
+
{"version":3,"file":"adapterImports.js","sourceRoot":"","sources":["../../../src/rules/effect/adapterImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACxC,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACV,43BAA43B;IAC73B,EAAE,EAAE,wBAAwB;IAC5B,WAAW,EAAE,KAAK;CAClB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../src/rules/effect/boundary.ts"],"names":[],"mappings":"AAgFA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../src/rules/effect/boundary.ts"],"names":[],"mappings":"AAgFA,eAAO,MAAM,cAAc,8DA0BzB,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { Effect } from "effect";
|
|
2
3
|
import ts from "typescript";
|
|
4
|
+
import { isPackageRootConfig } from "#imports/isTooling.ts";
|
|
5
|
+
import { packageOf, workspacePackages } from "#imports/workspace.ts";
|
|
3
6
|
import { defineRule } from "#rule.ts";
|
|
4
7
|
import { boundaryCalls } from "#rules/effect/boundaryCalls.ts";
|
|
5
8
|
import { boundaryEntryPoint } from "#rules/effect/boundaryReference.ts";
|
|
@@ -46,9 +49,6 @@ function checkBoundary(inputs) {
|
|
|
46
49
|
const checker = program.getTypeChecker();
|
|
47
50
|
const call = boundaryCalls(checker);
|
|
48
51
|
return inputs.sources.flatMap((file) => {
|
|
49
|
-
if (/(?:^|\/)(?:adapters|test-support)\//u.test(file.path)) {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
52
|
const source = parse(file) === undefined ? undefined : program.getSourceFile(join(inputs.root, file.path));
|
|
53
53
|
const findings = [];
|
|
54
54
|
const entryPoint = source !== undefined && boundaryEntryPoint(file.path, source, checker);
|
|
@@ -70,10 +70,12 @@ function checkBoundary(inputs) {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
export const effectBoundary = defineRule({
|
|
73
|
-
check: (inputs) => {
|
|
73
|
+
check: (inputs) => Effect.map(Effect.promise(() => workspacePackages(inputs)), (packages) => {
|
|
74
74
|
const groups = new Map();
|
|
75
75
|
for (const source of inputs.sources) {
|
|
76
|
-
if (/(?:^|\/)(?:adapters|test-support)\//u.test(source.path)
|
|
76
|
+
if (/(?:^|\/)(?:adapters|test-support)\//u.test(source.path)
|
|
77
|
+
|| !/\.[cm]?[jt]sx?$/u.test(source.path)
|
|
78
|
+
|| isPackageRootConfig(packageOf(packages, source.path)?.directory ?? ".", source.path)) {
|
|
77
79
|
continue;
|
|
78
80
|
}
|
|
79
81
|
const group = /^(?:packages|examples)\/[^/]+/u.exec(source.path)?.[0] ?? ".";
|
|
@@ -82,8 +84,8 @@ export const effectBoundary = defineRule({
|
|
|
82
84
|
groups.set(group, sources);
|
|
83
85
|
}
|
|
84
86
|
return [...groups.values()].flatMap((sources) => checkBoundary({ ...inputs, sources }));
|
|
85
|
-
},
|
|
86
|
-
description: "Use Effect instead of Promise syntax and parameters, synchronous Node IO, throwing helper calls or Effect.sync with throwing APIs. Runners belong at entry points (including main.tsx and entry.tsx), tool configs and tests. Within Effect code, adapters/ and test-support/ folders are exempt; calls to throwing helpers defined in adapters/ are accepted. Use Effect services and tagged errors; bridge outside libraries in adapters/. No config exceptions or inline suppressions; baseline existing debt.",
|
|
87
|
+
}),
|
|
88
|
+
description: "Use Effect instead of Promise syntax and parameters, synchronous Node IO, throwing helper calls or Effect.sync with throwing APIs. Runners belong at entry points (including main.tsx and entry.tsx), tool configs and tests. Within Effect code, adapters/ and test-support/ folders and tool configs directly in a package's folder, which their tool loads from that fixed path, are exempt; calls to throwing helpers defined in adapters/ are accepted. Use Effect services and tagged errors; bridge outside libraries in adapters/. No config exceptions or inline suppressions; baseline existing debt.",
|
|
87
89
|
id: "effect/boundary",
|
|
88
90
|
registrable: false,
|
|
89
91
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundary.js","sourceRoot":"","sources":["../../../src/rules/effect/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAiC,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,aAAa,EAA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AAO,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACzF,CAAC,CACD;IACF,WAAW,EACV,ilBAAilB;IACllB,EAAE,EAAE,iBAAiB;IACrB,WAAW,EAAE,KAAK;CAClB,CAAC,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
+
import type { SourceFile } from "#rule.ts";
|
|
2
3
|
export declare function boundaryReference(checker: ts.TypeChecker, node: ts.Node, seen?: Set<ts.Symbol>): string | undefined;
|
|
4
|
+
export declare function entryModule(path: string, source: ts.SourceFile, checker: ts.TypeChecker): boolean;
|
|
3
5
|
export declare function boundaryEntryPoint(path: string, source: ts.SourceFile, checker: ts.TypeChecker): boolean;
|
|
6
|
+
export declare function entryModules(sources: readonly SourceFile[]): ReadonlySet<string>;
|
|
4
7
|
//# sourceMappingURL=boundaryReference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundaryReference.d.ts","sourceRoot":"","sources":["../../../src/rules/effect/boundaryReference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"boundaryReference.d.ts","sourceRoot":"","sources":["../../../src/rules/effect/boundaryReference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAwD3C,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,iBAAuB,GAAG,MAAM,GAAG,SAAS,CAUzH;AAMD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAoBjG;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,OAAO,CAExG;AAGD,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC,CAYhF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
+
import { parse } from "#rules/parse.ts";
|
|
2
3
|
function importedReference(declaration) {
|
|
3
4
|
if (ts.isImportSpecifier(declaration)) {
|
|
4
5
|
const module = declaration.parent.parent.parent.moduleSpecifier;
|
|
@@ -59,8 +60,13 @@ export function boundaryReference(checker, node, seen = new Set()) {
|
|
|
59
60
|
}
|
|
60
61
|
return ts.isIdentifier(node) ? symbolReference(checker, node, seen) : undefined;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
const ENTRY_NAME = /(?:^|\/)(?:cli|main|entry|[^/]+-cli)\.[cm]?[jt]sx?$/u;
|
|
64
|
+
const RUNNER_HOST = /\.(?:config|test|spec)\.[cm]?[jt]sx?$/u;
|
|
65
|
+
export function entryModule(path, source, checker) {
|
|
66
|
+
if (RUNNER_HOST.test(path)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (ENTRY_NAME.test(path)) {
|
|
64
70
|
return true;
|
|
65
71
|
}
|
|
66
72
|
function visit(node) {
|
|
@@ -77,4 +83,19 @@ export function boundaryEntryPoint(path, source, checker) {
|
|
|
77
83
|
}
|
|
78
84
|
return visit(source);
|
|
79
85
|
}
|
|
86
|
+
export function boundaryEntryPoint(path, source, checker) {
|
|
87
|
+
return RUNNER_HOST.test(path) || entryModule(path, source, checker);
|
|
88
|
+
}
|
|
89
|
+
// Entry markers name their imports, so each module binds on its own without resolving the program behind it.
|
|
90
|
+
export function entryModules(sources) {
|
|
91
|
+
const options = { allowJs: true, noLib: true, noResolve: true, types: [] };
|
|
92
|
+
const host = ts.createCompilerHost(options);
|
|
93
|
+
const parsed = new Map(sources.flatMap((file) => {
|
|
94
|
+
const source = parse(file);
|
|
95
|
+
return source === undefined ? [] : [[file.path, source]];
|
|
96
|
+
}));
|
|
97
|
+
host.getSourceFile = (path) => parsed.get(path);
|
|
98
|
+
const checker = ts.createProgram([...parsed.keys()], options, host).getTypeChecker();
|
|
99
|
+
return new Set([...parsed].flatMap(([path, source]) => (entryModule(path, source, checker) ? [path] : [])));
|
|
100
|
+
}
|
|
80
101
|
//# sourceMappingURL=boundaryReference.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundaryReference.js","sourceRoot":"","sources":["../../../src/rules/effect/boundaryReference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,SAAS,iBAAiB,CAAC,WAA2B;IACrD,IAAI,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;QAChE,OAAO,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACzH,CAAC;IACD,IAAI,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;QACzE,MAAM,MAAM,GAAG,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,eAAe,CAAC;QAClI,OAAO,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CA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,GAAG,IAAI,GAAG,CACrB,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAU,CAAC,CAAC;IACnE,CAAC,CAAC,CACF,CAAC;IACF,IAAI,CAAC,aAAa,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;IACrF,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7G,CAAC"}
|
|
@@ -18,7 +18,7 @@ export const importsAliased = defineRule({
|
|
|
18
18
|
message: messageOf(departure),
|
|
19
19
|
subject: departure.specifier,
|
|
20
20
|
}))),
|
|
21
|
-
description: "Import own modules through the package.json `imports` aliases, including same-folder modules. Import other packages by their names and exported paths.",
|
|
21
|
+
description: "Import own modules through the package.json `imports` aliases, including same-folder modules; tool configs directly in a package's folder, which no alias reaches, may import each other relatively. Import other packages by their names and exported paths.",
|
|
22
22
|
id: "imports/aliased",
|
|
23
23
|
});
|
|
24
24
|
//# sourceMappingURL=aliased.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aliased.js","sourceRoot":"","sources":["../../../src/rules/imports/aliased.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAkB,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa;IAChE,MAAM,QAAQ,GAAG,IAAI,SAAS,yBAAyB,CAAC;IACxD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,QAAQ,0CAA0C,SAAS,oCAAoC,CAAC;IAC3G,CAAC;IACD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,QAAQ,0CAA0C,SAAS,4EAA4E,CAAC;IACnJ,CAAC;IACD,OAAO,GAAG,QAAQ,6GAA6G,CAAC;AACjI,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACxC,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CACjB,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CACxC,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACzB,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC;QAC7B,OAAO,EAAE,SAAS,CAAC,SAAS;KAC5B,CAAC,CAAC,CACH;IACF,WAAW,EACV
|
|
1
|
+
{"version":3,"file":"aliased.js","sourceRoot":"","sources":["../../../src/rules/imports/aliased.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAkB,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAa;IAChE,MAAM,QAAQ,GAAG,IAAI,SAAS,yBAAyB,CAAC;IACxD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,QAAQ,0CAA0C,SAAS,oCAAoC,CAAC;IAC3G,CAAC;IACD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,QAAQ,0CAA0C,SAAS,4EAA4E,CAAC;IACnJ,CAAC;IACD,OAAO,GAAG,QAAQ,6GAA6G,CAAC;AACjI,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACxC,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CACjB,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CACxC,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACzB,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC;QAC7B,OAAO,EAAE,SAAS,CAAC,SAAS;KAC5B,CAAC,CAAC,CACH;IACF,WAAW,EACV,+PAA+P;IAChQ,EAAE,EAAE,iBAAiB;CACrB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/quality",
|
|
3
|
-
"version": "0.74.
|
|
3
|
+
"version": "0.74.2",
|
|
4
4
|
"description": "Repository quality gate with typed rules, a baseline of existing debt and a registry of reasoned exceptions",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/quality#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -4,6 +4,7 @@ import { type Project, projectsFor } from "#adapters/imports/projects.ts";
|
|
|
4
4
|
import { resolveImport } from "#adapters/imports/resolve.ts";
|
|
5
5
|
import type { Departure } from "#imports/departures.ts";
|
|
6
6
|
import type { ImportRequest } from "#imports/extract.ts";
|
|
7
|
+
import { isPackageRootConfig } from "#imports/isTooling.ts";
|
|
7
8
|
import { type SpecifierSite, specifierSites } from "#imports/specifiers.ts";
|
|
8
9
|
import { packageOf, type WorkspacePackage } from "#imports/workspace.ts";
|
|
9
10
|
import type { RuleInputs } from "#rule.ts";
|
|
@@ -36,7 +37,12 @@ function departureAt(context: FileContext, site: SpecifierSite): Departure | und
|
|
|
36
37
|
const target = resolveImport(context.root, noAmbient, request, context.from, context.project);
|
|
37
38
|
const local = target?.kind === "file" ? target.path : undefined;
|
|
38
39
|
const owner = local === undefined ? undefined : packageOf(context.packages, local);
|
|
39
|
-
const
|
|
40
|
+
const home = packageOf(context.packages, context.path);
|
|
41
|
+
const directory = home?.directory ?? ".";
|
|
42
|
+
if (local !== undefined && isPackageRootConfig(directory, context.path) && isPackageRootConfig(directory, local)) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const workspace = owner !== undefined && owner !== home ? owner.name : undefined;
|
|
40
46
|
return { ...site, file: context.path, installed: target?.kind === "external" ? target.package : undefined, workspace };
|
|
41
47
|
}
|
|
42
48
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { posix } from "node:path";
|
|
2
2
|
import preset from "#biome-preset" with { type: "json" };
|
|
3
3
|
|
|
4
|
-
const PATTERNS =
|
|
5
|
-
|
|
6
|
-
)
|
|
4
|
+
const PATTERNS = [
|
|
5
|
+
...preset.overrides.flatMap((override) =>
|
|
6
|
+
override.includes.includes("**/*.config.*") && override.linter?.rules?.style?.noDefaultExport === "off" ? override.includes : [],
|
|
7
|
+
),
|
|
8
|
+
// @shivaedev/deploy loads this module from its default path, so no import reaches it.
|
|
9
|
+
"**/.railway/postgres-schedules.ts",
|
|
10
|
+
];
|
|
7
11
|
|
|
8
12
|
export function isToolConfig(path: string): boolean {
|
|
9
13
|
return PATTERNS.some((pattern) => posix.matchesGlob(path, pattern));
|
|
@@ -2,10 +2,12 @@ import { Effect } from "effect";
|
|
|
2
2
|
import type { ImportAnalysisFailure } from "#adapters/ImportAnalysisFailure.ts";
|
|
3
3
|
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
4
4
|
import { importGraph } from "#imports/graph.ts";
|
|
5
|
+
import { isPackageRootConfig } from "#imports/isTooling.ts";
|
|
5
6
|
import { packageNameOf } from "#imports/packageName.ts";
|
|
6
7
|
import { packageOf } from "#imports/workspace.ts";
|
|
7
8
|
import { testName } from "#naming/testName.ts";
|
|
8
9
|
import type { Finding, RuleInputs } from "#rule.ts";
|
|
10
|
+
import { entryModules } from "#rules/effect/boundaryReference.ts";
|
|
9
11
|
|
|
10
12
|
const CLIENT_RENDERING_LIBRARIES = new Set([
|
|
11
13
|
"react",
|
|
@@ -21,10 +23,11 @@ const CLIENT_RENDERING_LIBRARIES = new Set([
|
|
|
21
23
|
"tailwind-merge",
|
|
22
24
|
]);
|
|
23
25
|
|
|
24
|
-
function exempt(path: string, name: string): boolean {
|
|
26
|
+
function exempt(directory: string, path: string, name: string): boolean {
|
|
25
27
|
return (
|
|
26
28
|
/(?:^|\/)(?:adapters|test-support)\//u.test(path)
|
|
27
|
-
|| (
|
|
29
|
+
|| isPackageRootConfig(directory, path)
|
|
30
|
+
|| (name === "vitest" && testName(path) !== undefined)
|
|
28
31
|
|| name === "effect"
|
|
29
32
|
|| name.startsWith("@effect/")
|
|
30
33
|
|| name.startsWith("@shivaedev/")
|
|
@@ -58,23 +61,23 @@ export const outsideImportFindings = Effect.fn("Imports.outsideImportFindings")(
|
|
|
58
61
|
.filter((edge) => edge.missing === undefined && !/^[.#/]/u.test(edge.specifier))
|
|
59
62
|
.map((edge) => ({ ...edge, name: packageNameOf(edge.specifier) })),
|
|
60
63
|
];
|
|
61
|
-
|
|
64
|
+
const outside = sites.filter((site) => {
|
|
62
65
|
const directory = packageOf(graph.packages, site.from)?.directory ?? ".";
|
|
63
|
-
|
|
66
|
+
return !(
|
|
64
67
|
workspace.has(site.name)
|
|
65
68
|
|| site.type
|
|
66
69
|
|| site.kind !== "import"
|
|
67
|
-
|| exempt(site.from, site.name)
|
|
70
|
+
|| exempt(directory, site.from, site.name)
|
|
68
71
|
|| !(site.name.startsWith("node:") || runtime.get(directory)?.has(site.name))
|
|
69
|
-
)
|
|
70
|
-
return [];
|
|
71
|
-
}
|
|
72
|
-
return [
|
|
73
|
-
{
|
|
74
|
-
file: site.from,
|
|
75
|
-
line: site.line,
|
|
76
|
-
message: `Imports outside library "${site.specifier}" as a value. Move the integration into an adapters/ module with explicit imports that exposes Effect values; use import type for types. Read environment variables with Config instead of process.env, including in adapters/.`,
|
|
77
|
-
},
|
|
78
|
-
];
|
|
72
|
+
);
|
|
79
73
|
});
|
|
74
|
+
const processImporters = new Set(outside.flatMap((site) => (site.name === "node:process" ? [site.from] : [])));
|
|
75
|
+
const entries = entryModules(inputs.sources.filter((file) => processImporters.has(file.path)));
|
|
76
|
+
return outside
|
|
77
|
+
.filter((site) => !(site.name === "node:process" && entries.has(site.from)))
|
|
78
|
+
.map((site) => ({
|
|
79
|
+
file: site.from,
|
|
80
|
+
line: site.line,
|
|
81
|
+
message: `Imports outside library "${site.specifier}" as a value. Move the integration into an adapters/ module with explicit imports that exposes Effect values; use import type for types. Read environment variables with Config instead of process.env, including in adapters/.`,
|
|
82
|
+
}));
|
|
80
83
|
});
|
package/src/imports/isTooling.ts
CHANGED
|
@@ -4,8 +4,12 @@ const TOOL_FOLDERS = new Set(["script", "scripts", "tooling"]);
|
|
|
4
4
|
|
|
5
5
|
const CONFIG_FILE = /(?:^|\.)config\.[cm]?[jt]sx?$/u;
|
|
6
6
|
|
|
7
|
-
export function
|
|
7
|
+
export function isPackageRootConfig(directory: string, path: string): boolean {
|
|
8
8
|
const local = posix.relative(directory, path);
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
return !local.includes("/") && CONFIG_FILE.test(local);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function isTooling(directory: string, path: string): boolean {
|
|
13
|
+
const [folder = ""] = posix.relative(directory, path).split("/");
|
|
14
|
+
return TOOL_FOLDERS.has(folder) || isPackageRootConfig(directory, path);
|
|
11
15
|
}
|
|
@@ -4,7 +4,7 @@ import { defineRule } from "#rule.ts";
|
|
|
4
4
|
export const adapterImports = defineRule({
|
|
5
5
|
check: outsideImportFindings,
|
|
6
6
|
description:
|
|
7
|
-
"Keep value imports of non-Effect runtime dependencies, peers, optional dependencies and Node builtins in adapters/. Type-only imports, workspace modules, test-support/ kits, Effect and @shivaedev packages, supported UI, routing and styling libraries in client/ folders and
|
|
7
|
+
"Keep value imports of non-Effect runtime dependencies, peers, optional dependencies and Node builtins in adapters/. Type-only imports, workspace modules, test-support/ kits, tool configs directly in a package's folder, Effect and @shivaedev packages, supported UI, routing and styling libraries in client/ folders, Vitest in tests and specs, and node:process in entry modules (cli/main/entry files, runMain callers and the import.meta.url === process.argv[1] guard) are accepted. Recharts is the stack's charting library, accepted in client/ folders; build charts with shadcn's Chart component (ChartContainer and friends) rather than raw recharts primitives where shadcn covers the case. Libraries that perform I/O or manage external state still need adapters/. Move integrations into adapters/ and expose Effect values. No config exceptions or inline suppressions; baseline existing debt.",
|
|
8
8
|
id: "effect/adapter-imports",
|
|
9
9
|
registrable: false,
|
|
10
10
|
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { Effect } from "effect";
|
|
2
3
|
import ts from "typescript";
|
|
4
|
+
import { isPackageRootConfig } from "#imports/isTooling.ts";
|
|
5
|
+
import { packageOf, workspacePackages } from "#imports/workspace.ts";
|
|
3
6
|
import { defineRule, type Finding, type RuleInputs } from "#rule.ts";
|
|
4
7
|
import { boundaryCalls } from "#rules/effect/boundaryCalls.ts";
|
|
5
8
|
import { boundaryEntryPoint } from "#rules/effect/boundaryReference.ts";
|
|
@@ -54,9 +57,6 @@ function checkBoundary(inputs: RuleInputs): readonly Finding[] {
|
|
|
54
57
|
const checker = program.getTypeChecker();
|
|
55
58
|
const call = boundaryCalls(checker);
|
|
56
59
|
return inputs.sources.flatMap((file) => {
|
|
57
|
-
if (/(?:^|\/)(?:adapters|test-support)\//u.test(file.path)) {
|
|
58
|
-
return [];
|
|
59
|
-
}
|
|
60
60
|
const source = parse(file) === undefined ? undefined : program.getSourceFile(join(inputs.root, file.path));
|
|
61
61
|
const findings: Finding[] = [];
|
|
62
62
|
const entryPoint = source !== undefined && boundaryEntryPoint(file.path, source, checker);
|
|
@@ -79,21 +79,29 @@ function checkBoundary(inputs: RuleInputs): readonly Finding[] {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export const effectBoundary = defineRule({
|
|
82
|
-
check: (inputs) =>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
check: (inputs) =>
|
|
83
|
+
Effect.map(
|
|
84
|
+
Effect.promise(() => workspacePackages(inputs)),
|
|
85
|
+
(packages) => {
|
|
86
|
+
const groups = new Map<string, RuleInputs["sources"][number][]>();
|
|
87
|
+
for (const source of inputs.sources) {
|
|
88
|
+
if (
|
|
89
|
+
/(?:^|\/)(?:adapters|test-support)\//u.test(source.path)
|
|
90
|
+
|| !/\.[cm]?[jt]sx?$/u.test(source.path)
|
|
91
|
+
|| isPackageRootConfig(packageOf(packages, source.path)?.directory ?? ".", source.path)
|
|
92
|
+
) {
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const group = /^(?:packages|examples)\/[^/]+/u.exec(source.path)?.[0] ?? ".";
|
|
96
|
+
const sources = groups.get(group) ?? [];
|
|
97
|
+
sources.push(source);
|
|
98
|
+
groups.set(group, sources);
|
|
99
|
+
}
|
|
100
|
+
return [...groups.values()].flatMap((sources) => checkBoundary({ ...inputs, sources }));
|
|
101
|
+
},
|
|
102
|
+
),
|
|
95
103
|
description:
|
|
96
|
-
"Use Effect instead of Promise syntax and parameters, synchronous Node IO, throwing helper calls or Effect.sync with throwing APIs. Runners belong at entry points (including main.tsx and entry.tsx), tool configs and tests. Within Effect code, adapters/ and test-support/ folders are exempt; calls to throwing helpers defined in adapters/ are accepted. Use Effect services and tagged errors; bridge outside libraries in adapters/. No config exceptions or inline suppressions; baseline existing debt.",
|
|
104
|
+
"Use Effect instead of Promise syntax and parameters, synchronous Node IO, throwing helper calls or Effect.sync with throwing APIs. Runners belong at entry points (including main.tsx and entry.tsx), tool configs and tests. Within Effect code, adapters/ and test-support/ folders and tool configs directly in a package's folder, which their tool loads from that fixed path, are exempt; calls to throwing helpers defined in adapters/ are accepted. Use Effect services and tagged errors; bridge outside libraries in adapters/. No config exceptions or inline suppressions; baseline existing debt.",
|
|
97
105
|
id: "effect/boundary",
|
|
98
106
|
registrable: false,
|
|
99
107
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
+
import type { SourceFile } from "#rule.ts";
|
|
3
|
+
import { parse } from "#rules/parse.ts";
|
|
2
4
|
|
|
3
5
|
function importedReference(declaration: ts.Declaration): string | undefined {
|
|
4
6
|
if (ts.isImportSpecifier(declaration)) {
|
|
@@ -65,8 +67,15 @@ export function boundaryReference(checker: ts.TypeChecker, node: ts.Node, seen =
|
|
|
65
67
|
return ts.isIdentifier(node) ? symbolReference(checker, node, seen) : undefined;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
const ENTRY_NAME = /(?:^|\/)(?:cli|main|entry|[^/]+-cli)\.[cm]?[jt]sx?$/u;
|
|
71
|
+
|
|
72
|
+
const RUNNER_HOST = /\.(?:config|test|spec)\.[cm]?[jt]sx?$/u;
|
|
73
|
+
|
|
74
|
+
export function entryModule(path: string, source: ts.SourceFile, checker: ts.TypeChecker): boolean {
|
|
75
|
+
if (RUNNER_HOST.test(path)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
if (ENTRY_NAME.test(path)) {
|
|
70
79
|
return true;
|
|
71
80
|
}
|
|
72
81
|
function visit(node: ts.Node): boolean {
|
|
@@ -83,3 +92,22 @@ export function boundaryEntryPoint(path: string, source: ts.SourceFile, checker:
|
|
|
83
92
|
}
|
|
84
93
|
return visit(source);
|
|
85
94
|
}
|
|
95
|
+
|
|
96
|
+
export function boundaryEntryPoint(path: string, source: ts.SourceFile, checker: ts.TypeChecker): boolean {
|
|
97
|
+
return RUNNER_HOST.test(path) || entryModule(path, source, checker);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Entry markers name their imports, so each module binds on its own without resolving the program behind it.
|
|
101
|
+
export function entryModules(sources: readonly SourceFile[]): ReadonlySet<string> {
|
|
102
|
+
const options: ts.CompilerOptions = { allowJs: true, noLib: true, noResolve: true, types: [] };
|
|
103
|
+
const host = ts.createCompilerHost(options);
|
|
104
|
+
const parsed = new Map(
|
|
105
|
+
sources.flatMap((file) => {
|
|
106
|
+
const source = parse(file);
|
|
107
|
+
return source === undefined ? [] : [[file.path, source] as const];
|
|
108
|
+
}),
|
|
109
|
+
);
|
|
110
|
+
host.getSourceFile = (path) => parsed.get(path);
|
|
111
|
+
const checker = ts.createProgram([...parsed.keys()], options, host).getTypeChecker();
|
|
112
|
+
return new Set([...parsed].flatMap(([path, source]) => (entryModule(path, source, checker) ? [path] : [])));
|
|
113
|
+
}
|
|
@@ -24,6 +24,6 @@ export const importsAliased = defineRule({
|
|
|
24
24
|
})),
|
|
25
25
|
),
|
|
26
26
|
description:
|
|
27
|
-
"Import own modules through the package.json `imports` aliases, including same-folder modules. Import other packages by their names and exported paths.",
|
|
27
|
+
"Import own modules through the package.json `imports` aliases, including same-folder modules; tool configs directly in a package's folder, which no alias reaches, may import each other relatively. Import other packages by their names and exported paths.",
|
|
28
28
|
id: "imports/aliased",
|
|
29
29
|
});
|