@collective-intelligence/lint 0.1.28 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -13
- package/dist/index.js +10 -10
- package/package.json +2 -2
- package/skills/ci-solution-structure/references/enforcement.md +1 -1
package/README.md
CHANGED
|
@@ -73,15 +73,15 @@ the `collective-intelligence` pack installs the skill and adds the plugin with
|
|
|
73
73
|
|
|
74
74
|
## Rules
|
|
75
75
|
|
|
76
|
-
| Rule | Enforces
|
|
77
|
-
| -------------------------------- |
|
|
78
|
-
| `ci-solution/package-entrypoint` | An import of another package targets an entrypoint declared in its `package.json` exports.
|
|
79
|
-
| `ci-solution/subpath-imports` | Imports between subpath folders follow the allowed direction.
|
|
80
|
-
| `ci-solution/subpath-entrypoint` | An import from another subpath folder targets the folder or its index file.
|
|
81
|
-
| `ci-solution/subpath-index` | Every subpath folder has an `index.ts` or `index.tsx`.
|
|
82
|
-
| `ci-solution/effect-subpath` | An SDK Effect API comes from the SDK's `/effect` subpath;
|
|
83
|
-
| `ci-solution/no-run-in-view` | A view module calls no `fetch` and runs no Effect.
|
|
84
|
-
| `ci-solution/effect-actors` | XState side-effect actors are `fromEffect` actors.
|
|
76
|
+
| Rule | Enforces | Group |
|
|
77
|
+
| -------------------------------- | ------------------------------------------------------------------------------------------ | ------------------ |
|
|
78
|
+
| `ci-solution/package-entrypoint` | An import of another package targets an entrypoint declared in its `package.json` exports. | Package boundaries |
|
|
79
|
+
| `ci-solution/subpath-imports` | Imports between subpath folders follow the allowed direction. | Solution layout |
|
|
80
|
+
| `ci-solution/subpath-entrypoint` | An import from another subpath folder targets the folder or its index file. | Solution layout |
|
|
81
|
+
| `ci-solution/subpath-index` | Every subpath folder has an `index.ts` or `index.tsx`. | Solution layout |
|
|
82
|
+
| `ci-solution/effect-subpath` | An SDK Effect API comes from the SDK's `/effect` subpath; removed SDK paths are reported. | Effect convention |
|
|
83
|
+
| `ci-solution/no-run-in-view` | A view module calls no `fetch` and runs no Effect. | Effect convention |
|
|
84
|
+
| `ci-solution/effect-actors` | XState side-effect actors are `fromEffect` actors. | Effect convention |
|
|
85
85
|
|
|
86
86
|
### Package boundaries
|
|
87
87
|
|
|
@@ -164,10 +164,10 @@ check the parts of that convention that imports and calls show.
|
|
|
164
164
|
A Collective Intelligence SDK (`@collective-intelligence/*`) exposes its Effect
|
|
165
165
|
API at `<sdk>/effect` and `<sdk>/effect/<adapter>`. The rule reports an SDK path
|
|
166
166
|
that names Effect elsewhere: a `<sdk>-effect` package, or an `effect` segment
|
|
167
|
-
below another subpath. It also reports each
|
|
168
|
-
replacement:
|
|
167
|
+
below another subpath. It also reports each SDK path that the release after 0.2.0
|
|
168
|
+
removes, with its replacement:
|
|
169
169
|
|
|
170
|
-
|
|
|
170
|
+
| Removed path | Replacement |
|
|
171
171
|
| ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
172
172
|
| `@collective-intelligence/external-apps-server-sdk/runtime/effect` | `@collective-intelligence/external-apps-server-sdk/effect` |
|
|
173
173
|
| `@collective-intelligence/external-apps-server-sdk/persistence/drizzle/effect` | `@collective-intelligence/external-apps-server-sdk/effect`; `layerNodePostgres` and `NodePostgresLayerOptions` from `@collective-intelligence/external-apps-server-sdk/effect/node-postgres` |
|
|
@@ -178,7 +178,7 @@ replacement:
|
|
|
178
178
|
import { CiClient } from "@collective-intelligence/external-apps-client-sdk/effect" // valid
|
|
179
179
|
import { createClient } from "@collective-intelligence/external-apps-client-sdk" // valid
|
|
180
180
|
import { Realtime } from "@collective-intelligence/external-apps-client-sdk/realtime/effect" // reported
|
|
181
|
-
import { CiRuntime } from "@collective-intelligence/external-apps-server-sdk/runtime/effect" // reported:
|
|
181
|
+
import { CiRuntime } from "@collective-intelligence/external-apps-server-sdk/runtime/effect" // reported: removed
|
|
182
182
|
```
|
|
183
183
|
|
|
184
184
|
#### `no-run-in-view`
|
package/dist/index.js
CHANGED
|
@@ -161,7 +161,7 @@ var declaresEntrypoint = (target, subpath) => {
|
|
|
161
161
|
// src/rules/effect-subpath/effect-subpath.ts
|
|
162
162
|
var SCOPE = "@collective-intelligence/";
|
|
163
163
|
var EFFECT_PACKAGE_SUFFIX = "-effect";
|
|
164
|
-
var
|
|
164
|
+
var REMOVED = new Map([
|
|
165
165
|
[
|
|
166
166
|
"@collective-intelligence/external-apps-server-sdk/runtime/effect",
|
|
167
167
|
"@collective-intelligence/external-apps-server-sdk/effect"
|
|
@@ -189,8 +189,8 @@ var MOVED = new Map([
|
|
|
189
189
|
]
|
|
190
190
|
]);
|
|
191
191
|
var messages2 = {
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
removed: "`{{specifier}}` is removed after 0.2.0. Import `{{replacement}}`.",
|
|
193
|
+
removedMoved: "`{{specifier}}` is removed after 0.2.0. Import {{names}} from `{{moved}}`, and each other name from `{{replacement}}`.",
|
|
194
194
|
outsideEffect: "`{{specifier}}` imports an SDK Effect API from outside its `/effect` subpath. Import `{{replacement}}`."
|
|
195
195
|
};
|
|
196
196
|
var effectSubpathFor = (specifier) => {
|
|
@@ -211,31 +211,31 @@ var effectSubpath = {
|
|
|
211
211
|
create(context) {
|
|
212
212
|
return moduleSpecifiers((node) => {
|
|
213
213
|
const specifier = node.value;
|
|
214
|
-
const
|
|
214
|
+
const removed = REMOVED.get(specifier);
|
|
215
215
|
const moved = MOVED.get(specifier);
|
|
216
|
-
if (
|
|
216
|
+
if (removed !== undefined && moved !== undefined) {
|
|
217
217
|
context.report({
|
|
218
218
|
data: {
|
|
219
219
|
moved: moved.path,
|
|
220
220
|
names: moved.names,
|
|
221
|
-
replacement:
|
|
221
|
+
replacement: removed,
|
|
222
222
|
specifier
|
|
223
223
|
},
|
|
224
|
-
messageId: "
|
|
224
|
+
messageId: "removedMoved",
|
|
225
225
|
node
|
|
226
226
|
});
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
|
-
const replacement =
|
|
229
|
+
const replacement = removed ?? effectSubpathFor(specifier);
|
|
230
230
|
if (replacement !== null) {
|
|
231
|
-
const messageId =
|
|
231
|
+
const messageId = removed === undefined ? "outsideEffect" : "removed";
|
|
232
232
|
context.report({ data: { replacement, specifier }, messageId, node });
|
|
233
233
|
}
|
|
234
234
|
});
|
|
235
235
|
},
|
|
236
236
|
meta: {
|
|
237
237
|
docs: {
|
|
238
|
-
description: "Require the Effect API of a Collective Intelligence SDK to come from its `/effect` subpath, and report
|
|
238
|
+
description: "Require the Effect API of a Collective Intelligence SDK to come from its `/effect` subpath, and report removed SDK paths."
|
|
239
239
|
},
|
|
240
240
|
messages: messages2,
|
|
241
241
|
type: "problem"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@collective-intelligence/lint",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Oxlint plugin with the Collective Intelligence lint rules: package boundaries and solution package layout.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"typescript": "7.0.2",
|
|
49
49
|
"ultracite": "7.10.7"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "51fdea833e25fe215b3cf0d70adf1984b8e0f81c"
|
|
52
52
|
}
|
|
@@ -89,7 +89,7 @@ XState machines and out of views:
|
|
|
89
89
|
| `ci-solution/subpath-imports` | The [subpath direction](package-shape.md#subpath-direction). |
|
|
90
90
|
| `ci-solution/subpath-entrypoint` | An import into another subpath targets the folder or its `index` file. |
|
|
91
91
|
| `ci-solution/subpath-index` | Every subpath folder under `src/` has an `index.ts` or `index.tsx`. |
|
|
92
|
-
| `ci-solution/effect-subpath` | An SDK Effect API comes from `<sdk>/effect`;
|
|
92
|
+
| `ci-solution/effect-subpath` | An SDK Effect API comes from `<sdk>/effect`; removed SDK paths are errors. |
|
|
93
93
|
| `ci-solution/no-run-in-view` | A view module (`.tsx`, `.jsx`, `views/`) calls no `fetch` and runs no Effect. |
|
|
94
94
|
| `ci-solution/effect-actors` | XState side-effect actors are `fromEffect`, not `fromPromise` or `fromCallback`. |
|
|
95
95
|
|