adamantite 0.46.0 → 0.47.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/README.md +82 -8
- package/dist/index.js +56 -66
- package/dist/presets/lint/core.js +1 -1
- package/dist/presets/lint/vendor/antislop/plugin.mjs +19 -2
- package/dist/presets/typescript/resets/array-includes.d.ts +15 -0
- package/dist/presets/typescript/resets/array-index-of.d.ts +23 -0
- package/dist/presets/typescript/resets/eval.d.ts +1 -0
- package/dist/presets/typescript/resets/fetch.d.ts +3 -0
- package/dist/presets/typescript/resets/filter-boolean.d.ts +24 -0
- package/dist/presets/typescript/resets/helpers.d.ts +15 -0
- package/dist/presets/typescript/resets/index.d.ts +20 -0
- package/dist/presets/typescript/resets/is-array.d.ts +3 -0
- package/dist/presets/typescript/resets/json-parse.d.ts +14 -0
- package/dist/presets/typescript/resets/license.md +12 -0
- package/dist/presets/typescript/resets/map-constructor.d.ts +3 -0
- package/dist/presets/typescript/resets/map-groupby.d.ts +3 -0
- package/dist/presets/typescript/resets/map-has.d.ts +9 -0
- package/dist/presets/typescript/resets/object-assign.d.ts +8 -0
- package/dist/presets/typescript/resets/object-get-prototype-of.d.ts +3 -0
- package/dist/presets/typescript/resets/object-groupby.d.ts +6 -0
- package/dist/presets/typescript/resets/object-values.d.ts +8 -0
- package/dist/presets/typescript/resets/reflect.d.ts +12 -0
- package/dist/presets/typescript/resets/set-has.d.ts +9 -0
- package/dist/presets/typescript/resets/storage.d.ts +3 -0
- package/dist/presets/typescript.json +13 -0
- package/package.json +3 -2
- package/skills/adamantite/SKILL.md +0 -2
- package/skills/adamantite/references/lint-rules.md +0 -6
- package/skills/adamantite/references/setup.md +8 -2
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ adamantite analyze
|
|
|
72
72
|
## Non-interactive setup
|
|
73
73
|
|
|
74
74
|
Use `--non-interactive` to configure a project entirely from flags. Specify at least one
|
|
75
|
-
`--script`. Repeat `--script`, `--preset`, and `--editor` to select multiple values.
|
|
75
|
+
`--script` or `--typescript`. Repeat `--script`, `--preset`, and `--editor` to select multiple values.
|
|
76
76
|
|
|
77
77
|
```sh
|
|
78
78
|
npx adamantite init \
|
|
@@ -82,7 +82,7 @@ npx adamantite init \
|
|
|
82
82
|
--script analyze \
|
|
83
83
|
--preset react \
|
|
84
84
|
--editor vscode \
|
|
85
|
-
--typescript \
|
|
85
|
+
--typescript typescript \
|
|
86
86
|
--install-extensions \
|
|
87
87
|
--github-actions \
|
|
88
88
|
--agents
|
|
@@ -95,12 +95,17 @@ Available setup values:
|
|
|
95
95
|
- Presets: `react`, `react-strict`, `tanstack`, `nextjs`, `vue`, `effect`,
|
|
96
96
|
`jest`, `vitest`, `node`, `architecture`, `strict`, and `tailwind`. `react-strict` requires `react`.
|
|
97
97
|
- Editors: `vscode` and `zed`.
|
|
98
|
+
- TypeScript presets: `typescript` and `tsconfig`. See [the TypeScript presets](#the-typescript-presets).
|
|
98
99
|
|
|
99
|
-
Presets
|
|
100
|
+
Presets require the `check` or `fix` script. Editor extension installation
|
|
100
101
|
requires an editor. GitHub Actions requires a compatible script and a supported package
|
|
101
102
|
manager. Omitted boolean flags are disabled.
|
|
102
103
|
|
|
103
104
|
The GitHub Actions workflow runs the `check` and `analyze` scripts that you select.
|
|
105
|
+
Its job sits between `# ADAMANTITE:START` and `# ADAMANTITE:END` comments. Adamantite owns
|
|
106
|
+
the jobs between these comments, and you own the rest of the workflow. You can rename the
|
|
107
|
+
file in `.github/workflows` and add your own jobs outside the comments. Doctor checks only the
|
|
108
|
+
jobs between the comments, and init updates them when you did not change them.
|
|
104
109
|
Agents verify custom rules with temporary cases while they work. CI runs the rules through
|
|
105
110
|
`check` by default. Users can add an explicit `adamantite rule test` step for optional saved tests.
|
|
106
111
|
Init preserves a workflow with an explicit rule-test command, including its setup and other settings.
|
|
@@ -113,8 +118,8 @@ forward them to the Adamantite command after `--`, e.g.
|
|
|
113
118
|
|
|
114
119
|
In a detected monorepo, TypeScript setup does not write a root `tsconfig.json`, because a
|
|
115
120
|
catch-all root config makes TypeScript treat all packages as one project. Adamantite
|
|
116
|
-
prints guidance instead: add `"extends": "adamantite/typescript"
|
|
117
|
-
`tsconfig.json` or to a shared base config.
|
|
121
|
+
prints guidance instead: add `"extends": "adamantite/typescript"`, or `"extends": "adamantite/tsconfig"`
|
|
122
|
+
in a library, to each package's `tsconfig.json` or to a shared base config.
|
|
118
123
|
|
|
119
124
|
## Commands
|
|
120
125
|
|
|
@@ -367,7 +372,8 @@ the imports in this table, and Node.js rejects any other path in the package:
|
|
|
367
372
|
| `adamantite/rules/testing` | `RuleTester` and its types for temporary agent verification and optional saved tests. |
|
|
368
373
|
| `adamantite/format` | Oxfmt configuration. |
|
|
369
374
|
| `adamantite/analyze` | Knip configuration. The `ignoreDependencies` named export groups suggested ignore lists; `init` sets `ignoreDependencies.monorepo` in a monorepo and `ignoreDependencies.effect` with the effect preset. |
|
|
370
|
-
| `adamantite/typescript` | Strict TypeScript configuration for TS 7
|
|
375
|
+
| `adamantite/typescript` | Strict TypeScript configuration for TS 7+, with [ts-reset](https://github.com/total-typescript/ts-reset) types: `JSON.parse()` and `response.json()` return `unknown`. Allows only erasable syntax. Not for libraries. See [the TypeScript presets](#the-typescript-presets). |
|
|
376
|
+
| `adamantite/tsconfig` | The strict options of `adamantite/typescript` without the ts-reset types, for libraries. See [the TypeScript presets](#the-typescript-presets). |
|
|
371
377
|
|
|
372
378
|
When consuming the lint presets directly, hoist the core preset's ignore patterns onto the
|
|
373
379
|
root config. Oxlint does not merge `ignorePatterns` from extended configs, so without the
|
|
@@ -386,6 +392,44 @@ export default defineConfig({
|
|
|
386
392
|
|
|
387
393
|
Configs generated by `adamantite init` include this automatically.
|
|
388
394
|
|
|
395
|
+
### The TypeScript presets
|
|
396
|
+
|
|
397
|
+
`adamantite/tsconfig` sets strict compiler options for TypeScript 7 and later. It allows only
|
|
398
|
+
erasable syntax, so `enum`, a `namespace` with values, and parameter properties fail type checking.
|
|
399
|
+
|
|
400
|
+
`adamantite/typescript` adds type resets to the same options, so built-in APIs return safer
|
|
401
|
+
types. For example, `JSON.parse()`, `response.json()`, and property reads on `localStorage` return
|
|
402
|
+
`unknown` instead of `any`, and `includes()` on a literal array accepts a wider value. The project
|
|
403
|
+
needs no `reset.d.ts` file and no dependency, because the preset loads the resets from the
|
|
404
|
+
Adamantite package. The resets started from
|
|
405
|
+
[ts-reset](https://github.com/total-typescript/ts-reset) by Matt Pocock. See [credits](#credits).
|
|
406
|
+
|
|
407
|
+
The resets also cover built-in APIs that ts-reset leaves as `any`. `Object.values()` and
|
|
408
|
+
`Object.entries()` on a type without an index signature, `Object.assign()` with more than three
|
|
409
|
+
sources, `Object.getPrototypeOf()`, `Reflect.apply()`, `Reflect.construct()`, `eval()`, and the
|
|
410
|
+
values of a `JSON.parse()` reviver return or take `unknown`. TypeScript cannot change a property type or a
|
|
411
|
+
default type parameter by declaration merging, so `PromiseRejectedResult.reason` and
|
|
412
|
+
`MessageEvent` data stay `any`.
|
|
413
|
+
|
|
414
|
+
```json
|
|
415
|
+
{ "extends": "adamantite/typescript" }
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Use `adamantite/tsconfig` in a library that publishes declaration files. A declaration file that
|
|
419
|
+
TypeScript emits with the type resets can name the global `AdamantiteTypeScript` helper types,
|
|
420
|
+
which a consumer without the resets does not have. Doctor reports a package whose
|
|
421
|
+
`tsconfig.json` loads the type resets, directly or through a base config, when the package is not
|
|
422
|
+
private and declares `exports` or `types`. Doctor asks the project's TypeScript with
|
|
423
|
+
`tsc --showConfig`.
|
|
424
|
+
|
|
425
|
+
The preset adds the type resets through `files`, and includes every file below your
|
|
426
|
+
`tsconfig.json` through `include`. List your files in `include`, which keeps the resets. A `files`
|
|
427
|
+
list in your `tsconfig.json` replaces the preset's list, so it drops the resets, and the config
|
|
428
|
+
still inherits the preset's `include`. A config that must check only its `files`, such as a
|
|
429
|
+
solution config with `"files": []` and `references`, sets `"include": []` too, or extends
|
|
430
|
+
`adamantite/tsconfig`. To use the strict options without the type resets, extend
|
|
431
|
+
`adamantite/tsconfig`.
|
|
432
|
+
|
|
389
433
|
### The jest and vitest presets
|
|
390
434
|
|
|
391
435
|
The `jest` and `vitest` presets apply their rules only to test files, so rules such as
|
|
@@ -669,8 +713,7 @@ options for your project. The preset enables neither rule by default.
|
|
|
669
713
|
|
|
670
714
|
Each layer's `imports` list names siblings, and permissions are transitive. Put a child map
|
|
671
715
|
in that layer's `layers` property. Its root derives from the containing folder, and its
|
|
672
|
-
settings remain local. Every containing map checks the file independently.
|
|
673
|
-
array-valued declarations, run `adamantite doctor` and follow its migration instructions.
|
|
716
|
+
settings remain local. Every containing map checks the file independently.
|
|
674
717
|
|
|
675
718
|
You can also select it during setup with
|
|
676
719
|
`adamantite init --non-interactive --script check --preset architecture`.
|
|
@@ -966,6 +1009,37 @@ set `skills.dirs`.
|
|
|
966
1009
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for the repository workflow. Contributors should
|
|
967
1010
|
also read the [domain glossary](GLOSSARY.md) and [architecture reference](docs/architecture.md).
|
|
968
1011
|
|
|
1012
|
+
## Credits
|
|
1013
|
+
|
|
1014
|
+
Adamantite builds on the work of these people and projects.
|
|
1015
|
+
|
|
1016
|
+
Adamantite ships code from these projects, each with its MIT license:
|
|
1017
|
+
|
|
1018
|
+
- [ts-reset](https://github.com/total-typescript/ts-reset) by
|
|
1019
|
+
[Matt Pocock](https://github.com/mattpocock) of
|
|
1020
|
+
[Total TypeScript](https://www.totaltypescript.com/ts-reset). The type resets of
|
|
1021
|
+
`adamantite/typescript` and their tests started from it.
|
|
1022
|
+
- [anti-slop](https://github.com/dmmulroy/anti-slop) by
|
|
1023
|
+
[Dillon Mulroy](https://github.com/dmmulroy), in `adamantite/lint/strict` and
|
|
1024
|
+
`adamantite/lint/effect`.
|
|
1025
|
+
|
|
1026
|
+
Adamantite configures and runs these tools:
|
|
1027
|
+
|
|
1028
|
+
- [Oxlint, Oxfmt, and tsrs](https://github.com/oxc-project) by
|
|
1029
|
+
[Boshen](https://github.com/Boshen) and the Oxc contributors.
|
|
1030
|
+
- [Knip](https://github.com/webpro-nl/knip) by [Lars Kappert](https://github.com/webpro).
|
|
1031
|
+
- [Sherif](https://github.com/QuiiBz/sherif) by [Tom Lienard](https://github.com/QuiiBz).
|
|
1032
|
+
- [@effect/tsgo](https://github.com/Effect-TS/tsgo) by
|
|
1033
|
+
[Mattia Manzati](https://github.com/mattiamanzati) and the
|
|
1034
|
+
[Effect](https://github.com/Effect-TS) team.
|
|
1035
|
+
- [React Doctor](https://github.com/millionco/react-doctor) by
|
|
1036
|
+
[Aiden Bai](https://github.com/aidenybai) of [Million](https://github.com/millionco).
|
|
1037
|
+
- [@shadcn/lint](https://github.com/shadcn-ui/lint) by [shadcn](https://github.com/shadcn).
|
|
1038
|
+
- [TypeScript](https://github.com/microsoft/TypeScript) by Microsoft.
|
|
1039
|
+
|
|
1040
|
+
The terminal interface uses [Clack](https://github.com/bombshell-dev/clack) by
|
|
1041
|
+
[Nate Moore](https://github.com/natemoo-re).
|
|
1042
|
+
|
|
969
1043
|
## License
|
|
970
1044
|
|
|
971
1045
|
Adamantite uses the [MIT License](LICENSE).
|