adamantite 0.45.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 +447 -127
- package/dist/index.js +628 -57
- package/dist/oxlint.js +1 -0
- package/dist/presets/analyze.js +1 -0
- package/dist/presets/lint/{react-doctor.d.ts → architecture.d.ts} +1 -1
- package/dist/presets/lint/architecture.js +8 -0
- package/dist/presets/lint/core.js +1 -2
- package/dist/presets/lint/effect.js +26 -1
- package/dist/presets/lint/plugin/glob.d.ts +7 -0
- package/dist/presets/lint/plugin/glob.js +48 -0
- package/dist/presets/lint/plugin/imports.d.ts +4 -0
- package/dist/presets/lint/plugin/imports.js +4 -1
- package/dist/presets/lint/plugin/index.d.ts +3 -0
- package/dist/presets/lint/plugin/index.js +14 -8
- package/dist/presets/lint/plugin/options.d.ts +5 -5
- package/dist/presets/lint/plugin/options.js +19 -7
- package/dist/presets/lint/plugin/resolver.d.ts +8 -0
- package/dist/presets/lint/plugin/resolver.js +79 -0
- package/dist/presets/lint/plugin/rules/import-owners.d.ts +67 -0
- package/dist/presets/lint/plugin/rules/import-owners.js +310 -0
- package/dist/presets/lint/plugin/rules/layers.d.ts +136 -0
- package/dist/presets/lint/plugin/rules/layers.js +479 -0
- package/dist/presets/lint/plugin/rules/no-query-data-in-state.js +1 -1
- package/dist/presets/lint/plugin/rules/no-react-state-hooks.d.ts +0 -5
- package/dist/presets/lint/plugin/rules/no-react-state-hooks.js +3 -47
- package/dist/presets/lint/plugin/rules/query-from-loader.js +2 -2
- package/dist/presets/lint/plugin/rules/require-suppression-reason.d.ts +5 -0
- package/dist/presets/lint/plugin/rules/require-suppression-reason.js +32 -0
- package/dist/presets/lint/react-strict.js +22 -2
- package/dist/presets/lint/strict.js +35 -2
- package/dist/presets/lint/{antislop.d.ts → tailwind.d.ts} +1 -1
- package/dist/presets/lint/{shadcn.js → tailwind.js} +1 -1
- package/dist/presets/lint/vendor/antislop/license.md +26 -1
- package/dist/presets/lint/vendor/antislop/plugin.d.mts +3 -0
- package/dist/presets/lint/vendor/antislop/plugin.mjs +959 -33
- package/dist/presets/lint/vendor/antislop-effect/license.md +27 -0
- package/dist/presets/lint/vendor/antislop-effect/plugin.d.mts +17 -0
- package/dist/presets/lint/vendor/antislop-effect/plugin.mjs +579 -0
- package/dist/presets/{lint → rules}/custom.d.ts +3 -20
- package/dist/presets/{lint → rules}/custom.js +50 -46
- package/dist/presets/rules/folder.d.ts +34 -0
- package/dist/presets/rules/folder.js +52 -0
- package/dist/presets/rules/index.d.ts +2 -9
- package/dist/presets/rules/index.js +1 -29
- package/dist/presets/rules/load.d.ts +8 -0
- package/dist/presets/rules/load.js +29 -0
- package/dist/presets/rules/plugin.d.ts +3 -0
- package/dist/presets/rules/plugin.js +1 -0
- package/dist/presets/rules/testing.d.ts +2 -0
- package/dist/presets/rules/testing.js +14 -0
- package/dist/presets/tsconfig.json +3 -0
- 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/dist/runtime-CVZPDpfE.js +11 -0
- package/package.json +81 -19
- package/skills/adamantite/SKILL.md +110 -207
- package/skills/adamantite/references/custom-rules.md +120 -0
- package/skills/adamantite/references/lint-rules.md +152 -0
- package/skills/adamantite/references/setup.md +70 -0
- package/dist/presets/lint/antislop.js +0 -28
- package/dist/presets/lint/react-doctor.js +0 -20
- package/dist/presets/lint/shadcn.d.ts +0 -5
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# How to write and verify custom rules
|
|
2
|
+
|
|
3
|
+
## Select the rules folder
|
|
4
|
+
|
|
5
|
+
Use a custom rule for a recurring project coding standard that existing rules cannot check.
|
|
6
|
+
Keep it in the target project. A first-party preset change is a different task.
|
|
7
|
+
|
|
8
|
+
Find the `custom()` call imported from `adamantite/rules` in the project's Oxlint configuration.
|
|
9
|
+
It loads `.adamantite/lint` by default, relative to the file that calls it, and enables each
|
|
10
|
+
rule as `error` under `project`. Thus `no-process-env.ts` becomes `project/no-process-env`.
|
|
11
|
+
Use `dir` for another folder. In a monorepo, give each rules folder its own plugin `name`,
|
|
12
|
+
because Oxlint rejects duplicate plugin names in one run. A nested Oxlint config replaces
|
|
13
|
+
the root config. Extend the root config when the package needs its rules.
|
|
14
|
+
|
|
15
|
+
Continue when you have identified the loaded rules folder and its plugin name.
|
|
16
|
+
|
|
17
|
+
## Repair an existing rules folder
|
|
18
|
+
|
|
19
|
+
If Doctor reports the previous API, replace `adamantite/lint/custom` with the default import
|
|
20
|
+
from `adamantite/rules`. Move authoring imports to `adamantite/rules/plugin`.
|
|
21
|
+
Move the old default folder to `.adamantite/lint`, or set its path with `dir`.
|
|
22
|
+
Preserve rule behavior, plugin names, severity, and options.
|
|
23
|
+
|
|
24
|
+
Continue when Doctor reports no custom-rule wiring findings.
|
|
25
|
+
|
|
26
|
+
## Write the rule
|
|
27
|
+
|
|
28
|
+
For a new rule, run `adamantite rule add <name>`. It writes only a stub.
|
|
29
|
+
Use `adamantite rule ast <file>` on real code to find the node types that visitors receive.
|
|
30
|
+
|
|
31
|
+
Apply these authoring constraints:
|
|
32
|
+
|
|
33
|
+
- Export the rule as default with `defineRule` from `adamantite/rules/plugin`.
|
|
34
|
+
Import `Context`, `Rule`, `Visitor`, and `ESTree` types from that module when needed.
|
|
35
|
+
- Use `createOnce`, which runs once for the lint run. Reset per-file state in `before` and
|
|
36
|
+
report collected results in `after`. Read `context.filename`, `context.sourceCode`, and
|
|
37
|
+
`context.settings` in `before` or a visitor. They are unavailable in the `createOnce` body.
|
|
38
|
+
- Write erasable TypeScript. Replace an `enum` with a plain object, for example.
|
|
39
|
+
Node.js type stripping cannot load enums, namespaces with values, parameter properties,
|
|
40
|
+
or `import x = require()`.
|
|
41
|
+
- Use the AST and `context.sourceCode`. Custom rules receive no type information.
|
|
42
|
+
- Report with a `messageId` defined in `meta.messages`. State what the author must do
|
|
43
|
+
instead and link the coding standard. Define options in `meta.schema` and read `context.options`.
|
|
44
|
+
- Keep substantial logic in plain functions in a `_<name>.ts` helper when that makes the
|
|
45
|
+
rule clearer. Files that start with `_`, declaration files, and `.test.*` files are not rules.
|
|
46
|
+
Subfolders are not loaded.
|
|
47
|
+
|
|
48
|
+
Continue when the rule implements the standard and every report gives a repair.
|
|
49
|
+
|
|
50
|
+
## Verify the rule
|
|
51
|
+
|
|
52
|
+
Use `RuleTester` from `adamantite/rules/testing` with Node.js, also in a Bun project.
|
|
53
|
+
Put code that must report in `invalid` and similar code that must pass in `valid`.
|
|
54
|
+
Cover the syntax forms and file paths to which the standard applies.
|
|
55
|
+
For a bug fix, first run a regression case and confirm that it fails. Fix the rule and rerun
|
|
56
|
+
all cases. Change a case only when it is wrong, and explain the change.
|
|
57
|
+
|
|
58
|
+
Run temporary cases from stdin or a temporary file beside the rule. For the generated
|
|
59
|
+
`no-debugger` stub, this command checks the report and an accepted TypeScript declaration:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
node --input-type=module <<'JS'
|
|
63
|
+
import { RuleTester } from "adamantite/rules/testing"
|
|
64
|
+
import rule from "./.adamantite/lint/no-debugger.ts"
|
|
65
|
+
|
|
66
|
+
new RuleTester({ languageOptions: { parserOptions: { lang: "ts" } } }).run("no-debugger", rule, {
|
|
67
|
+
invalid: [{ code: "debugger", errors: [{ messageId: "unexpected" }] }],
|
|
68
|
+
valid: ["const value: number = 1"],
|
|
69
|
+
})
|
|
70
|
+
JS
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Adapt the cases to the completed rule. Verify a helper directly only when its cases are too
|
|
74
|
+
many for RuleTester. During harden, use `adamantite rule test add <name>` to prepare temporary
|
|
75
|
+
cases, adapt them, and run `adamantite rule test --path <test-file>`.
|
|
76
|
+
If a saved test already exists, preserve it and use stdin for additional temporary cases.
|
|
77
|
+
|
|
78
|
+
Run lint and read all output. A rule that throws can print an error for every file while
|
|
79
|
+
Oxlint still exits 0. Restart the editor language server after changing a rule, because
|
|
80
|
+
Oxlint caches rules for each run.
|
|
81
|
+
|
|
82
|
+
Continue when every valid and invalid case passes and lint output contains no rule errors.
|
|
83
|
+
|
|
84
|
+
## Keep saved tests when requested
|
|
85
|
+
|
|
86
|
+
If the user requests new saved tests, run `adamantite rule test add <name>` and adapt its
|
|
87
|
+
valid and invalid cases. Use `--dir` for another rules folder or `--path` for another test location.
|
|
88
|
+
Keep `.test.ts` for tests beside rules, so the plugin does not load them as rules.
|
|
89
|
+
Run saved tests with `adamantite rule test`, or `adamantite rule test --path <file>` for a test elsewhere.
|
|
90
|
+
|
|
91
|
+
Saved tests use `node:test`. Exclude them from Vitest `test.exclude` or Jest
|
|
92
|
+
`testPathIgnorePatterns`, while keeping the runner's default and existing exclusions.
|
|
93
|
+
Init, CI generation, and harden do not run saved tests by default. Preserve existing test
|
|
94
|
+
files and CI steps. Add new CI test steps only when requested.
|
|
95
|
+
|
|
96
|
+
Continue when the saved tests pass and the project's other test runners do not collect them.
|
|
97
|
+
|
|
98
|
+
## Check project integration
|
|
99
|
+
|
|
100
|
+
If TypeScript must check the rules folder, add `.adamantite/lint` to tsconfig `include`.
|
|
101
|
+
TypeScript skips the dot folder by default. Enable `allowImportingTsExtensions` when checking
|
|
102
|
+
tests that import `.ts` rule files.
|
|
103
|
+
|
|
104
|
+
Knip treats rules and optional `.test.*` files in `.adamantite/lint` as entry files in the
|
|
105
|
+
root and workspace packages. For another folder, keep the preset's entry patterns and add
|
|
106
|
+
the folder's rule and test patterns to `oxlint.entry` in `knip.config.ts`.
|
|
107
|
+
Add tests saved elsewhere to the Knip entry settings if needed.
|
|
108
|
+
|
|
109
|
+
Remove temporary cases, fixtures, and verification-only helpers that you created.
|
|
110
|
+
Keep the rule, its runtime helpers, required configuration, and user-owned saved tests.
|
|
111
|
+
Run `adamantite check` and `adamantite doctor`.
|
|
112
|
+
|
|
113
|
+
Continue when both commands pass and no temporary verification files remain.
|
|
114
|
+
|
|
115
|
+
## Check the rule
|
|
116
|
+
|
|
117
|
+
- Every valid and invalid case passes, including the regression case for a bug fix.
|
|
118
|
+
- Lint output contains no rule errors, regardless of its exit code.
|
|
119
|
+
- Doctor reports no findings, and the project's checks pass.
|
|
120
|
+
- Temporary verification files are removed, and user-owned tests and CI steps remain.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# How to repair preset rule reports
|
|
2
|
+
|
|
3
|
+
## Repair the reported code
|
|
4
|
+
|
|
5
|
+
Read the rule message and apply the section below that matches it.
|
|
6
|
+
|
|
7
|
+
- For `adamantite/no-react-state-hooks`, follow the message's replacement for the hook.
|
|
8
|
+
Moving the call into a hook module only to silence the report leaves the problem in place.
|
|
9
|
+
Set `allow` only when the project's hook layout differs from the default.
|
|
10
|
+
- For `adamantite/no-overzealous-destructuring`, keep the object and read its members, or split
|
|
11
|
+
the pattern. Raising `maxDepth` or `maxProperties` only to pass the check hides the problem.
|
|
12
|
+
- For `adamantite/require-suppression-reason`, first try to fix the code. If a suppression is
|
|
13
|
+
necessary, state why the rule does not apply after `--`. Naming the rule or adding a single
|
|
14
|
+
`-` gives no reason. For example, use
|
|
15
|
+
`// oxlint-disable-next-line no-console -- the CLI writes its report to stdout`.
|
|
16
|
+
- For `no-warning-comments`, fix the code or track the work in the project's issue tracker.
|
|
17
|
+
Renaming `TODO` to another marker only to pass the check leaves the work untracked.
|
|
18
|
+
- For `adamantite/query-from-loader` reports on `useQuery` or `useSuspenseQuery`, replace a
|
|
19
|
+
plain options object or a local `queryOptions()` call with shared options. Define them with
|
|
20
|
+
`queryOptions()` at module scope or in an exported factory. Preload them with
|
|
21
|
+
`ensureQueryData()` in the loader and pass the same options to the hook. For reports on
|
|
22
|
+
`useInfiniteQuery` or `useSuspenseInfiniteQuery`, use `infiniteQueryOptions()` with
|
|
23
|
+
`ensureInfiniteQueryData()`. Wrapping options in a spread or moving the hook out of the route
|
|
24
|
+
only to silence the report leaves the preload problem unresolved.
|
|
25
|
+
- For `adamantite/no-query-data-in-state`, read query data from the query result and keep
|
|
26
|
+
only the user's edits in state.
|
|
27
|
+
- For `effecttsgo/unstable-api-usage`, add a deliberately accepted module or package to
|
|
28
|
+
`allowedUnstableApis` in the `@effect/language-service` tsconfig entry. For example, list
|
|
29
|
+
`"effect/cli"` to allow that module instead of disabling the rule for every unstable API.
|
|
30
|
+
|
|
31
|
+
Continue when the reported code follows the rule's repair and the affected lint check passes.
|
|
32
|
+
|
|
33
|
+
## Configure layer maps and import owners
|
|
34
|
+
|
|
35
|
+
If the task changes import rules, use the first-party plugin loaded by `architecture` or
|
|
36
|
+
`strict`. The `architecture` preset enables no rules until the project configures them.
|
|
37
|
+
|
|
38
|
+
Set `adamantite/layers` with a layer map. Give each layer an `imports` list of sibling
|
|
39
|
+
layers. Imports are transitive. Put a child map in the containing layer's `layers` property:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import architecture from "adamantite/lint/architecture"
|
|
43
|
+
import { defineConfig } from "oxlint"
|
|
44
|
+
|
|
45
|
+
export default defineConfig({
|
|
46
|
+
extends: [architecture],
|
|
47
|
+
rules: {
|
|
48
|
+
"adamantite/layers": [
|
|
49
|
+
"error",
|
|
50
|
+
{
|
|
51
|
+
root: "src",
|
|
52
|
+
layers: {
|
|
53
|
+
lib: {
|
|
54
|
+
imports: [],
|
|
55
|
+
layers: {
|
|
56
|
+
shared: { imports: [] },
|
|
57
|
+
services: { imports: ["shared"] },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
terminal: { imports: ["lib"] },
|
|
61
|
+
commands: { imports: ["terminal"] },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Resolve `root` from the nearest `package.json` folder. The `lib` child map has the root
|
|
70
|
+
`src/lib`, and its dependency names are local to that map. Every containing map checks a
|
|
71
|
+
file independently. A child permission cannot override a parent prohibition. Declaration
|
|
72
|
+
order does not change permissions.
|
|
73
|
+
|
|
74
|
+
Use `entries` for composition files, `isolate` for layers whose child folders cannot import
|
|
75
|
+
each other, and `ignoreTypes` when type-only imports do not count. Add import `conditions`
|
|
76
|
+
explicitly when resolution needs them. The rule does not read tsconfig `customConditions`.
|
|
77
|
+
An unresolved import is not checked. A folder missing from the map is reported. Move a
|
|
78
|
+
loose root file into a layer or declare it as an entry.
|
|
79
|
+
|
|
80
|
+
Place child settings beside the child's `layers`. Settings do not inherit. A parent's
|
|
81
|
+
`ignore`, `entries`, or `ignoreTypes` does not skip child checks. A child root uses the
|
|
82
|
+
parent's actual matched folder, including when the top root is a glob. Declare each
|
|
83
|
+
concrete scope once. Keep separate option objects for roots that cannot nest without a
|
|
84
|
+
new intermediate map.
|
|
85
|
+
|
|
86
|
+
For an import that belongs to one file or folder, set `adamantite/import-owners`:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import architecture from "adamantite/lint/architecture"
|
|
90
|
+
import { defineConfig } from "oxlint"
|
|
91
|
+
|
|
92
|
+
export default defineConfig({
|
|
93
|
+
extends: [architecture],
|
|
94
|
+
rules: {
|
|
95
|
+
"adamantite/import-owners": [
|
|
96
|
+
"error",
|
|
97
|
+
{ import: "giget", owners: ["src/services/download.ts"] },
|
|
98
|
+
{ import: "react-native", names: ["Alert"], owners: ["src/shared/alerts.ts"] },
|
|
99
|
+
{ import: "#lib/database.ts", owners: ["src/lib/repositories"] },
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Resolve owners from the workspace root, or the `package.json` folder outside a workspace.
|
|
106
|
+
An owner folder covers every file below it. A package name covers its subpaths.
|
|
107
|
+
Use `names` to restrict selected exports. Namespace imports and `export *` are also reported
|
|
108
|
+
when names are restricted. An `import` that starts with `#`, `.`, or `/` names a file or folder of
|
|
109
|
+
the project, resolved from the same root as the owners. The rule resolves each import of a linted
|
|
110
|
+
file, so a relative path or another alias to that module counts too. An import that names a `#`
|
|
111
|
+
module as the option states it also counts, as for a package. In a monorepo, a `#` option restricts
|
|
112
|
+
that alias in every package. To restrict a folder of one package, name its path from the workspace
|
|
113
|
+
root, such as `./apps/web/src/lib/db`. Use layer maps for the dependencies between folders.
|
|
114
|
+
|
|
115
|
+
Repair a report by using what the owner exports or moving the code to its layer or owner.
|
|
116
|
+
Adding an owner, layer dependency, or `ignore` glob only to pass the check weakens the standard.
|
|
117
|
+
Continue when the configured maps and owners match the project's intended imports.
|
|
118
|
+
|
|
119
|
+
## Change test rule configuration
|
|
120
|
+
|
|
121
|
+
If a Jest or Vitest preset needs different test paths or rule settings, replace its entry in
|
|
122
|
+
`extends` with a project override. Use the preset's exported `testFiles`, or the project's
|
|
123
|
+
test paths, with its `plugins` and `rules`. For example:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import vitest, { testFiles } from "adamantite/lint/vitest"
|
|
127
|
+
import { defineConfig } from "oxlint"
|
|
128
|
+
|
|
129
|
+
export default defineConfig({
|
|
130
|
+
overrides: [{ files: testFiles, plugins: vitest.plugins, rules: { ...vitest.rules } }],
|
|
131
|
+
})
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Change test rules in that override. Top-level rules do not replace the preset's test override.
|
|
135
|
+
Keep `plugins` in it, because Oxlint ignores `vitest/*` rules without the plugin.
|
|
136
|
+
Continue when the intended test files receive the configured rules.
|
|
137
|
+
|
|
138
|
+
## Try a rule setting
|
|
139
|
+
|
|
140
|
+
Before changing a rule setting, run `adamantite rule try <rule> --report <case> --accept <case>`
|
|
141
|
+
when the task requires evidence from cases. Use `--options '<json array>'` for options after
|
|
142
|
+
the severity, or `--current` for the setting in the config. A case is a project path, or
|
|
143
|
+
`<path>=<file>` to lint the content of `<file>` at `<path>` in a copy of the project.
|
|
144
|
+
|
|
145
|
+
Continue when every case gives the expected result. Exit code 1 means a case differs.
|
|
146
|
+
Exit code 2 means the trial could not supply evidence, such as when the rule does not exist.
|
|
147
|
+
|
|
148
|
+
## Check the repair
|
|
149
|
+
|
|
150
|
+
- The changed code or configuration follows the project's coding standard.
|
|
151
|
+
- The affected lint check passes without a broader exception added only to silence it.
|
|
152
|
+
- Each requested trial ran successfully and gave the expected results.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# How to set up Adamantite
|
|
2
|
+
|
|
3
|
+
## Select the setup
|
|
4
|
+
|
|
5
|
+
Read `adamantite init --help` for the available scripts, presets, and editors.
|
|
6
|
+
Use explicit `--non-interactive` setup as an agent. Include at least one `--script` or `--typescript`.
|
|
7
|
+
For example, to configure checks, fixes, TypeScript, and agent instructions, run:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx adamantite init --non-interactive --script check --script fix --typescript typescript --agents
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`--typescript typescript` writes `adamantite/typescript`, which adds type resets, so
|
|
14
|
+
`JSON.parse()` returns `unknown`. Use `--typescript tsconfig` for a library that publishes
|
|
15
|
+
declaration files, because those files can name reset helper types that consumers do not have.
|
|
16
|
+
A project that already has ts-reset can delete its `reset.d.ts` files and the
|
|
17
|
+
`@total-typescript/ts-reset` dependency after it extends `adamantite/typescript`.
|
|
18
|
+
|
|
19
|
+
Adapt the selected options to the request. Omitted boolean flags are disabled.
|
|
20
|
+
`--agents` adds instructions to `AGENTS.md` and writes this skill to `.agents/skills`, and
|
|
21
|
+
to `.claude/skills` or `.grok/skills` when the project has `.claude/` or `.grok/`.
|
|
22
|
+
|
|
23
|
+
Before selecting `react-strict`, tell the user about its modified MIT license.
|
|
24
|
+
The installed `oxlint-plugin-react-doctor` license requires written permission for use as
|
|
25
|
+
machine learning training or evaluation data, and for certain paid or hosted services.
|
|
26
|
+
Read that license for the exact restrictions.
|
|
27
|
+
|
|
28
|
+
Continue when each selected option serves the requested setup.
|
|
29
|
+
|
|
30
|
+
## Create the selected setup
|
|
31
|
+
|
|
32
|
+
Run `init` with those options. It preserves existing package scripts whose commands differ
|
|
33
|
+
from its managed commands. Use `--overwrite-scripts` only when the task includes replacing them.
|
|
34
|
+
Read the output for preserved configuration that needs a Doctor repair.
|
|
35
|
+
|
|
36
|
+
Adamantite requires TypeScript 7 or later in the target project's own `package.json`.
|
|
37
|
+
Check that declaration if npm cannot install or update a managed plugin.
|
|
38
|
+
|
|
39
|
+
Continue when the selected dependencies are installed and the generated files match the request.
|
|
40
|
+
|
|
41
|
+
## Complete managed plugin setup
|
|
42
|
+
|
|
43
|
+
If the selected presets include a managed plugin, check its setup:
|
|
44
|
+
|
|
45
|
+
- For `react-strict`, include the `react` preset and keep `oxlint-plugin-react-doctor`
|
|
46
|
+
installed. Init installs the pinned package, and Doctor and update maintain it.
|
|
47
|
+
Its React Doctor checks also apply in hook modules.
|
|
48
|
+
- For `effect`, run Oxlint through Adamantite. A plain `oxlint` call cannot load the
|
|
49
|
+
`effecttsgo` rules and stops with `Unknown plugin: 'effecttsgo'`. Replace that call with
|
|
50
|
+
`adamantite check --only lint` instead of removing the preset.
|
|
51
|
+
Keep `{ "name": "@effect/language-service", "diagnostics": true }` in
|
|
52
|
+
`compilerOptions.plugins`. In a monorepo, add it to each package's tsconfig or a shared base.
|
|
53
|
+
Use `ignoreDependencies.effect` from `adamantite/analyze` in `knip.config.ts`.
|
|
54
|
+
- For Effect editor support, follow Doctor's editor findings. After a dependency install or
|
|
55
|
+
update, run `adamantite init --non-interactive --script check --editor vscode` to prepare
|
|
56
|
+
or refresh the VS Code SDK cache. Keep the project's other setup options when needed.
|
|
57
|
+
Select the workspace TypeScript version in VS Code. Zed uses the installed Effect CLI.
|
|
58
|
+
- For `tailwind`, check that the project uses Tailwind v4. Init installs `@shadcn/lint`.
|
|
59
|
+
If components are outside the directories that `components.json` identifies, set
|
|
60
|
+
`settings.shadcn.ui` in `oxlint.config.ts`.
|
|
61
|
+
Without `components.json`, the plugin looks in `components/ui` or `src/components/ui`.
|
|
62
|
+
For another component directory, copy the preset's component-owned rule override to that directory.
|
|
63
|
+
|
|
64
|
+
Continue when Doctor reports no findings for the selected plugins and editors.
|
|
65
|
+
|
|
66
|
+
## Check the setup
|
|
67
|
+
|
|
68
|
+
- Each selected managed script runs successfully.
|
|
69
|
+
- Doctor reports no findings, and its assessment warnings are recorded.
|
|
70
|
+
- Existing scripts and configuration are preserved unless the task includes replacing them.
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//#region presets/lint/antislop.ts
|
|
2
|
-
const config = {
|
|
3
|
-
jsPlugins: [{
|
|
4
|
-
name: "anti-slop",
|
|
5
|
-
specifier: new URL("vendor/antislop/plugin.mjs", import.meta.url).href
|
|
6
|
-
}],
|
|
7
|
-
rules: {
|
|
8
|
-
"anti-slop/no-chained-type-assertions": "error",
|
|
9
|
-
"anti-slop/no-conditional-empty-object-spread": "error",
|
|
10
|
-
"anti-slop/no-known-value-widening": "error",
|
|
11
|
-
"anti-slop/no-module-mocking": "error",
|
|
12
|
-
"anti-slop/no-object-parameters": "error",
|
|
13
|
-
"anti-slop/no-reflect-apply": "error",
|
|
14
|
-
"anti-slop/no-reflect-get": "error",
|
|
15
|
-
"anti-slop/no-runtime-typeof": ["error", { allowInTypeGuards: true }],
|
|
16
|
-
"anti-slop/no-shape-in-symbol-names": "error",
|
|
17
|
-
"anti-slop/no-unknown-parameters": "error",
|
|
18
|
-
"anti-slop/no-unknown-returns": "error",
|
|
19
|
-
"anti-slop/no-unknown-type-aliases": "error",
|
|
20
|
-
"anti-slop/no-unsafe-dictionary-type": "error",
|
|
21
|
-
"anti-slop/no-widen-then-assert": "error",
|
|
22
|
-
"anti-slop/require-safety-comment-for-type-assertion": "error",
|
|
23
|
-
"typescript/consistent-indexed-object-style": "off",
|
|
24
|
-
"unicorn/no-immediate-mutation": "off"
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
//#endregion
|
|
28
|
-
export { config as default };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//#region presets/lint/react-doctor.ts
|
|
2
|
-
const config = {
|
|
3
|
-
jsPlugins: ["oxlint-plugin-react-doctor"],
|
|
4
|
-
rules: {
|
|
5
|
-
"react-doctor/no-create-store-in-render": "error",
|
|
6
|
-
"react-doctor/no-direct-state-mutation": "error",
|
|
7
|
-
"react-doctor/no-eager-new-in-use-state-initializer": "error",
|
|
8
|
-
"react-doctor/no-impure-state-updater": "error",
|
|
9
|
-
"react-doctor/no-mutating-reducer-state": "error",
|
|
10
|
-
"react-doctor/effect-observer-needs-disconnect": "error",
|
|
11
|
-
"react-doctor/effect-raf-loop-needs-cancel": "error",
|
|
12
|
-
"react-doctor/no-effect-event-handler": "error",
|
|
13
|
-
"react-doctor/no-event-trigger-state": "error",
|
|
14
|
-
"react-doctor/no-fetch-in-effect": "error",
|
|
15
|
-
"react-doctor/no-pass-live-state-to-parent": "error",
|
|
16
|
-
"react-doctor/no-set-state-after-await-in-effect": "error"
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
//#endregion
|
|
20
|
-
export { config as default };
|