oxlint-plugin-arch 0.13.0 → 0.13.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 +71 -0
- package/README.md +7 -7
- package/dist/index.js +2154 -504
- package/dist/preset/groups/top.d.ts +2 -0
- package/dist/preset/preset-sets.d.ts +2 -0
- package/dist/preset/preset.constants.d.ts +4 -1
- package/dist/preset/preset.js +299 -57
- package/dist/preset/preset.utils.d.ts +2 -0
- package/dist/rules/code/code-inside.d.ts +1 -0
- package/dist/rules/effect/effect-layer-keys.d.ts +1 -0
- package/dist/rules/effect/effect-service-params.d.ts +1 -0
- package/dist/rules/effect/effect-yield-name.d.ts +1 -0
- package/dist/rules/effect/effect-yields-first.d.ts +1 -0
- package/dist/rules/files/files-siblings.d.ts +1 -0
- package/dist/rules/files/files-top-level.d.ts +1 -0
- package/dist/rules/layout/layout-type-arguments.d.ts +1 -0
- package/dist/rules/naming/naming-imports.d.ts +1 -0
- package/dist/rules/naming/naming-keys.d.ts +1 -0
- package/dist/rules/naming/naming-labels.d.ts +1 -0
- package/dist/rules/naming/naming-pairs.d.ts +1 -0
- package/dist/types/boundaries.types.d.ts +33 -1
- package/dist/types/code.types.d.ts +12 -0
- package/dist/types/comments.types.d.ts +1 -0
- package/dist/types/dillon-anti-slop.types.d.ts +6 -0
- package/dist/types/effect.types.d.ts +21 -0
- package/dist/types/files.types.d.ts +33 -3
- package/dist/types/layout.types.d.ts +16 -0
- package/dist/types/naming.types.d.ts +74 -2
- package/dist/types/preset.types.d.ts +26 -0
- package/dist/types/react.types.d.ts +13 -0
- package/dist/types/types.types.d.ts +4 -0
- package/dist/utils/ast.utils.d.ts +1 -2
- package/dist/utils/boundaries.utils.d.ts +72 -4
- package/dist/utils/naming.utils.d.ts +4 -1
- package/dist/utils/options.utils.d.ts +2 -0
- package/dist/vendor/dillon-anti-slop/index.js +40 -15
- package/package.json +1 -1
- package/src/vendor/dillon-anti-slop/UPSTREAM.md +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.13.2
|
|
4
|
+
|
|
5
|
+
Preset defaults that change what an app reports:
|
|
6
|
+
|
|
7
|
+
- Effect contract packages also accept `<d>.service.ts`, which holds no functions (`files-no-functions`), next to `<d>.layer.types.ts`.
|
|
8
|
+
- Effect servers and contract packages are locked by default (`effect.strict`, on): the top level of each file kind, yielded service names, dependencies yielded first, layer keys against function names and against the service class, rpc and mail file and export names, workflow, constant, config and prompt names, the service key, error tags and codes, and tests that hold only test calls. `effect: { strict: false }` on the app or package turns the lock off; `docs/groups/effect.md` lists every key.
|
|
9
|
+
- Effect servers, locked: a layer binds no inline function, under `*.of` as well as `*.bind`; the span inside `X.toLayer(Effect.fn('…'))` follows `X`; an rpc handler returns the call its key path names (`naming-keys` `delegate`).
|
|
10
|
+
- Effect contract packages, locked: a contract file has `<d>.service.ts` beside it (`files-siblings`), calls no `Schema.Struct`, and a service method takes a `<D>…Params` type (`effect-service-params`).
|
|
11
|
+
- Effect servers: in `*.actions.ts` and `*.queries.ts` an `Effect.fn` span follows its function's name (`orderActionScheduleCancel` is `'order.schedule.cancel'`), and in `*.workflows.ts` a `Workflow.make` name is its constant without `Workflow` (`naming-labels`).
|
|
12
|
+
|
|
13
|
+
Rules and options:
|
|
14
|
+
|
|
15
|
+
- New `files-top-level`: `allow` lists what may sit at the top level of a file, `deny` what may not, by kind (`type`, `interface`, `enum`, `class`, `const`, `let`, `function`, `function-const`, `call` and the rest), name, and what builds a constant (`from: '^Schema\\.'`).
|
|
16
|
+
- New `naming-imports`: an import takes the name its specifier expands to, such as `@scope/kit-{package}` as `{Package}Kit`, as a namespace import by default.
|
|
17
|
+
- New `naming-labels`: the text label of a call (a span, a workflow name, a service key, an error tag or code) follows the name the call is assigned to, or a pattern.
|
|
18
|
+
- New `naming-keys`: a value bound under an object key is named after the key path, such as `schedule.cancel` and `orderActionScheduleCancel`.
|
|
19
|
+
- New `naming-pairs`: two calls of one chain take values that share a name, such as a procedure's input and output Schemas.
|
|
20
|
+
- New `files-siblings`: a file needs other files beside it, such as a contract next to its service.
|
|
21
|
+
- `naming-keys` also reads exported objects (`exports`) and takes `keys` (a pattern for the keys themselves), `inline: false`, `delegate` (a handler returns the call its key path names), `allow`, `singularize` and the `{Key}` placeholder; `name` is now optional.
|
|
22
|
+
- `naming-labels` takes `within`: a label passed into a call is named after that call's receiver (`X.toLayer(Effect.fn('…'))`).
|
|
23
|
+
- New `effect-service-params`: a method of a service class takes a named params type, `<Folder>…Params` by default, with `name`, `allow` and `declaration`.
|
|
24
|
+
- `effect-schema-first` takes `allow`: exported values that are not Schemas, such as a filter, need no derived type.
|
|
25
|
+
- New `effect-layer-keys`: a layer binds exactly the methods its service class declares in another file.
|
|
26
|
+
- New `effect-yields-first`: service yields come before any other statement of a generator.
|
|
27
|
+
- New `code-inside`: a call banned inside another call's callback, such as a workflow started inside a transaction.
|
|
28
|
+
- `naming-file` takes `template`, a path the file must fit; a placeholder written twice must hold the same text (`{group}/rpc.{group}.{area}.ts`).
|
|
29
|
+
- New `effect-yield-name`: a `const` holding a yielded service is named after it (`const orders = yield* Orders.Orders`), with `names` and `allow`.
|
|
30
|
+
- The `top` group takes `stem`, `singularize`, `roles`, `separators`, `file` and `placeholder`; a `files-top-level` report says what each allowed entry requires.
|
|
31
|
+
- New `top` group: `top: ['describe', 'it', 'it.each']` on a folder or file key runs `files-top-level`; `import` is always allowed. On by default and empty.
|
|
32
|
+
- Preset `sets`: name a list or a map once and write `{name}` in any key or list, or `each: 'name'` on a list entry, instead of constants and helpers above the config.
|
|
33
|
+
- `deny.only` and `boundaries-deny` `only`: imports and calls used in the listed places only, each side one value or a list.
|
|
34
|
+
- `naming.imports` in the preset: specifier template to import name.
|
|
35
|
+
- `effect.files` adds or removes (`!`) contract file kinds, such as `*.policy.ts`.
|
|
36
|
+
- `naming-exports`, `naming-declarations` and `files-exports` read `{folder}`, `{parent}`, `{stem}` and `{file}` from the path in patterns and names; an uppercase placeholder is constant case.
|
|
37
|
+
- `naming-exports` and `naming-declarations` take `prefix`, the places a prefix may come from (`file`, `folder`, `parent`); `naming-exports` `template` takes several `export` names and a `file` with folders.
|
|
38
|
+
- `naming-declarations` takes several option objects, one check per kind.
|
|
39
|
+
- `files-exports` takes `file`, a path template whose placeholders `names` and `patterns` use.
|
|
40
|
+
- `naming-exports` `template` with a `file` that has no placeholder now checks that file; before, it was skipped.
|
|
41
|
+
- New page: [What a file may contain](docs/files.md).
|
|
42
|
+
|
|
43
|
+
## 0.13.1
|
|
44
|
+
|
|
45
|
+
Preset defaults that change what an app reports:
|
|
46
|
+
|
|
47
|
+
- `effect` group: `layout-call-arguments` adds `pipe: { min: 2 }`; `layout-call-depth` counts through callbacks; `layout-object` adds `params`, `nested`, `siblings` and `inner: 2`; `layout-ternary` splits a one-line ternary over 100 columns (was `fit: false`); `layout-type-arguments` is on with `min: 3`.
|
|
48
|
+
- Effect servers: `comments-code` keeps one-line step comments (`steps: true`); `effect-layer-file` names local layers `<Role>Layer` (`suffix: 'Layer'`). An app that keeps `layer<Role>` writes `'apps/server/src/domains/*/*.layer.ts': { rules: { 'arch/effect-layer-file': 'error' } }`.
|
|
49
|
+
- `sql` group: `layout-chain` breaks Kysely chains of 3+ calls.
|
|
50
|
+
- Effect servers and contract packages ban `ai` and `@ai-sdk/**` ("Use effect/ai.").
|
|
51
|
+
|
|
52
|
+
Rules and options:
|
|
53
|
+
|
|
54
|
+
- Preset: when several file keys match one file, their settings merge on it, broadest key first; before, the later key's group or `rules` replaced the earlier one's, so a broad key could undo a convention's exception.
|
|
55
|
+
- `boundaries-*`: the `@/`, `#/` and `#services/` prefixes resolve `..` segments, so `#services/chat/../service` reaches the registry check.
|
|
56
|
+
- `react-memo` also reports `R['memo']` and a `{ default as R }` import.
|
|
57
|
+
- Vendored `require-safety-comment-for-type-assertion` matches a `comment` that starts with a non-ASCII letter.
|
|
58
|
+
- `effect-layer-file` takes `suffix`, such as `'Layer'`, to name local layers `<Role>Layer`; it also recognises those names as Layers.
|
|
59
|
+
- `comments-code` takes `steps`: a single `//` line directly above a statement in a function, or above a property in an object literal, stays.
|
|
60
|
+
- `layout-object` takes `params`, which splits a one-line destructured parameter with `min` properties, and `nested`, which splits a one-line object holding an object or function.
|
|
61
|
+
- `layout-call-arguments` takes `pipe: { min }`, which splits a one-line pipe with `min` steps even while `split` is off.
|
|
62
|
+
- `layout-pipe` takes `methods`, and `layout-call-arguments` `pipe.methods`, for pipe methods other than `pipe`.
|
|
63
|
+
- `naming-types` takes `pattern`; `types-local-alias` takes `allow`.
|
|
64
|
+
- `react-dynamic-classes` takes `attributes`; `react-empty-effect` takes `hooks`; `react-memo` takes `names`, `sources` and `message`.
|
|
65
|
+
- Vendored `no-shape-in-symbol-names` takes `terms`; `require-safety-comment-for-type-assertion` takes `comment`.
|
|
66
|
+
- `boundaries-imports`, `boundaries-next` and `boundaries-tanstack` take `conventions` for every file and folder name they read; `boundaries-imports` `portable` also takes a folder name, and `boundaries-tanstack` takes `serverHooks`. The `#services/` prefix follows the services folder.
|
|
67
|
+
- New `layout-type-arguments`: a one-line type argument list holding a union of `min` types puts each type on its own line, each after a leading `|`.
|
|
68
|
+
- `layout-object` `nested` reports without a fix inside a ternary or before a chained call; new `inner` splits an object with `inner` or more entries inside a split object, at every depth; new `siblings` splits an object argument to match a split sibling call in the same array.
|
|
69
|
+
- With `layout-call-arguments` `pipe` set, `join` leaves every pipe as written.
|
|
70
|
+
- `layout-call-arguments` `hug` also reports a call whose argument drops to the next line while `)` stays on it, and splits it fully.
|
|
71
|
+
- `code-inline` no longer asks to inline a top-level value when the result would pass `max` columns or `nesting`.
|
|
72
|
+
- `layout-call-depth` takes `callbacks`, which counts nesting through inline callbacks; `code-inline` takes the same `callbacks`, and the `effect` group sets both.
|
|
73
|
+
|
|
3
74
|
## 0.13.0
|
|
4
75
|
|
|
5
76
|
### Migrating from 0.12
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ export default preset({
|
|
|
42
42
|
})
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
The preset detects each workspace from its `package.json` (TanStack, Next, Expo, backend, UI kit, library) along with its stylesheet, service registry and migrations. List only the folders you want to change. Detection, inheritance, groups, recipes and templates: [docs/folders.md](docs/folders.md). Rules without the preset: [docs/plugin-only.md](docs/plugin-only.md).
|
|
45
|
+
The preset detects each workspace from its `package.json` (TanStack, Next, Expo, backend, UI kit, library) along with its stylesheet, service registry and migrations. List only the folders you want to change. Detection, inheritance, groups, recipes and templates: [docs/folders.md](docs/folders.md). Locking down what one kind of file may contain: [docs/files.md](docs/files.md). Rules without the preset: [docs/plugin-only.md](docs/plugin-only.md).
|
|
46
46
|
|
|
47
47
|
**3. Lint**
|
|
48
48
|
|
|
@@ -53,22 +53,22 @@ bunx oxlint
|
|
|
53
53
|
## 📚 Groups and rules
|
|
54
54
|
|
|
55
55
|
<!-- generated:start -->
|
|
56
|
-
On by default: [`layout`](docs/groups/layout.md), [`limits`](docs/groups/limits.md), [`style`](docs/groups/style.md), [`basics`](docs/groups/basics.md), [`naming`](docs/groups/naming.md), [`comments`](docs/groups/comments.md), [`types`](docs/groups/types.md), [`imports`](docs/groups/imports.md), [`tests`](docs/groups/tests.md), [`deny`](docs/groups/deny.md), [`externals`](docs/groups/externals.md).
|
|
56
|
+
On by default: [`layout`](docs/groups/layout.md), [`limits`](docs/groups/limits.md), [`style`](docs/groups/style.md), [`basics`](docs/groups/basics.md), [`naming`](docs/groups/naming.md), [`comments`](docs/groups/comments.md), [`types`](docs/groups/types.md), [`imports`](docs/groups/imports.md), [`tests`](docs/groups/tests.md), [`deny`](docs/groups/deny.md), [`top`](docs/groups/top.md), [`externals`](docs/groups/externals.md).
|
|
57
57
|
|
|
58
58
|
Opt-in: [`react`](docs/groups/react.md), [`tanstack`](docs/groups/tanstack.md), [`next`](docs/groups/next.md), [`expo`](docs/groups/expo.md), [`tailwind`](docs/groups/tailwind.md), [`shadcn`](docs/groups/shadcn.md), [`kit`](docs/groups/kit.md), [`backend`](docs/groups/backend.md), [`orpc`](docs/groups/orpc.md), [`schemas`](docs/groups/schemas.md), [`forms`](docs/groups/forms.md), [`sql`](docs/groups/sql.md), [`effect`](docs/groups/effect.md), [`console`](docs/groups/console.md).
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
95 rules, IDs `arch/<rule>`. 🔧 = autofix.
|
|
61
61
|
|
|
62
62
|
| Family | Covers | Rules |
|
|
63
63
|
| --- | --- | --- |
|
|
64
64
|
| `backend` | Service and RPC structure | [`backend-orpc-output`](docs/rules/backend-orpc-output.md), [`backend-registry`](docs/rules/backend-registry.md), [`backend-service-functions`](docs/rules/backend-service-functions.md), [`backend-sql-like`](docs/rules/backend-sql-like.md) |
|
|
65
65
|
| `boundaries` | Import and runtime boundaries | [`boundaries-deny`](docs/rules/boundaries-deny.md), [`boundaries-imports`](docs/rules/boundaries-imports.md), [`boundaries-next`](docs/rules/boundaries-next.md), [`boundaries-rpc-database`](docs/rules/boundaries-rpc-database.md), [`boundaries-tanstack`](docs/rules/boundaries-tanstack.md), [`boundaries-token-owner`](docs/rules/boundaries-token-owner.md) |
|
|
66
|
-
| `code` | Code shapes to avoid | [`code-branch-once`](docs/rules/code-branch-once.md), [`code-constructor`](docs/rules/code-constructor.md), [`code-delegate`](docs/rules/code-delegate.md), [`code-double-negation`](docs/rules/code-double-negation.md), [`code-function-nesting`](docs/rules/code-function-nesting.md), [`code-inline`](docs/rules/code-inline.md), [`code-justified-call`](docs/rules/code-justified-call.md), [`code-literal-in`](docs/rules/code-literal-in.md), [`code-mutable-state`](docs/rules/code-mutable-state.md), [`code-object-params`](docs/rules/code-object-params.md), [`code-paired-call`](docs/rules/code-paired-call.md), [`code-promise-mutation`](docs/rules/code-promise-mutation.md), [`code-switch`](docs/rules/code-switch.md), [`code-traced`](docs/rules/code-traced.md), [`code-trivial-functions`](docs/rules/code-trivial-functions.md), [`code-yield-argument`](docs/rules/code-yield-argument.md) |
|
|
66
|
+
| `code` | Code shapes to avoid | [`code-branch-once`](docs/rules/code-branch-once.md), [`code-constructor`](docs/rules/code-constructor.md), [`code-delegate`](docs/rules/code-delegate.md), [`code-double-negation`](docs/rules/code-double-negation.md), [`code-function-nesting`](docs/rules/code-function-nesting.md), [`code-inline`](docs/rules/code-inline.md), [`code-inside`](docs/rules/code-inside.md), [`code-justified-call`](docs/rules/code-justified-call.md), [`code-literal-in`](docs/rules/code-literal-in.md), [`code-mutable-state`](docs/rules/code-mutable-state.md), [`code-object-params`](docs/rules/code-object-params.md), [`code-paired-call`](docs/rules/code-paired-call.md), [`code-promise-mutation`](docs/rules/code-promise-mutation.md), [`code-switch`](docs/rules/code-switch.md), [`code-traced`](docs/rules/code-traced.md), [`code-trivial-functions`](docs/rules/code-trivial-functions.md), [`code-yield-argument`](docs/rules/code-yield-argument.md) |
|
|
67
67
|
| `comments` | Comments and directives | [`comments-code`](docs/rules/comments-code.md) 🔧, [`comments-directives`](docs/rules/comments-directives.md) |
|
|
68
68
|
| `copy` | User-facing text | [`copy-dashes`](docs/rules/copy-dashes.md) |
|
|
69
|
-
| `files` | What a file may contain or export | [`files-components-only`](docs/rules/files-components-only.md), [`files-constants-only`](docs/rules/files-constants-only.md), [`files-domain-constants`](docs/rules/files-domain-constants.md), [`files-exports`](docs/rules/files-exports.md), [`files-externals`](docs/rules/files-externals.md), [`files-factory-keys`](docs/rules/files-factory-keys.md), [`files-helpers`](docs/rules/files-helpers.md), [`files-no-functions`](docs/rules/files-no-functions.md), [`files-restricted`](docs/rules/files-restricted.md), [`files-route`](docs/rules/files-route.md), [`files-types-only`](docs/rules/files-types-only.md) |
|
|
70
|
-
| `layout` | Layout a formatter leaves alone | [`layout-arrow-body`](docs/rules/layout-arrow-body.md) 🔧, [`layout-call-arguments`](docs/rules/layout-call-arguments.md) 🔧, [`layout-call-array`](docs/rules/layout-call-array.md) 🔧, [`layout-call-depth`](docs/rules/layout-call-depth.md), [`layout-chain`](docs/rules/layout-chain.md) 🔧, [`layout-items`](docs/rules/layout-items.md) 🔧, [`layout-jsx-attributes`](docs/rules/layout-jsx-attributes.md) 🔧, [`layout-key-value`](docs/rules/layout-key-value.md) 🔧, [`layout-object`](docs/rules/layout-object.md) 🔧, [`layout-padding`](docs/rules/layout-padding.md) 🔧, [`layout-pipe`](docs/rules/layout-pipe.md), [`layout-ternary`](docs/rules/layout-ternary.md) 🔧 |
|
|
71
|
-
| `naming` | File, folder and export names | [`naming-declarations`](docs/rules/naming-declarations.md), [`naming-exports`](docs/rules/naming-exports.md), [`naming-file`](docs/rules/naming-file.md), [`naming-folder`](docs/rules/naming-folder.md), [`naming-types`](docs/rules/naming-types.md) |
|
|
69
|
+
| `files` | What a file may contain or export | [`files-components-only`](docs/rules/files-components-only.md), [`files-constants-only`](docs/rules/files-constants-only.md), [`files-domain-constants`](docs/rules/files-domain-constants.md), [`files-exports`](docs/rules/files-exports.md), [`files-externals`](docs/rules/files-externals.md), [`files-factory-keys`](docs/rules/files-factory-keys.md), [`files-helpers`](docs/rules/files-helpers.md), [`files-no-functions`](docs/rules/files-no-functions.md), [`files-restricted`](docs/rules/files-restricted.md), [`files-route`](docs/rules/files-route.md), [`files-siblings`](docs/rules/files-siblings.md), [`files-top-level`](docs/rules/files-top-level.md), [`files-types-only`](docs/rules/files-types-only.md) |
|
|
70
|
+
| `layout` | Layout a formatter leaves alone | [`layout-arrow-body`](docs/rules/layout-arrow-body.md) 🔧, [`layout-call-arguments`](docs/rules/layout-call-arguments.md) 🔧, [`layout-call-array`](docs/rules/layout-call-array.md) 🔧, [`layout-call-depth`](docs/rules/layout-call-depth.md), [`layout-chain`](docs/rules/layout-chain.md) 🔧, [`layout-items`](docs/rules/layout-items.md) 🔧, [`layout-jsx-attributes`](docs/rules/layout-jsx-attributes.md) 🔧, [`layout-key-value`](docs/rules/layout-key-value.md) 🔧, [`layout-object`](docs/rules/layout-object.md) 🔧, [`layout-padding`](docs/rules/layout-padding.md) 🔧, [`layout-pipe`](docs/rules/layout-pipe.md), [`layout-ternary`](docs/rules/layout-ternary.md) 🔧, [`layout-type-arguments`](docs/rules/layout-type-arguments.md) 🔧 |
|
|
71
|
+
| `naming` | File, folder and export names | [`naming-declarations`](docs/rules/naming-declarations.md), [`naming-exports`](docs/rules/naming-exports.md), [`naming-file`](docs/rules/naming-file.md), [`naming-folder`](docs/rules/naming-folder.md), [`naming-imports`](docs/rules/naming-imports.md), [`naming-keys`](docs/rules/naming-keys.md), [`naming-labels`](docs/rules/naming-labels.md), [`naming-pairs`](docs/rules/naming-pairs.md), [`naming-types`](docs/rules/naming-types.md) |
|
|
72
72
|
| `react` | Components, effects, class names | [`react-dynamic-classes`](docs/rules/react-dynamic-classes.md), [`react-empty-effect`](docs/rules/react-empty-effect.md), [`react-memo`](docs/rules/react-memo.md), [`react-props`](docs/rules/react-props.md), [`react-query-props`](docs/rules/react-query-props.md) |
|
|
73
73
|
| `schemas` | Schema placement | [`schemas-inline`](docs/rules/schemas-inline.md), [`schemas-local`](docs/rules/schemas-local.md), [`schemas-rederive`](docs/rules/schemas-rederive.md), [`schemas-single-use`](docs/rules/schemas-single-use.md) |
|
|
74
74
|
| `tests` | Test structure | [`tests-assertions`](docs/rules/tests-assertions.md), [`tests-concurrent-db`](docs/rules/tests-concurrent-db.md), [`tests-modifiers`](docs/rules/tests-modifiers.md), [`tests-titles`](docs/rules/tests-titles.md) |
|