@shivaedev/quality 0.77.0 → 0.78.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +10 -14
- package/dist/adapters/declarationTagParameter.d.ts.map +1 -1
- package/dist/adapters/declarationTagParameter.js +4 -0
- package/dist/adapters/declarationTagParameter.js.map +1 -1
- package/dist/adapters/imports/resolve.d.ts.map +1 -1
- package/dist/adapters/imports/resolve.js +29 -5
- package/dist/adapters/imports/resolve.js.map +1 -1
- package/dist/adapters/presenceCheck.d.ts +3 -0
- package/dist/adapters/presenceCheck.d.ts.map +1 -0
- package/dist/adapters/presenceCheck.js +15 -0
- package/dist/adapters/presenceCheck.js.map +1 -0
- package/dist/engine/generateFirst.d.ts +5 -0
- package/dist/engine/generateFirst.d.ts.map +1 -0
- package/dist/engine/generateFirst.js +25 -0
- package/dist/engine/generateFirst.js.map +1 -0
- package/dist/engine/projectScripts.d.ts +11 -0
- package/dist/engine/projectScripts.d.ts.map +1 -0
- package/dist/engine/projectScripts.js +18 -0
- package/dist/engine/projectScripts.js.map +1 -0
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +2 -0
- package/dist/engine/session.js.map +1 -1
- package/dist/hooks/preCommit.d.ts.map +1 -1
- package/dist/hooks/preCommit.js +6 -19
- package/dist/hooks/preCommit.js.map +1 -1
- package/dist/imports/callsDefineModule.d.ts +3 -0
- package/dist/imports/callsDefineModule.d.ts.map +1 -0
- package/dist/imports/callsDefineModule.js +36 -0
- package/dist/imports/callsDefineModule.js.map +1 -0
- package/dist/imports/fences/check.d.ts.map +1 -1
- package/dist/imports/fences/check.js +3 -1
- package/dist/imports/fences/check.js.map +1 -1
- package/dist/imports/generatedFolders.d.ts +7 -0
- package/dist/imports/generatedFolders.d.ts.map +1 -0
- package/dist/imports/generatedFolders.js +21 -0
- package/dist/imports/generatedFolders.js.map +1 -0
- package/dist/imports/runtime.d.ts +1 -1
- package/dist/imports/runtime.d.ts.map +1 -1
- package/dist/imports/runtime.js +3 -2
- package/dist/imports/runtime.js.map +1 -1
- package/dist/naming/isOperationFile.d.ts +3 -0
- package/dist/naming/isOperationFile.d.ts.map +1 -0
- package/dist/naming/isOperationFile.js +42 -0
- package/dist/naming/isOperationFile.js.map +1 -0
- package/dist/naming/repeatedFolder.d.ts +2 -0
- package/dist/naming/repeatedFolder.d.ts.map +1 -0
- package/dist/naming/repeatedFolder.js +13 -0
- package/dist/naming/repeatedFolder.js.map +1 -0
- package/dist/rules/builtIn.d.ts +2 -4
- package/dist/rules/builtIn.d.ts.map +1 -1
- package/dist/rules/builtIn.js +2 -0
- package/dist/rules/builtIn.js.map +1 -1
- package/dist/rules/effect/serviceParameters.js +1 -1
- package/dist/rules/effect/serviceParameters.js.map +1 -1
- package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
- package/dist/rules/files/namedAfterExport.js +11 -12
- package/dist/rules/files/namedAfterExport.js.map +1 -1
- package/dist/rules/imports/resolvable.d.ts +1 -3
- package/dist/rules/imports/resolvable.d.ts.map +1 -1
- package/dist/rules/imports/resolvable.js +12 -10
- package/dist/rules/imports/resolvable.js.map +1 -1
- package/dist/rules/imports/runtime.d.ts.map +1 -1
- package/dist/rules/imports/runtime.js +26 -13
- package/dist/rules/imports/runtime.js.map +1 -1
- package/dist/rules/stories/rawServers.d.ts +2 -0
- package/dist/rules/stories/rawServers.d.ts.map +1 -0
- package/dist/rules/stories/rawServers.js +100 -0
- package/dist/rules/stories/rawServers.js.map +1 -0
- package/docs/north-star.md +1 -1
- package/package.json +3 -3
- package/src/adapters/declarationTagParameter.ts +4 -0
- package/src/adapters/imports/resolve.ts +31 -5
- package/src/adapters/presenceCheck.ts +17 -0
- package/src/engine/generateFirst.ts +32 -0
- package/src/engine/projectScripts.ts +25 -0
- package/src/engine/session.ts +2 -0
- package/src/hooks/preCommit.ts +10 -24
- package/src/imports/callsDefineModule.ts +43 -0
- package/src/imports/fences/check.ts +3 -1
- package/src/imports/generatedFolders.ts +28 -0
- package/src/imports/runtime.ts +7 -2
- package/src/naming/isOperationFile.ts +52 -0
- package/src/naming/repeatedFolder.ts +14 -0
- package/src/rules/builtIn.ts +2 -0
- package/src/rules/effect/serviceParameters.ts +1 -1
- package/src/rules/files/namedAfterExport.ts +14 -13
- package/src/rules/imports/resolvable.ts +13 -11
- package/src/rules/imports/runtime.ts +38 -14
- package/src/rules/stories/rawServers.ts +118 -0
- package/dist/imports/withoutGenerated.d.ts +0 -8
- package/dist/imports/withoutGenerated.d.ts.map +0 -1
- package/dist/imports/withoutGenerated.js +0 -65
- package/dist/imports/withoutGenerated.js.map +0 -1
- package/src/imports/withoutGenerated.ts +0 -82
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.78.0 - 2026-11-11
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `tests/raw-servers` reports a `test-support/` module that creates a `node:http`, `node:https` or `node:net` server and listens on a port itself, including a free-port probe. Hand a Node HTTP server to `loopbackServer` from `@shivaedev/test-story/server/adapters/loopback.ts`, which listens on a loopback port and closes it with the story's scope, or fake an outside HTTP API with `fakeHttpService` from `@shivaedev/test-story/server/fakeHttpService.ts`. Servers listening on a Unix socket path and `node:net` servers that handle their own sockets are accepted.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- `files/named-after-export` accepts a file named like its own folder in any case, so a feature folder `notes/` can hold `Notes.ts` exporting `Notes`. The file name still follows its export's case.
|
|
12
|
+
- `files/named-after-export` accepts a folder's main file whose name matches the folder's ignoring case and separators: `reading-lists/ReadingLists.ts` exporting `ReadingLists` passes, while `reading-lists/ReadingListsItems.ts` still repeats its folder.
|
|
13
|
+
- `files/named-after-export` lets a file whose one export is a `query` or `command` from `@shivaedev/contract/operation.ts` repeat words of the folders above it, so `reading-lists/server/List.ts` exporting `List` passes. The file is still named after its operation, case included, and other files beside it, such as `reading-lists/server/listRows.ts`, still may not repeat a folder.
|
|
14
|
+
- An import of a generated file that the generator does not write is reported by `imports/resolvable`, which names the module file that would define it, and `docs/references` reports a path to one, instead of accepting any path into a declared folder.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `imports/runtime` takes a file that calls `defineModule` as server code, so a defined module may import server code, and client or shared code that imports the module itself is reported with the generated client as the repair. It no longer follows a generated client's type import of its own module.
|
|
19
|
+
- `imports/fences` no longer follows a generated client's type import of its own module, so a page that imports another package's generated client needs no exception for the module behind it; the client's value imports still count.
|
|
20
|
+
- `imports/resolvable` accepts another workspace package's import of a file in a declared generated folder, such as `@scope/notes/generated/Notes.ts`, before the generator writes it.
|
|
21
|
+
- `docs/references` accepts a module path or a link into a declared generated folder before the generator writes the file.
|
|
22
|
+
- `effect/service-parameters` accepts comparing a tag that a function only hands to a `.middleware(tag)` declaration or `Context.pick` with `undefined` or `null`, such as `tag === undefined` or `options?.middleware !== undefined`, because that only tests whether an optional tag is present. Code that read a property such as `tag?.key` to get past the rule can compare the tag itself. Returning, storing, yielding or calling the tag is still reported.
|
|
23
|
+
|
|
24
|
+
### Breaking
|
|
25
|
+
|
|
26
|
+
- `imports/resolvable` takes no `generated` option, and a config that sets it is refused. Delete the option from `quality.config.ts`: Quality knows that the generator writes to `src/generated` at the project's root and in each workspace package. `RuleInputs.generated` is gone with it.
|
|
27
|
+
- `quality lint`, which the pre-commit hook and `quality ci` run too, first runs the `generate` script of the project's `package.json` through its package manager, so a fresh checkout, a newly written module and a deleted `src/generated` lint the same as an up-to-date tree. A project without a `generate` script runs nothing. When the script fails, the run stops with its output and exit code 2. A `generate` script that must not run before every lint, such as a database client generator, a migration writer that can prompt or a slow generator, gets another name.
|
|
28
|
+
|
|
3
29
|
## 0.77.0 - 2026-11-11
|
|
4
30
|
|
|
5
31
|
### Added
|
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ Within Effect code, folders named `adapters/` or `test-support/`, at any depth,
|
|
|
138
138
|
|
|
139
139
|
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.
|
|
140
140
|
|
|
141
|
-
`effect/service-parameters` reports parameters carrying a service in exported and local functions and public methods, including returned factories and function-typed parameters returning services. It follows service classes and tags, non-empty Contexts and service implementation shapes through aliases, interfaces, generic constraints, inferred parameters and destructuring. Read services from Effect's environment instead. An Effect or Stream requiring a service is a computation and is accepted. Methods implementing a service and functions constructing Layers may take services as parameters. Within Effect code, `test-support/` folders are exempt from this rule; `adapters/` folders are checked. Module-level PascalCase functions returning React nodes or elements are components: their props and callback prop signatures may carry services. A plain function, one that is neither an `Effect.fn` or `Effect.gen` body nor nested in one, may take an `AtomRegistry` or `AtomRpcClient` because it has no Effect environment to yield the handle from, even when it builds Effects for later; an `Effect.fn` taking the same handle still fails, and so does a parameter that carries another service beside it. A tag that a function never yields, calls or provides and only hands to a `.middleware(tag)` declaration or `Context.pick`, directly or through a local helper that does the same, is a declaration and is accepted. Callbacks whose arguments are supplied by their owner keep those arguments, including object methods contextually typed by a foreign signature, inline host plugin methods and methods implementing a foreign interface; wrapping and returning a callback as a runtime operation still checks it. Test-kit registrations do not turn plain kit state into runtime service plumbing. Type predicates inspect service values without declaring a runtime dependency. Operation parameters supplied exclusively by the service's `methods: (state)` argument, directly or through other such parameters and internal helpers, carry owned initializer state, including members of the Layer’s own Scope and parameters in helpers wrapped with `Effect.fn`. A hand-built state object or an independent Scope parameter still counts as service plumbing. Owned fibers, closeable scopes and native atom evaluation contexts follow Effect's lifecycle conventions; wrapping a function with `Effect.fn` still checks its parameters. A function may pass a foreign resource to another when the calls supply values constructed through an outside library or received by its host callbacks, including local construction helpers and an Effect acquisition wrapper; reading that resource from the environment still counts as service plumbing. Installed implementation shapes are discovered in the consuming repository's package scopes, alongside the framework service package's scope.
|
|
141
|
+
`effect/service-parameters` reports parameters carrying a service in exported and local functions and public methods, including returned factories and function-typed parameters returning services. It follows service classes and tags, non-empty Contexts and service implementation shapes through aliases, interfaces, generic constraints, inferred parameters and destructuring. Read services from Effect's environment instead. An Effect or Stream requiring a service is a computation and is accepted. Methods implementing a service and functions constructing Layers may take services as parameters. Within Effect code, `test-support/` folders are exempt from this rule; `adapters/` folders are checked. Module-level PascalCase functions returning React nodes or elements are components: their props and callback prop signatures may carry services. A plain function, one that is neither an `Effect.fn` or `Effect.gen` body nor nested in one, may take an `AtomRegistry` or `AtomRpcClient` because it has no Effect environment to yield the handle from, even when it builds Effects for later; an `Effect.fn` taking the same handle still fails, and so does a parameter that carries another service beside it. A tag that a function never yields, calls or provides and only hands to a `.middleware(tag)` declaration or `Context.pick`, directly or through a local helper that does the same, is a declaration and is accepted. Comparing such a tag with `undefined` or `null`, such as `tag === undefined` or `options?.middleware !== undefined`, only tests whether it is present and is accepted beside the declaration; returning or storing it still counts. Callbacks whose arguments are supplied by their owner keep those arguments, including object methods contextually typed by a foreign signature, inline host plugin methods and methods implementing a foreign interface; wrapping and returning a callback as a runtime operation still checks it. Test-kit registrations do not turn plain kit state into runtime service plumbing. Type predicates inspect service values without declaring a runtime dependency. Operation parameters supplied exclusively by the service's `methods: (state)` argument, directly or through other such parameters and internal helpers, carry owned initializer state, including members of the Layer’s own Scope and parameters in helpers wrapped with `Effect.fn`. A hand-built state object or an independent Scope parameter still counts as service plumbing. Owned fibers, closeable scopes and native atom evaluation contexts follow Effect's lifecycle conventions; wrapping a function with `Effect.fn` still checks its parameters. A function may pass a foreign resource to another when the calls supply values constructed through an outside library or received by its host callbacks, including local construction helpers and an Effect acquisition wrapper; reading that resource from the environment still counts as service plumbing. Installed implementation shapes are discovered in the consuming repository's package scopes, alongside the framework service package's scope.
|
|
142
142
|
|
|
143
143
|
A local lint runs the part of `effect/boundary` that reads each module alone: the constructs above, synchronous Node IO, runners, Promise bridges, and calls to throwing helpers defined in the same module. Calls to throwing helpers imported from other modules, `Effect.sync` bodies that reach one, and Promise-typed parameters need the type checker and run in its deep half, in CI and with `quality lint --full`.
|
|
144
144
|
|
|
@@ -247,7 +247,7 @@ import { defineConfig } from "@shivaedev/quality/config.ts";
|
|
|
247
247
|
export default defineConfig({ sources: ["src"] });
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
-
When a config exists, its folder is the root for paths and hook scripts. Without one, the current directory is the root. `sources` chooses the files the source rules read; a missing source stops the run. Directory discovery skips untracked files ignored by git through `.gitignore`, `info/exclude` or `core.excludesFile`, and the `.git`, `.worktrees` and `node_modules` directories. Tracked files remain checked even when an ignore pattern matches them; a folder named `generated/` does not exempt authored code. Generated output that git ignores is never reported, but Quality follows its imports: a module the sources import that git ignores joins the import graph, so `imports/runtime` and transitive fences see what it reaches and report the checked file that imports it, and `code/unused` counts its imports as uses. Some repository rules, such as manifest sorting, inspect the whole repository even when `sources` names only `src`.
|
|
250
|
+
When a config exists, its folder is the root for paths and hook scripts. Without one, the current directory is the root. `sources` chooses the files the source rules read; a missing source stops the run. Directory discovery skips untracked files ignored by git through `.gitignore`, `info/exclude` or `core.excludesFile`, and the `.git`, `.worktrees` and `node_modules` directories. Tracked files remain checked even when an ignore pattern matches them; a folder named `generated/` does not exempt authored code. Generated output that git ignores is never reported, but Quality follows its imports: a module the sources import that git ignores joins the import graph, so `imports/runtime` and transitive fences see what it reaches and report the checked file that imports it, and `code/unused` counts its imports as uses. A generated client's type import of its own module, the file at the same path outside `src/generated`, is erased and reaches nothing at run time, so `imports/runtime` and transitive fences do not follow it; its value imports they still follow. Some repository rules, such as manifest sorting, inspect the whole repository even when `sources` names only `src`.
|
|
251
251
|
|
|
252
252
|
Quality reads the skills tool’s `.shivaedev-skills.json` ownership manifest in each repository’s `.agents/skills` folder. It skips the recorded folders, their `.claude/skills` links and the manifest itself in source checks, Biome lint and formatting, manifest sorting and fixes, including rule-specific fixes. Local skills beside those copies remain checked. Change a shared skill at its source and run `shivaedev-skills sync` to refresh the copies.
|
|
253
253
|
|
|
@@ -294,6 +294,8 @@ An app says where its code runs through folder names. A package adopts the runti
|
|
|
294
294
|
|
|
295
295
|
`imports/runtime` rejects client imports of server code or Node built-ins. Shared code may import neither client nor server code, use browser globals such as `window`, `document` or `localStorage`, or import Node built-ins. Both client and server code may import shared code. The check includes type imports and re-exports and resolves aliases through the shared import graph. Locally bound names and property names are not browser globals; portable web APIs such as `URL`, `fetch` and `AbortController` remain available to shared code. Test files and `test-support/` ship nowhere and are outside this runtime policy.
|
|
296
296
|
|
|
297
|
+
A file that calls `defineModule` from `@shivaedev/contract/defineModule.ts` is server code wherever it sits, because a defined module holds the `run` of each operation. It may import server code, and client or shared code that imports it is reported with the repair: import the module's generated client instead.
|
|
298
|
+
|
|
297
299
|
A package whose code all runs in one runtime declares it in its manifest instead of nesting everything in one folder: `"quality": { "runtime": "server" }` makes every source file server code, and `"client"` makes every file browser code. Package-root tooling stays server code. A declaration beside `src/client/` or `src/server/` is reported on the manifest, as is any value other than `"client"` or `"server"`; choose one convention per package.
|
|
298
300
|
|
|
299
301
|
A package with a nonempty `bin` entry and no runtime folders is server code throughout. Runtime folders take precedence when a package also ships browser code. A Node library without a CLI declares `"runtime": "server"` or uses `src/server/`; `engines.node` alone does not say that a package is Node-only. A package with no runtime folders, runtime declaration or `bin` entry has no runtime policy beyond its tooling. Explicit fences run in every package. Runtime folders are detected independently of `sources`, including empty folders; `sources` still selects the code that is checked.
|
|
@@ -330,29 +332,23 @@ The import rules resolve every literal specifier with the nearest `tsconfig.json
|
|
|
330
332
|
|
|
331
333
|
Vite asset queries resolve the path before the query, including package assets through their declared exports. Supported suffixes match `vite/client`: `?url`, `?raw`, `?worker`, `?worker&inline`, `?worker&url`, `?sharedworker`, `?sharedworker&inline`, `?sharedworker&url`, `?inline`, `?no-inline`, `?url&inline`, `?url&no-inline` and `.wasm?init`. For example, `import url from 'zxing-wasm/reader/zxing_reader.wasm?url'` resolves the exported wasm file without an application module declaration. Missing files, private package paths and unsupported query suffixes still produce findings.
|
|
332
334
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
```ts
|
|
336
|
-
import { defineConfig } from "@shivaedev/quality/config.ts";
|
|
337
|
-
|
|
338
|
-
export default defineConfig({
|
|
339
|
-
rules: { "imports/resolvable": { options: { generated: ["src/generated"] } } },
|
|
340
|
-
});
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
The repository's `.gitignore` ignores the output and keeps the README:
|
|
335
|
+
An application, and each workspace package, keeps the files a generator writes in `src/generated`, where `@shivaedev/build` writes the client of each defined module. Git ignores the folder's contents and keeps a README that names the command:
|
|
344
336
|
|
|
345
337
|
```gitignore
|
|
346
338
|
src/generated/*
|
|
347
339
|
!src/generated/README.md
|
|
348
340
|
```
|
|
349
341
|
|
|
342
|
+
Quality makes sure those files exist before it reads a source: it first runs the `generate` script of the `package.json` in the config's folder through the manifest's `packageManager` (`npm` when omitted), so a fresh checkout, a module written since the last run and a deleted `src/generated` lint the same as an up-to-date tree. A project without a `generate` script runs nothing; give a script that must not run before every lint, such as a database client generator or a migration writer that can prompt, another name. When the script fails, the run stops before any rule with the script's output and exit code 2. No config names the folder. An import of a generated file is then checked like any other: `imports/resolvable` reports one the generator does not write and names the module file that would define it, and `docs/references` reports a path to one.
|
|
343
|
+
|
|
350
344
|
### Story tests
|
|
351
345
|
|
|
352
346
|
`tests/adapter-only-fakes` reports `vi.mock` and `vi.doMock` of repository modules outside `adapters/`, and replacement implementations on spies of owned exports. It resolves module paths with the repository's TypeScript projects, including aliases. Adapter modules, outside libraries, platform globals, observing spies and quoted fixture source pass. For Layers and `Effect.provideService`, it reports locally constructed replacements of imported owned `defineService` services. Its static analysis does not identify bare Context service keys, factory-produced implementations or service instances passed through parameters and object properties. Review those supplies as well: fake repository code only under `adapters/`, and delete a test whose failure can only be shown by faking internals.
|
|
353
347
|
|
|
354
348
|
Keep story kits and fixtures in `src/test-support` and keep each spec specific to its story. [`@shivaedev/test-story`](https://github.com/ShivaeDev/platform/tree/main/packages/test-story#readme) explains how to build the kit, traits and verbs over a real engine.
|
|
355
349
|
|
|
350
|
+
`tests/raw-servers` reports a `node:http`, `node:https` or `node:net` server that a `test-support/` module creates with `createServer` or `new Server` and listens on a port itself, including a free-port probe. Hand a Node HTTP server to `loopbackServer` from `@shivaedev/test-story/server/adapters/loopback.ts`, which listens on a loopback port, returns its URL and closes the server with the story's scope, or fake an outside HTTP API with `fakeHttpService` from `@shivaedev/test-story/server/fakeHttpService.ts`. The rule reads each module's imports and syntax. It accepts a server handed to `loopbackServer` or to Effect's `NodeHttpServer.layer`, other libraries' servers such as Vite's, type-only imports, a server listening on a Unix socket or pipe path, which `loopbackServer` cannot serve, and a `node:net` server that handles its own sockets, which speaks a protocol other than HTTP. Production code is not checked.
|
|
351
|
+
|
|
356
352
|
Quality's `tests/story-specs` rule reports a test file that declares tests without a kit's `it`, including plain Vitest `it` and `test` declarations mixed with stories. Typecheck tests are exempt, as are only the packages named `@shivaedev/test-story`, `@shivaedev/test` and `@shivaedev/types`, wherever they live in the workspace or at its root. Other dependencies of test-story, including development dependencies, remain checked.
|
|
357
353
|
|
|
358
354
|
Quality's `tests/story-engine` rule reports spec bodies that read raw service handles, reach through `story.engine`, or call production constructors to wire an engine outside the kit. It follows local aliases, destructuring and re-exported service tags inside the body, including nested callbacks. Move that access into verbs or traits in `test-support/` and keep expectations in the spec. A constructor can remain the subject of its colocated spec; native SQL handles used only for `withTransaction` can wrap kit verbs. Native Effect data constructors remain available. The rule also reports a kit story with no traits whose body never references its verbs, its story or its test context. Drive the engine through one of the kit's verbs or traits, or, if the code under test is pure, move it to `<stem>.unit.test.ts`, which reaches no engine and mocks nothing. The rule follows the same kit origins and prerequisite exemptions as `tests/story-specs`; unit and typecheck files are exempt.
|
|
@@ -474,7 +470,7 @@ For adoption, run `quality baseline write --rule code/unused` and review the rec
|
|
|
474
470
|
- **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, and so are writes on a freshly built object: `Object.assign(new X(...), ...)`, and `Object.assign` or `Object.defineProperty` on a local `const` initialised with `new X(...)` in the same function that nothing has used before the write. An object the caller supplied, or one a conditional might have come from the caller, is still reported. Double casts and the hidden casts visible in syntax run on every lint; readonly writes and SQL row generics on a tag other than `sql` need TypeScript declarations and run in the rule's deep half, in CI and with `quality lint --full`. These checks do not prove that arbitrary helper functions validate their input.
|
|
475
471
|
- **Suppressions:** the `suppressions/*` rules reject inline lint and compiler directives, casts through `unknown`, `any` or `never`, Biome settings that weaken a check 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`.
|
|
476
472
|
- **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.
|
|
477
|
-
- **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 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.
|
|
473
|
+
- **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 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. A file named like its own folder, ignoring case and separators, does not repeat it: a feature folder `notes/` holds `Notes.ts` exporting `Notes` and `reading-lists/` holds `ReadingLists.ts` exporting `ReadingLists`, while `notes/notes.ts` does not name that export and `users/UsersList.ts` and `reading-lists/ReadingListsItems.ts` repeat their folder. A file whose one export is an operation, a `query` or `command` imported from `@shivaedev/contract/operation.ts` under any local name, is named after that operation even when a folder above holds the same word: `reading-lists/server/List.ts` exports `List`. It is still named after its export, case included, and other files beside it, such as `notes/server/ownedNote.ts`, still may not repeat a folder. 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.
|
|
478
474
|
- **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.
|
|
479
475
|
- **React:** `react/jsx-conditionals` reports `&&` and ternaries in the JSX children a component returns, including nested decisions and returned `.map` items. Decisions in a `const` above the return, JSX built inside library callbacks and conditional attributes are accepted. A ternary with two plain string or number literal branches, such as `{on ? "On" : "Off"}`, is accepted; branches that select JSX, components or computed values still need a decision before the JSX. This rule owns the check, so the shared Biome preset leaves `noLeakedRender` off.
|
|
480
476
|
- **Tests:** `tests/follow` and `tests/colocated` keep a test beside the code it covers, named `<file>[.<modifier>].test.ts` or `<behaviour>[.<modifier>].spec.ts` with at most one modifier of `dom`, `slow`, `typecheck` and `unit`; a unit test runs without the DOM, so `.unit.dom` is rejected. A package-owned `test/` tree beside its `src/` is an accepted suite: `.test` files follow the corresponding `src/` path, and `.spec` files name behaviours there. This works for workspace members and standalone packages. Outside those trees, `tests/colocated` always treats `__tests__/` as a test folder. It treats `test/`, `tests/` and `spec/` as test folders only when their directly contained checked files are all tests or test support; a product folder with source beside its specs is an ordinary source folder. Declared `suites` keep their own layout. Shared test support belongs in `test-support/`, the sanctioned test-only folder. A test covering a whole module may sit at its root or directly beside its folder. The story rules above keep setup in the kit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarationTagParameter.d.ts","sourceRoot":"","sources":["../../src/adapters/declarationTagParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"declarationTagParameter.d.ts","sourceRoot":"","sources":["../../src/adapters/declarationTagParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AA8E5B,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,cAyDhE,EAAE,CAAC,oBAAoB,KAAG,OAAO,CAcpE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
+
import { presenceCheck } from "#adapters/presenceCheck.ts";
|
|
2
3
|
import { declarationOf, resolvedValue } from "#adapters/serviceModelSyntax.ts";
|
|
3
4
|
const RPC_MIDDLEWARE = "~effect/rpc/RpcMiddleware";
|
|
4
5
|
function implementationParameter(checker, parameter) {
|
|
@@ -102,6 +103,9 @@ export function declarationTagParameter(checker, carries) {
|
|
|
102
103
|
if (ts.isVariableDeclaration(value.parent) && value.parent.initializer === value) {
|
|
103
104
|
return onlyDeclared(body, value.parent.name, seen);
|
|
104
105
|
}
|
|
106
|
+
if (presenceCheck(checker, value)) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
105
109
|
const declaration = declares(value);
|
|
106
110
|
seen.declared ||= declaration;
|
|
107
111
|
return declaration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarationTagParameter.js","sourceRoot":"","sources":["../../src/adapters/declarationTagParameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAE/E,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD,SAAS,uBAAuB,CAAC,OAAuB,EAAE,SAAkC;IAC3F,MAAM,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC;IAC5B,IAAI,CAAC,CAAC,EAAE,CAAC,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACrH,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,cAAc,GAAG,OAAO;SAC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uB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC;QACf,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC5B,MAAM,IAAI,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnI,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC;IACf,CAAC;IACD,OAAO,eAAe,CAAC;AACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/resolve.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAgCzD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/resolve.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAgCzD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AA8DD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAavH;AAYD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAY1I"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { realpathSync } from "node:fs";
|
|
1
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { dirname, join, relative } from "node:path";
|
|
4
4
|
import ts from "typescript";
|
|
@@ -62,13 +62,37 @@ function resolvedPath(request, from, project) {
|
|
|
62
62
|
const path = located(request, from, project);
|
|
63
63
|
return path === undefined ? undefined : fitting(path, request.type);
|
|
64
64
|
}
|
|
65
|
+
// A package import of a missing file names a path in the repository when a workspace link leads there, outside installed packages.
|
|
66
|
+
function linkedTarget(root, path) {
|
|
67
|
+
if (!path.includes(NODE_MODULES)) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
let folder = dirname(path);
|
|
71
|
+
while (!existsSync(folder) && dirname(folder) !== folder) {
|
|
72
|
+
folder = dirname(folder);
|
|
73
|
+
}
|
|
74
|
+
const target = posix(relative(realpathSync(root), join(realpathSync(folder), relative(folder, path))));
|
|
75
|
+
return target.startsWith("../") || target.split("/").includes("node_modules") ? undefined : target;
|
|
76
|
+
}
|
|
77
|
+
function workspaceHost(root) {
|
|
78
|
+
return {
|
|
79
|
+
...ts.sys,
|
|
80
|
+
fileExists: (path) => ts.sys.fileExists(path) || (!path.endsWith(`/${PACKAGE_JSON}`) && linkedTarget(root, path) !== undefined),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
65
83
|
export function presumedTarget(root, request, from, project) {
|
|
66
|
-
|
|
84
|
+
const specifier = request.specifier.replace(QUERY, "");
|
|
85
|
+
if (request.kind !== "import" || specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
67
86
|
return undefined;
|
|
68
87
|
}
|
|
69
|
-
|
|
70
|
-
.resolvedModule
|
|
71
|
-
|
|
88
|
+
if (specifier.startsWith(PACKAGE_IMPORT)) {
|
|
89
|
+
const path = ts.resolveModuleName(specifier, from, project.options, presumingHost, undefined, undefined, request.mode).resolvedModule
|
|
90
|
+
?.resolvedFileName;
|
|
91
|
+
return path === undefined ? undefined : posix(relative(root, path));
|
|
92
|
+
}
|
|
93
|
+
const path = ts.resolveModuleName(specifier, from, project.options, workspaceHost(root), undefined, undefined, request.mode).resolvedModule
|
|
94
|
+
?.resolvedFileName;
|
|
95
|
+
return path === undefined ? undefined : linkedTarget(root, path);
|
|
72
96
|
}
|
|
73
97
|
function endpointAt(root, specifier, path) {
|
|
74
98
|
const real = posix(realpathSync(path));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/adapters/imports/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/adapters/imports/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI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AAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACvI,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,OAAgB,EAAE,OAAsB,EAAE,IAAY,EAAE,OAAgB;IACnH,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;IACnE,CAAC;IACD,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC;QAC/C,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE;QAC/F,CAAC,CAAC,SAAS,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presenceCheck.d.ts","sourceRoot":"","sources":["../../src/adapters/presenceCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,wBAAgB,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,UAAU,GAAG,OAAO,CAcpF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export function presenceCheck(checker, value) {
|
|
3
|
+
const comparison = value.parent;
|
|
4
|
+
if (!ts.isBinaryExpression(comparison)) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
const operator = comparison.operatorToken.kind;
|
|
8
|
+
const other = comparison.left === value ? comparison.right : comparison.left;
|
|
9
|
+
return ((operator === ts.SyntaxKind.EqualsEqualsEqualsToken
|
|
10
|
+
|| operator === ts.SyntaxKind.ExclamationEqualsEqualsToken
|
|
11
|
+
|| operator === ts.SyntaxKind.EqualsEqualsToken
|
|
12
|
+
|| operator === ts.SyntaxKind.ExclamationEqualsToken)
|
|
13
|
+
&& (checker.getTypeAtLocation(other).flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Null)) !== 0);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=presenceCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presenceCheck.js","sourceRoot":"","sources":["../../src/adapters/presenceCheck.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,UAAU,aAAa,CAAC,OAAuB,EAAE,KAAoB;IAC1E,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;IAChC,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC;IAC/C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;IAC7E,OAAO,CACN,CAAC,QAAQ,KAAK,EAAE,CAAC,UAAU,CAAC,uBAAuB;WAC/C,QAAQ,KAAK,EAAE,CAAC,UAAU,CAAC,4BAA4B;WACvD,QAAQ,KAAK,EAAE,CAAC,UAAU,CAAC,iBAAiB;WAC5C,QAAQ,KAAK,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC;WACnD,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAChG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { ChildProcessSpawner } from "effect/process";
|
|
3
|
+
import { SetupFailure } from "#failure.ts";
|
|
4
|
+
export declare const generateFirst: (root: string) => Effect.Effect<undefined, SetupFailure, ChildProcessSpawner.ChildProcessSpawner | import("effect/FileSystem").FileSystem>;
|
|
5
|
+
//# sourceMappingURL=generateFirst.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFirst.d.ts","sourceRoot":"","sources":["../../src/engine/generateFirst.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAgB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,eAAO,MAAM,aAAa,4IAsBzB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Effect, Option, Stream } from "effect";
|
|
2
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
3
|
+
import { HeldLock } from "@shivaedev/heavy-lock/HeldLock.ts";
|
|
4
|
+
import { projectScripts } from "#engine/projectScripts.ts";
|
|
5
|
+
import { SetupFailure } from "#failure.ts";
|
|
6
|
+
const SCRIPT = "generate";
|
|
7
|
+
// Generated files are not committed, so the project writes them before any rule reads an import of them; a run holding the heavy lock lends it to the generator. An unreadable manifest names no script, and manifests/valid reports it.
|
|
8
|
+
export const generateFirst = Effect.fn("Engine.generateFirst")(function* (root) {
|
|
9
|
+
const project = yield* projectScripts(root, [SCRIPT]).pipe(Effect.catchTags({ FilesystemFailure: () => Effect.undefined, ManifestFailure: () => Effect.undefined }));
|
|
10
|
+
if (project === undefined || project.scripts.length === 0) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const { manager } = project;
|
|
14
|
+
const held = yield* Effect.serviceOption(HeldLock);
|
|
15
|
+
const env = Option.match(held, { onNone: () => ({}), onSome: (lock) => lock.env });
|
|
16
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
17
|
+
const child = yield* spawner.spawn(ChildProcess.make(manager, ["run", SCRIPT], { cwd: root, env, extendEnv: true, stdin: "ignore" }));
|
|
18
|
+
const [output, code] = yield* Effect.all([Stream.mkString(Stream.decodeText(child.all)), child.exitCode], { concurrency: "unbounded" });
|
|
19
|
+
if (Number(code) !== 0) {
|
|
20
|
+
return yield* new SetupFailure({
|
|
21
|
+
message: `\`${manager} run ${SCRIPT}\` failed (exit ${code}) before Quality read the sources:\n${output.trimEnd()}`,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}, Effect.scoped, Effect.catchTag("PlatformError", (cause) => new SetupFailure({ cause, message: `cannot run the project's ${SCRIPT} script: ${cause.message}` })));
|
|
25
|
+
//# sourceMappingURL=generateFirst.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateFirst.js","sourceRoot":"","sources":["../../src/engine/generateFirst.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,GAAG,UAAU,CAAC;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,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;IACxI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC;YAC9B,OAAO,EAAE,KAAK,OAAO,QAAQ,MAAM,mBAAmB,IAAI,uCAAuC,MAAM,CAAC,OAAO,EAAE,EAAE;SACnH,CAAC,CAAC;IACJ,CAAC;AACF,CAAC,EACD,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,4BAA4B,MAAM,YAAY,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAChJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { SetupFailure } from "#failure.ts";
|
|
3
|
+
export interface ProjectScripts {
|
|
4
|
+
readonly manager: string;
|
|
5
|
+
readonly scripts: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export declare const projectScripts: (root: string, wanted: readonly string[]) => Effect.Effect<{
|
|
8
|
+
manager: string;
|
|
9
|
+
scripts: string[];
|
|
10
|
+
}, SetupFailure | import("#adapters/manifestInventory.ts").ManifestReadFailure, import("effect/FileSystem").FileSystem>;
|
|
11
|
+
//# sourceMappingURL=projectScripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectScripts.d.ts","sourceRoot":"","sources":["../../src/engine/projectScripts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAGtC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAID,eAAO,MAAM,cAAc;;;uHAWzB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as NodePath from "@effect/platform-node/NodePath";
|
|
2
|
+
import { Effect, Path } from "effect";
|
|
3
|
+
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
4
|
+
import { manifestReader } from "#adapters/manifestReader.ts";
|
|
5
|
+
import { SetupFailure } from "#failure.ts";
|
|
6
|
+
const MANAGERS = ["npm", "pnpm", "yarn", "bun"];
|
|
7
|
+
export const projectScripts = Effect.fn("Engine.projectScripts")(function* (root, wanted) {
|
|
8
|
+
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
9
|
+
const file = join(root, "package.json");
|
|
10
|
+
const manifest = yield* readPackageManifest(yield* manifestReader(root), file);
|
|
11
|
+
const scripts = wanted.filter((script) => manifest?.scripts?.[script] !== undefined);
|
|
12
|
+
const manager = manifest?.packageManager?.split("@")[0] ?? "npm";
|
|
13
|
+
if (scripts.length > 0 && !MANAGERS.includes(manager)) {
|
|
14
|
+
return yield* new SetupFailure({ message: `${file}: unsupported packageManager "${manager}". Use npm, pnpm, yarn or bun.` });
|
|
15
|
+
}
|
|
16
|
+
return { manager, scripts };
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=projectScripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectScripts.js","sourceRoot":"","sources":["../../src/engine/projectScripts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;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 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/engine/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAItC,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,KAAK,YAAY,EAA2B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/engine/session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAItC,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,KAAK,YAAY,EAA2B,MAAM,yBAAyB,CAAC;AAGrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,OAAO;IACvB,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,QAAQ,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACtD,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC1C;AAQD,eAAO,MAAM,IAAI,oIAqBf,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAgBrC,eAAO,MAAM,WAAW,+HAkBtB,CAAC"}
|
package/dist/engine/session.js
CHANGED
|
@@ -5,6 +5,7 @@ import { manifestReader } from "#adapters/manifestReader.ts";
|
|
|
5
5
|
import { typeScriptProgram } from "#adapters/typeScriptProgram.ts";
|
|
6
6
|
import { loadConfig } from "#config/load.ts";
|
|
7
7
|
import { readBaseline, readInput } from "#engine/baselineFile.ts";
|
|
8
|
+
import { generateFirst } from "#engine/generateFirst.ts";
|
|
8
9
|
import { runRules } from "#engine/runRules.ts";
|
|
9
10
|
import { biomeExceptions } from "#exceptions/biomeFindings.ts";
|
|
10
11
|
import { registryEntries } from "#exceptions/registryEntries.ts";
|
|
@@ -56,6 +57,7 @@ export const openSession = Effect.fn("Engine.openSession")(function* (cwd, confi
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
const baseline = yield* readBaseline(config);
|
|
60
|
+
yield* generateFirst(config.root);
|
|
59
61
|
const scanned = yield* scan(config);
|
|
60
62
|
return { ...scanned, baseline, config, registry: registryEntries(config.exceptions) };
|
|
61
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/engine/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAuB,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAqB,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/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AS,WAAW,IAAI,wBAAwB,MAAM,CAAC,IAAI,GAAG;aAC3I,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;AACvF,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preCommit.d.ts","sourceRoot":"","sources":["../../src/hooks/preCommit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preCommit.d.ts","sourceRoot":"","sources":["../../src/hooks/preCommit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA4BvD,eAAO,MAAM,aAAa,mIA6BxB,CAAC"}
|
package/dist/hooks/preCommit.js
CHANGED
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Config, Console, Effect, Path } from "effect";
|
|
1
|
+
import { Config, Console, Effect } from "effect";
|
|
3
2
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
4
|
-
import { readPackageManifest } from "#adapters/manifestInventory.ts";
|
|
5
|
-
import { manifestReader } from "#adapters/manifestReader.ts";
|
|
6
3
|
import { reportLint } from "#cli/lint.ts";
|
|
7
4
|
import { loadConfig } from "#config/load.ts";
|
|
8
5
|
import { passes } from "#engine/evaluate.ts";
|
|
6
|
+
import { projectScripts } from "#engine/projectScripts.ts";
|
|
9
7
|
import { GateFailed, SetupFailure } from "#failure.ts";
|
|
10
8
|
import { stagedCheck } from "#hooks/stagedCheck.ts";
|
|
11
9
|
import { recap } from "#report/recap.ts";
|
|
12
10
|
const COMMIT_AGAIN = "help: fix what the output above reports, then commit again; `quality hooks pre-commit` repeats these checks without committing.";
|
|
13
|
-
const commitScripts = Effect.fnUntraced(function* (root) {
|
|
14
|
-
const { join } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
|
|
15
|
-
const file = join(root, "package.json");
|
|
16
|
-
const readText = yield* manifestReader(root);
|
|
17
|
-
const manifest = yield* Effect.mapError(readPackageManifest(readText, file), (cause) => new SetupFailure({ cause, message: `${file} is invalid: ${cause.message}` }));
|
|
18
|
-
if (manifest === undefined) {
|
|
19
|
-
return { manager: "npm", scripts: [] };
|
|
20
|
-
}
|
|
21
|
-
const manager = manifest.packageManager?.split("@")[0] ?? "npm";
|
|
22
|
-
if (!["npm", "pnpm", "yarn", "bun"].includes(manager)) {
|
|
23
|
-
return yield* new SetupFailure({ message: `${file}: unsupported packageManager "${manager}". Use npm, pnpm, yarn or bun.` });
|
|
24
|
-
}
|
|
25
|
-
return { manager, scripts: ["typecheck", "quality:commit"].filter((script) => manifest.scripts?.[script] !== undefined) };
|
|
26
|
-
});
|
|
27
11
|
const runScript = Effect.fnUntraced(function* (root, manager, script) {
|
|
28
12
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
29
13
|
const child = yield* spawner.spawn(ChildProcess.make(manager, ["run", script], { cwd: root, stderr: "inherit", stdin: "inherit", stdout: "inherit" }));
|
|
30
14
|
return Number(yield* child.exitCode);
|
|
31
15
|
}, Effect.scoped, Effect.mapError((error) => new SetupFailure({ cause: error, message: `cannot run a pre-commit script: ${error.message}` })));
|
|
16
|
+
function invalidManifest(cause) {
|
|
17
|
+
return new SetupFailure({ cause, message: `${cause.path} is invalid: ${cause.message}` });
|
|
18
|
+
}
|
|
32
19
|
const inCloudSession = Config.String("CLAUDE_CODE_REMOTE").pipe(Config.withDefault(""), Config.map((value) => value === "true"));
|
|
33
20
|
export const preCommitHook = Effect.fn("Hooks.preCommitHook")(function* (cwd, path) {
|
|
34
21
|
const config = yield* loadConfig(cwd, path);
|
|
@@ -40,7 +27,7 @@ export const preCommitHook = Effect.fn("Hooks.preCommitHook")(function* (cwd, pa
|
|
|
40
27
|
}
|
|
41
28
|
return;
|
|
42
29
|
}
|
|
43
|
-
const { manager, scripts } = yield*
|
|
30
|
+
const { manager, scripts } = yield* projectScripts(config.root, ["typecheck", "quality:commit"]).pipe(Effect.catchTags({ FilesystemFailure: invalidManifest, ManifestFailure: invalidManifest }));
|
|
44
31
|
const { context, outcome } = yield* reportLint(cwd, path, true);
|
|
45
32
|
const linted = passes(outcome);
|
|
46
33
|
const failed = linted ? [] : ["quality lint"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preCommit.js","sourceRoot":"","sources":["../../src/hooks/preCommit.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"preCommit.js","sourceRoot":"","sources":["../../src/hooks/preCommit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,YAAY,GACjB,iIA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AAG,GAAG,OAAO,QAAQ,MAAM,EAAE,CAAC;QAC3C,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,OAAO,IAAI,CAAC,CAAC;QACtD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5D,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,CAAC,KAAK,OAAO,iBAAiB,IAAI,GAAG,CAAC,CAAC;QACnD,CAAC;IACF,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACzD,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,QAAQ,EAAE,+BAA+B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAClH,OAAO,KAAK,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC;IAChC,CAAC;AACF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callsDefineModule.d.ts","sourceRoot":"","sources":["../../src/imports/callsDefineModule.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA0B3C,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAe3D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { parse } from "#rules/parse.ts";
|
|
3
|
+
const DEFINE_MODULE = "@shivaedev/contract/defineModule.ts";
|
|
4
|
+
function definers(source) {
|
|
5
|
+
return new Set(source.statements.filter(ts.isImportDeclaration).flatMap((statement) => {
|
|
6
|
+
const clause = statement.importClause;
|
|
7
|
+
const bindings = clause?.namedBindings;
|
|
8
|
+
if (clause === undefined
|
|
9
|
+
|| clause.isTypeOnly
|
|
10
|
+
|| bindings === undefined
|
|
11
|
+
|| !ts.isNamedImports(bindings)
|
|
12
|
+
|| !(ts.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === DEFINE_MODULE)) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return bindings.elements
|
|
16
|
+
.filter((element) => !element.isTypeOnly && (element.propertyName ?? element.name).text === "defineModule")
|
|
17
|
+
.map((element) => element.name.text);
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
export function callsDefineModule(file) {
|
|
21
|
+
const source = file.text.includes("defineModule") ? parse(file) : undefined;
|
|
22
|
+
const names = source === undefined ? new Set() : definers(source);
|
|
23
|
+
if (source === undefined || names.size === 0) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
let found = false;
|
|
27
|
+
function visit(node) {
|
|
28
|
+
found ||= ts.isCallExpression(node) && ts.isIdentifier(node.expression) && names.has(node.expression.text);
|
|
29
|
+
if (!found) {
|
|
30
|
+
ts.forEachChild(node, visit);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
visit(source);
|
|
34
|
+
return found;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=callsDefineModule.js.map
|