adamantite 0.45.0 → 0.46.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.
Files changed (60) hide show
  1. package/README.md +368 -122
  2. package/dist/index.js +638 -57
  3. package/dist/oxlint.js +1 -0
  4. package/dist/presets/analyze.js +1 -0
  5. package/dist/presets/lint/{react-doctor.d.ts → architecture.d.ts} +1 -1
  6. package/dist/presets/lint/architecture.js +8 -0
  7. package/dist/presets/lint/core.js +0 -1
  8. package/dist/presets/lint/effect.js +26 -1
  9. package/dist/presets/lint/plugin/glob.d.ts +7 -0
  10. package/dist/presets/lint/plugin/glob.js +48 -0
  11. package/dist/presets/lint/plugin/imports.d.ts +4 -0
  12. package/dist/presets/lint/plugin/imports.js +4 -1
  13. package/dist/presets/lint/plugin/index.d.ts +3 -0
  14. package/dist/presets/lint/plugin/index.js +14 -8
  15. package/dist/presets/lint/plugin/options.d.ts +5 -5
  16. package/dist/presets/lint/plugin/options.js +19 -7
  17. package/dist/presets/lint/plugin/resolver.d.ts +8 -0
  18. package/dist/presets/lint/plugin/resolver.js +79 -0
  19. package/dist/presets/lint/plugin/rules/import-owners.d.ts +67 -0
  20. package/dist/presets/lint/plugin/rules/import-owners.js +310 -0
  21. package/dist/presets/lint/plugin/rules/layers.d.ts +136 -0
  22. package/dist/presets/lint/plugin/rules/layers.js +479 -0
  23. package/dist/presets/lint/plugin/rules/no-query-data-in-state.js +1 -1
  24. package/dist/presets/lint/plugin/rules/no-react-state-hooks.d.ts +0 -5
  25. package/dist/presets/lint/plugin/rules/no-react-state-hooks.js +3 -47
  26. package/dist/presets/lint/plugin/rules/query-from-loader.js +2 -2
  27. package/dist/presets/lint/plugin/rules/require-suppression-reason.d.ts +5 -0
  28. package/dist/presets/lint/plugin/rules/require-suppression-reason.js +32 -0
  29. package/dist/presets/lint/react-strict.js +22 -2
  30. package/dist/presets/lint/strict.js +35 -2
  31. package/dist/presets/lint/{antislop.d.ts → tailwind.d.ts} +1 -1
  32. package/dist/presets/lint/{shadcn.js → tailwind.js} +1 -1
  33. package/dist/presets/lint/vendor/antislop/license.md +26 -1
  34. package/dist/presets/lint/vendor/antislop/plugin.d.mts +3 -0
  35. package/dist/presets/lint/vendor/antislop/plugin.mjs +940 -31
  36. package/dist/presets/lint/vendor/antislop-effect/license.md +27 -0
  37. package/dist/presets/lint/vendor/antislop-effect/plugin.d.mts +17 -0
  38. package/dist/presets/lint/vendor/antislop-effect/plugin.mjs +579 -0
  39. package/dist/presets/{lint → rules}/custom.d.ts +3 -20
  40. package/dist/presets/{lint → rules}/custom.js +50 -46
  41. package/dist/presets/rules/folder.d.ts +34 -0
  42. package/dist/presets/rules/folder.js +52 -0
  43. package/dist/presets/rules/index.d.ts +2 -9
  44. package/dist/presets/rules/index.js +1 -29
  45. package/dist/presets/rules/load.d.ts +8 -0
  46. package/dist/presets/rules/load.js +29 -0
  47. package/dist/presets/rules/plugin.d.ts +3 -0
  48. package/dist/presets/rules/plugin.js +1 -0
  49. package/dist/presets/rules/testing.d.ts +2 -0
  50. package/dist/presets/rules/testing.js +14 -0
  51. package/dist/presets/tsconfig.json +3 -0
  52. package/dist/runtime-CVZPDpfE.js +11 -0
  53. package/package.json +79 -18
  54. package/skills/adamantite/SKILL.md +112 -207
  55. package/skills/adamantite/references/custom-rules.md +120 -0
  56. package/skills/adamantite/references/lint-rules.md +158 -0
  57. package/skills/adamantite/references/setup.md +64 -0
  58. package/dist/presets/lint/antislop.js +0 -28
  59. package/dist/presets/lint/react-doctor.js +0 -20
  60. package/dist/presets/lint/shadcn.d.ts +0 -5
@@ -1,42 +1,13 @@
1
- import { createHash } from "node:crypto";
2
- import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
1
+ import { CACHE_DIRECTORY, getRuleName, listRuleFiles } from "./folder.js";
2
+ import { createHash, randomUUID } from "node:crypto";
3
+ import { existsSync, lstatSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
4
  import { tmpdir } from "node:os";
4
- import { dirname, extname, isAbsolute, join, resolve } from "node:path";
5
+ import { dirname, isAbsolute, join, resolve } from "node:path";
6
+ import process from "node:process";
5
7
  import { fileURLToPath, pathToFileURL } from "node:url";
6
- //#region presets/lint/custom.ts
8
+ //#region presets/rules/custom.ts
7
9
  const MODULE_EXTENSION = import.meta.url.endsWith(".ts") ? "ts" : "js";
8
- const RULES_MODULE_URL = new URL(`../rules/index.${MODULE_EXTENSION}`, import.meta.url).href;
9
- const DEFAULT_DIRECTORY = ".adamantite/rules";
10
- const CACHE_DIRECTORY = join("node_modules", ".cache", "adamantite");
11
- /**
12
- * The plugin name that `custom()` uses when no `name` is given.
13
- */
14
- const DEFAULT_PLUGIN_NAME = "project";
15
- const RULE_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
16
- ".js",
17
- ".mjs",
18
- ".mts",
19
- ".ts"
20
- ]);
21
- /**
22
- * The rule name that a rule file defines: its file name without the extension.
23
- */
24
- function getRuleName(file) {
25
- return file.slice(0, -extname(file).length);
26
- }
27
- /**
28
- * Whether a file in a rules folder is a rule: it has a JavaScript or TypeScript extension, is not a
29
- * declaration file, and does not start with `_`.
30
- */
31
- function isRuleFile(name) {
32
- return RULE_FILE_EXTENSIONS.has(extname(name)) && !name.startsWith("_") && !/\.d\.m?ts$/.test(name);
33
- }
34
- /**
35
- * The rule files in a rules folder. Subfolders are not read, so helpers can also live there.
36
- */
37
- function listRuleFiles(dir) {
38
- return readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isFile() && isRuleFile(entry.name)).map((entry) => entry.name);
39
- }
10
+ const RULES_MODULE_URL = new URL(`load.${MODULE_EXTENSION}`, import.meta.url).href;
40
11
  /**
41
12
  * Normalize a file from a stack frame: drop the query string and hash, which Oxlint adds to bypass
42
13
  * the module cache, and convert a file URL to a path.
@@ -76,18 +47,50 @@ function findNodeModules(from) {
76
47
  if (dirname(current) === current) return;
77
48
  }
78
49
  }
50
+ function hasContent(path, content) {
51
+ return existsSync(path) && readFileSync(path, "utf8") === content;
52
+ }
53
+ /**
54
+ * Write `content` to `path` unless the file already holds it. Several Oxlint processes can load the
55
+ * config at once, as in a monorepo task runner, and one can import the module while another writes
56
+ * it. A write in place truncates the file first, so the module goes to a temporary file that a
57
+ * rename moves over `path` in one step.
58
+ */
79
59
  function writeIfChanged(path, content) {
80
- if (existsSync(path) && readFileSync(path, "utf8") === content) return;
60
+ if (hasContent(path, content)) return;
81
61
  mkdirSync(dirname(path), { recursive: true });
82
- writeFileSync(path, content);
62
+ const temporary = `${path}.${process.pid}.${randomUUID()}.tmp`;
63
+ writeFileSync(temporary, content, { flag: "wx" });
64
+ try {
65
+ renameSync(temporary, path);
66
+ } catch (error) {
67
+ rmSync(temporary, { force: true });
68
+ if (!hasContent(path, content)) throw error;
69
+ }
70
+ }
71
+ /**
72
+ * A folder in the OS temporary directory that only the current user can write. The temporary
73
+ * directory can be shared, so another user could create a folder there first, and then replace an
74
+ * entry module after `custom()` writes it. Windows gives each user a temporary directory.
75
+ */
76
+ function getPrivateTemporaryDirectory() {
77
+ const uid = process.geteuid?.();
78
+ const dir = join(tmpdir(), uid === void 0 ? "adamantite" : `adamantite-${uid}`);
79
+ mkdirSync(dir, {
80
+ mode: 448,
81
+ recursive: true
82
+ });
83
+ const stats = lstatSync(dir);
84
+ if (uid !== void 0 && (!stats.isDirectory() || stats.uid !== uid || (stats.mode & 18) !== 0)) throw new Error(`${dir} is not a folder that only the current user can write.`);
85
+ return dir;
83
86
  }
84
87
  /**
85
88
  * Write the entry module for a rules folder and return its file URL. The module goes to
86
- * `node_modules/.cache/adamantite` above the folder, or to the OS temporary directory when no
87
- * `node_modules` folder is found or it cannot be written.
89
+ * `node_modules/.cache/adamantite` above the folder, or to a private folder in the OS temporary
90
+ * directory when no `node_modules` folder is found or it cannot be written.
88
91
  */
89
92
  function writeEntryModule(dir, name) {
90
- const fileName = `rules-${createHash("sha256").update(`${dir}\0${name}`).digest("hex").slice(0, 16)}.mjs`;
93
+ const fileName = `rules-${createHash("sha256").update(`${RULES_MODULE_URL}\0${dir}\0${name}`).digest("hex").slice(0, 16)}.mjs`;
91
94
  const content = [
92
95
  `import { loadRules } from ${JSON.stringify(RULES_MODULE_URL)}`,
93
96
  "",
@@ -95,9 +98,10 @@ function writeEntryModule(dir, name) {
95
98
  ""
96
99
  ].join("\n");
97
100
  const root = findNodeModules(dir);
98
- const candidates = [...root === void 0 ? [] : [join(root, CACHE_DIRECTORY, fileName)], join(tmpdir(), "adamantite", fileName)];
101
+ const folders = [...root === void 0 ? [] : [() => join(root, CACHE_DIRECTORY)], () => getPrivateTemporaryDirectory()];
99
102
  const failures = [];
100
- for (const path of candidates) try {
103
+ for (const folder of folders) try {
104
+ const path = join(folder(), fileName);
101
105
  writeIfChanged(path, content);
102
106
  return pathToFileURL(path).href;
103
107
  } catch (error) {
@@ -116,14 +120,14 @@ function writeEntryModule(dir, name) {
116
120
  * ```ts
117
121
  * import { defineConfig } from "oxlint"
118
122
  * import core from "adamantite/lint"
119
- * import custom from "adamantite/lint/custom"
123
+ * import custom from "adamantite/rules"
120
124
  *
121
125
  * export default defineConfig({ extends: [core, custom()] })
122
126
  * ```
123
127
  */
124
128
  function custom(options = {}) {
125
129
  const name = options.name ?? "project";
126
- const dir = resolveRulesDirectory(options.dir ?? DEFAULT_DIRECTORY, (/* @__PURE__ */ new Error("custom()")).stack ?? "");
130
+ const dir = resolveRulesDirectory(options.dir ?? ".adamantite/lint", (/* @__PURE__ */ new Error("custom()")).stack ?? "");
127
131
  if (!existsSync(dir)) return {};
128
132
  const files = listRuleFiles(dir);
129
133
  if (files.length === 0) return {};
@@ -139,4 +143,4 @@ function custom(options = {}) {
139
143
  };
140
144
  }
141
145
  //#endregion
142
- export { DEFAULT_PLUGIN_NAME, custom as default, findCallerFile, getRuleName, isRuleFile, listRuleFiles };
146
+ export { custom as default, findCallerFile };
@@ -0,0 +1,34 @@
1
+ //#region presets/rules/folder.d.ts
2
+ /**
3
+ * The rules folder that `custom()` loads when no `dir` is given, relative to the file that calls
4
+ * it.
5
+ */
6
+ export declare const DEFAULT_DIRECTORY = ".adamantite/lint";
7
+ /**
8
+ * The folder, relative to a project, where `custom()` writes the entry module of each rules folder.
9
+ * A test in the CLI checks that the trial copy of `adamantite rule try` does not link this folder
10
+ * to the project.
11
+ */
12
+ export declare const CACHE_DIRECTORY: string;
13
+ /**
14
+ * The plugin name that prefixes every rule when `custom()` is given no `name`.
15
+ */
16
+ export declare const DEFAULT_PLUGIN_NAME = "project";
17
+ /**
18
+ * The extensions of rule files.
19
+ */
20
+ export declare const RULE_FILE_EXTENSIONS: ReadonlySet<string>;
21
+ export declare function getRuleName(file: string): string;
22
+ /**
23
+ * Whether a file in a rules folder is a rule: it has a JavaScript or TypeScript extension, is not a
24
+ * declaration or test file, and does not start with `_`.
25
+ */
26
+ export declare function isRuleFile(name: string): boolean;
27
+ /**
28
+ * The rule files in a rules folder. Subfolders are not read, so helpers can also live there. Each
29
+ * rule name must have one file, because `custom()` and `loadRules` key the rules by name. Two files
30
+ * for one name, such as `no-foo.js` and `no-foo.ts`, throw instead of one silently replacing the
31
+ * other.
32
+ */
33
+ export declare function listRuleFiles(dir: string): string[];
34
+ //#endregion
@@ -0,0 +1,52 @@
1
+ import { readdirSync } from "node:fs";
2
+ import { extname, join } from "node:path";
3
+ //#region presets/rules/folder.ts
4
+ /**
5
+ * The rules folder that `custom()` loads when no `dir` is given, relative to the file that calls
6
+ * it.
7
+ */
8
+ const DEFAULT_DIRECTORY = ".adamantite/lint";
9
+ /**
10
+ * The folder, relative to a project, where `custom()` writes the entry module of each rules folder.
11
+ * A test in the CLI checks that the trial copy of `adamantite rule try` does not link this folder
12
+ * to the project.
13
+ */
14
+ const CACHE_DIRECTORY = join("node_modules", ".cache", "adamantite");
15
+ /**
16
+ * The plugin name that prefixes every rule when `custom()` is given no `name`.
17
+ */
18
+ const DEFAULT_PLUGIN_NAME = "project";
19
+ /**
20
+ * The extensions of rule files.
21
+ */
22
+ const RULE_FILE_EXTENSIONS = /* @__PURE__ */ new Set([
23
+ ".js",
24
+ ".mjs",
25
+ ".mts",
26
+ ".ts"
27
+ ]);
28
+ function getRuleName(file) {
29
+ return file.slice(0, -extname(file).length);
30
+ }
31
+ /**
32
+ * Whether a file in a rules folder is a rule: it has a JavaScript or TypeScript extension, is not a
33
+ * declaration or test file, and does not start with `_`.
34
+ */
35
+ function isRuleFile(name) {
36
+ return RULE_FILE_EXTENSIONS.has(extname(name)) && !name.startsWith("_") && !/\.(?:d\.m?ts|test\.[^.]+)$/.test(name);
37
+ }
38
+ /**
39
+ * The rule files in a rules folder. Subfolders are not read, so helpers can also live there. Each
40
+ * rule name must have one file, because `custom()` and `loadRules` key the rules by name. Two files
41
+ * for one name, such as `no-foo.js` and `no-foo.ts`, throw instead of one silently replacing the
42
+ * other.
43
+ */
44
+ function listRuleFiles(dir) {
45
+ const files = readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isFile() && isRuleFile(entry.name)).map((entry) => entry.name);
46
+ const filesByRule = /* @__PURE__ */ new Map();
47
+ for (const file of files) filesByRule.set(getRuleName(file), [...filesByRule.get(getRuleName(file)) ?? [], file]);
48
+ for (const [rule, ruleFiles] of filesByRule) if (ruleFiles.length > 1) throw new Error(`The rules folder ${dir} has more than one file for the rule \`${rule}\`: ${ruleFiles.join(", ")}. Keep one of them.`);
49
+ return files;
50
+ }
51
+ //#endregion
52
+ export { CACHE_DIRECTORY, DEFAULT_DIRECTORY, DEFAULT_PLUGIN_NAME, RULE_FILE_EXTENSIONS, getRuleName, isRuleFile, listRuleFiles };
@@ -1,9 +1,2 @@
1
- import { Context, Diagnostic, ESTree, Fix, Fixer, Node, Options, Plugin, Rule, RuleMeta, SourceCode, Visitor, VisitorWithHooks, defineRule } from "@oxlint/plugins";
2
- //#region presets/rules/index.d.ts
3
- /**
4
- * Import every rule file in a rules folder and return them as one Oxlint plugin. The entry module
5
- * that `custom()` writes calls this function.
6
- */
7
- export declare function loadRules(dir: string, name?: string): Promise<Plugin>;
8
- //#endregion
9
- export { type Context, type Diagnostic, type ESTree, type Fix, type Fixer, type Node, type Options, type Rule, type RuleMeta, type SourceCode, type Visitor, type VisitorWithHooks, defineRule };
1
+ import custom, { CustomRulesOptions } from "./custom.js";
2
+ export { type CustomRulesOptions, custom as default };
@@ -1,29 +1 @@
1
- import { DEFAULT_PLUGIN_NAME, getRuleName, listRuleFiles } from "../lint/custom.js";
2
- import { join } from "node:path";
3
- import { pathToFileURL } from "node:url";
4
- import { defineRule } from "@oxlint/plugins";
5
- //#region presets/rules/index.ts
6
- async function importRule(path) {
7
- let module;
8
- try {
9
- module = await import(pathToFileURL(path).href);
10
- } catch (error) {
11
- const reason = error instanceof Error ? error.message : String(error);
12
- throw new Error(`Custom rule ${path} failed to load: ${reason}\nRule files run with type stripping, so use erasable TypeScript only: no enum, namespace, or parameter properties.`, { cause: error });
13
- }
14
- if (module.default === void 0) throw new Error(`Custom rule ${path} has no default export. Export the rule as default.`);
15
- return module.default;
16
- }
17
- /**
18
- * Import every rule file in a rules folder and return them as one Oxlint plugin. The entry module
19
- * that `custom()` writes calls this function.
20
- */
21
- async function loadRules(dir, name = DEFAULT_PLUGIN_NAME) {
22
- const rules = await Promise.all(listRuleFiles(dir).map(async (file) => [getRuleName(file), await importRule(join(dir, file))]));
23
- return {
24
- meta: { name },
25
- rules: Object.fromEntries(rules)
26
- };
27
- }
28
- //#endregion
29
- export { defineRule, loadRules };
1
+ export { default } from "./custom.js";
@@ -0,0 +1,8 @@
1
+ import { Plugin } from "@oxlint/plugins";
2
+ //#region presets/rules/load.d.ts
3
+ /**
4
+ * Import every rule file in a rules folder and return them as one Oxlint plugin. The entry module
5
+ * that `custom()` writes calls this function.
6
+ */
7
+ export declare function loadRules(dir: string, name?: string): Promise<Plugin>;
8
+ //#endregion
@@ -0,0 +1,29 @@
1
+ import { DEFAULT_PLUGIN_NAME, getRuleName, listRuleFiles } from "./folder.js";
2
+ import { definePlugin } from "./plugin.js";
3
+ import { join } from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ //#region presets/rules/load.ts
6
+ async function importRule(path) {
7
+ let module;
8
+ try {
9
+ module = await import(pathToFileURL(path).href);
10
+ } catch (error) {
11
+ const reason = error instanceof Error ? error.message : String(error);
12
+ throw new Error(`Custom rule ${path} failed to load: ${reason}\nRule files run with type stripping, so use erasable TypeScript only: no enum, namespace, or parameter properties.`, { cause: error });
13
+ }
14
+ if (module.default === void 0) throw new Error(`Custom rule ${path} has no default export. Export the rule as default.`);
15
+ return module.default;
16
+ }
17
+ /**
18
+ * Import every rule file in a rules folder and return them as one Oxlint plugin. The entry module
19
+ * that `custom()` writes calls this function.
20
+ */
21
+ async function loadRules(dir, name = DEFAULT_PLUGIN_NAME) {
22
+ const rules = await Promise.all(listRuleFiles(dir).map(async (file) => [getRuleName(file), await importRule(join(dir, file))]));
23
+ return definePlugin({
24
+ meta: { name },
25
+ rules: Object.fromEntries(rules)
26
+ });
27
+ }
28
+ //#endregion
29
+ export { loadRules };
@@ -0,0 +1,3 @@
1
+ import { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
2
+ export type * from "@oxlint/plugins";
3
+ export { definePlugin, defineRule, eslintCompatPlugin };
@@ -0,0 +1 @@
1
+ export { definePlugin, defineRule, eslintCompatPlugin } from "@oxlint/plugins";
@@ -0,0 +1,2 @@
1
+ import { RuleTester } from "oxlint/plugins-dev";
2
+ export { RuleTester };
@@ -0,0 +1,14 @@
1
+ import { describe, it } from "node:test";
2
+ import { RuleTester, RuleTester as RuleTester$1 } from "oxlint/plugins-dev";
3
+ //#region presets/rules/testing.ts
4
+ RuleTester$1.describe = (text, method) => {
5
+ describe(text, method);
6
+ };
7
+ RuleTester$1.it = (text, method) => {
8
+ it(text, method);
9
+ };
10
+ RuleTester$1.itOnly = (text, method) => {
11
+ it.only(text, method);
12
+ };
13
+ //#endregion
14
+ export { RuleTester };
@@ -17,6 +17,9 @@
17
17
  "strict": true,
18
18
 
19
19
  "allowUnreachableCode": false,
20
+ // Node.js type stripping, Bun, and custom rule files run only erasable syntax. Core lint
21
+ // reports namespaces and parameter properties, but no lint rule bans `enum`.
22
+ "erasableSyntaxOnly": true,
20
23
  "forceConsistentCasingInFileNames": true,
21
24
  "noImplicitAny": true,
22
25
  "noImplicitOverride": true,
@@ -0,0 +1,11 @@
1
+ import*as e from"effect/Effect";import*as t from"effect/Array";import*as n from"effect/Layer";import r from"node:process";import*as i from"effect/Option";import*as a from"effect/Context";import*as o from"effect/Path";import*as s from"effect/Predicate";import{stripVTControlCharacters as c}from"node:util";import*as l from"effect/Result";import*as u from"effect/Data";import{pipe as d}from"effect/Function";import*as f from"effect/String";import{applyEdits as p,findNodeAtLocation as m,modify as ee,parse as h,parseTree as g,printParseErrorCode as _,visit as v}from"jsonc-parser";import*as y from"effect/FileSystem";import*as b from"effect/Equal";import*as x from"effect/Schema";import*as te from"effect/encoding/Yaml";import*as ne from"effect/SchemaTransformation";import*as re from"effect/Record";import{fileURLToPath as ie}from"node:url";import*as ae from"effect/Order";import{ResolverFactory as oe}from"oxc-resolver";import*as se from"effect/Match";function ce(e){return s.isError(e)?d(c(e.message),f.split(/\r\n|[\r\n]/),t.map(e=>f.trimEnd(e)),t.filter(e=>f.isNonEmpty(e))):[]}function S(e){return d(ce(e),t.head,i.map(e=>{let t=f.trim(e);return/[.!?]$/.test(t)?` Cause: ${t}`:` Cause: ${t}.`}),i.getOrElse(()=>``))}function le(e){let n=ce(e);if(!t.isReadonlyArrayNonEmpty(n))return``;let r=t.takeRight(n,20);return`\n${(r.length<n.length?[`…`,...r]:r).join(`
2
+ `)}`}function ue(e=[]){return e.length===0?`- Unknown JSON/JSONC parsing error`:e.slice(0,3).map(e=>`- ${_(e.error)} (offset: ${e.offset})`).join(`
3
+ `)}var de=class extends u.TaggedError(`AdamantiteNotInstalled`){get message(){return`\`adamantite\` is not installed in this project. Install it before running \`adamantite ${this.command}\`.`}},fe=class extends u.TaggedError(`AdamantiteNotInNodeModules`){get message(){return`\`adamantite\` is in \`package.json\` but not in \`node_modules\`. Install the dependencies before running \`adamantite ${this.command}\`.`}},pe=class extends u.TaggedError(`AdamantiteVersionMismatch`){get message(){return`This project installs Adamantite ${this.installed}, but this command is Adamantite ${this.running}. Run the project's own Adamantite, such as \`pnpm exec adamantite ${this.command}\`, or install the dependencies again.`}},me=class extends u.TaggedError(`ScopeOutsideProject`){get message(){return`\`--path\` must be a folder inside the project. \`${this.scope}\` is outside \`${this.cwd}\`.`}},he=class extends u.TaggedError(`CliNotFound`){get message(){return`The command \`${this.command}\` was not found on PATH. ${this.hint??`Install it, then run the command again.`}`}},ge=class extends u.TaggedError(`CommandFailed`){get message(){return`Command \`${this.command}\` failed with exit code ${this.exitCode}.`}},_e=class extends u.TaggedError(`CustomRuleExists`){get message(){let e=this.paths.map(e=>`\`${e}\``).join(` and `);return this.paths.length===1?`${e} already exists. Choose another name, or edit the file.`:`${e} already exist. Choose another name, or edit the files.`}},ve=class extends u.TaggedError(`CustomRuleNotFound`){get message(){return`Rule \`${this.rule}\` does not exist in \`${this.directory}\`. Create the rule before adding its test.`}},ye=class extends u.TaggedError(`EffectBuildMissing`){get message(){let e=this.supported.length===0?`has no builds of ${this.tool}`:`has builds for ${this.tool} ${this.supported.join(`, `)}`;return`The effect preset needs the @effect/tsgo build of ${this.tool} ${this.version}. @effect/tsgo ${this.effectVersion} ${e}. Run \`adamantite update\`.`}},be=class extends u.TaggedError(`EffectPlatformUnsupported`){get message(){return`@effect/tsgo has no Effect build of Oxlint for ${this.platform}, so Oxlint cannot load the effect preset here.`}},xe=class extends u.TaggedError(`EffectEditorUnavailable`){get message(){return this.reason}},Se=class extends u.TaggedError(`FailedToCreateDirectory`){get message(){return`Could not create ${this.path?`\`${this.path}\``:`the target directory`}. Check the parent directory permissions, then try again.${S(this.cause)}`}},Ce=class extends u.TaggedError(`FailedToInstallDependency`){get message(){return`Failed to install dependencies${this.packages?.length?`: ${this.packages.join(`, `)}`:``}.${le(this.cause)}`}},we=class extends u.TaggedError(`FailedToInstallExtension`){get message(){let e=this.extension?`\`${this.extension}\``:`the target extension`;return s.isNumber(this.cause)?`Failed to install ${e}. The \`code\` CLI exited with code ${this.cause}.`:`Failed to install ${e}.${S(this.cause)}`}},Te=class extends u.TaggedError(`FailedToMergeConfig`){get message(){return`Failed to merge configuration.${S(this.cause)}`}},Ee=class extends u.TaggedError(`FailedToParseFile`){get message(){return[`Failed to parse ${this.path?`\`${this.path}\``:`the target file`}.`,`Fix the JSON or JSONC syntax and run the command again.`,``,`Parse details:`,ue(this.errors)].join(`
4
+ `)}},C=class extends u.TaggedError(`FailedToParseYaml`){get message(){return`Failed to parse \`${this.path}\`.${S(this.cause)}`}},De=class extends u.TaggedError(`FailedToParseSource`){get message(){return[`Could not parse \`${this.path}\`. Fix the syntax and run the command again.`,...this.errors.map(e=>`- ${e}`)].join(`
5
+ `)}},w=class extends u.TaggedError(`FailedToReadFile`){get message(){return`Could not read ${this.path?`\`${this.path}\``:`the target file`}. Check that the file exists and is readable, then try again.${S(this.cause)}`}},Oe=class extends u.TaggedError(`FailedToWriteFile`){get message(){return`Could not write ${this.path?`\`${this.path}\``:`the target file`}. Check the directory permissions and available disk space, then try again.${S(this.cause)}`}},T=class extends u.TaggedError(`InvalidConfigFormat`){get message(){return`The config in ${this.path?`\`${this.path}\``:`the target config file`} must be a JSON object, such as {}.`}},ke=class extends u.TaggedError(`ProjectCopyFailed`){get message(){return`Could not copy the project to a temporary folder for the trial. Check the free disk space and the permissions of the temporary folder, then try again.${S(this.cause)}`}},Ae=class extends u.TaggedError(`InvalidPackageJson`){get message(){return`\`${this.path}\` is not a valid \`package.json\`. ${this.issue}`}},je=class extends u.TaggedError(`InvalidAnalyzeOptions`){get message(){return`Invalid analyze options. ${this.reason}`}},Me=class extends u.TaggedError(`InvalidCheckOptions`){get message(){return`Invalid check options. ${this.reason}`}},Ne=class extends u.TaggedError(`InvalidFixOptions`){get message(){return`Invalid fix options. ${this.reason}`}},Pe=class extends u.TaggedError(`InvalidInitOptions`){get message(){return`Invalid init options. ${this.reason}`}},Fe=class extends u.TaggedError(`InvalidTrialCase`){get message(){return`Invalid case \`${this.value}\`. ${this.reason}`}},Ie=class extends u.TaggedError(`InvalidTrialOptions`){get message(){return`Invalid trial options. ${this.reason}`}},Le=class extends u.TaggedError(`InvalidRuleName`){get message(){return`Invalid rule name \`${this.rule}\`. Use kebab-case that starts with a letter, such as \`no-process-env\`.`}},Re=class extends u.TaggedError(`NoPackageManager`){get message(){return`No package manager was found. Run this command from a project with a lockfile.${S(this.cause)}`}};u.TaggedError(`MissingPackageVersion`);var ze=class extends u.TaggedError(`OperationCancelled`){get message(){return`Operation cancelled.${this.reason?` Reason: ${this.reason}`:``}`}},Be=class extends u.TaggedError(`NativeRuntimeConflict`){get message(){let e=this.part===`Binding`?`native binding`:`type-aware backend`;return`${this.plugins.join(` and `)} both replace the Oxlint ${e}. Remove one of them.`}},E=class extends u.TaggedError(`PackageNotInstalled`){get message(){return`\`${this.packageName}\` is not installed in \`${this.project}\`. Install the dependencies, or run \`adamantite update\`.`}},Ve=class extends u.TaggedError(`PassthroughNotSupported`){get message(){return`\`adamantite ${this.command}\` does not accept arguments after \`--\`. Use the command options instead.`}},He=class extends u.TaggedError(`TrialCaseIgnored`){get message(){return`The trial could not check this case because the Oxlint config ignores \`${this.path}\`. Put the case at a path that the config lints.`}},Ue=class extends u.TaggedError(`TrialCaseUnparsable`){get message(){return[`Oxlint could not parse the trial case \`${this.path}\`. Fix the syntax and run the trial again.`,...this.errors.map(e=>`- ${e}`)].join(`
6
+ `)}},We=class extends u.TaggedError(`TrialConfigNotFound`){get message(){return`No Oxlint config applies to \`${this.path}\`. Configure linting with \`adamantite init\`, then run the trial again.`}},Ge=class extends u.TaggedError(`TrialLintFailed`){get message(){return`Oxlint could not run the trial. Fix the errors below and run it again.\n${this.output}`}},Ke=class extends u.TaggedError(`TrialProjectUnlisted`){get message(){return`The trial needs Git to list the files of \`${this.cwd}\`. Run it in a Git repository.`}},qe=class extends u.TaggedError(`TrialRuleNotFound`){get message(){return`The rule \`${this.rule}\` is not available. Check that the Oxlint config loads it. Oxlint reports: ${this.detail}`}},Je=class extends u.TaggedError(`VscodeCliNotFound`){get message(){return`VS Code's \`code\` command was not found on PATH. Add it to PATH to manage extensions.${S(this.cause)}`}};const D=(t,n)=>e.suspend(()=>{let r=[],i=h(t,r,{allowTrailingComma:!0});return r.length>0?e.fail(new Ee({errors:r,path:n})):e.succeed(i)}),Ye=x.fromJsonString(x.Unknown),Xe=x.fromJsonString(x.Unknown,{space:2}),O=x.encodeEffect(Ye),Ze=x.encodeEffect(Xe),k=e=>s.isObject(e),A=e=>Array.isArray(e);function Qe(e,t){return e===void 0?t:k(e)&&k(t)?$e(e,t):A(e)&&A(t)?[...e,...t]:e}function $e(e,t){let n=[...Object.keys(t),...Object.keys(e).filter(e=>!Object.hasOwn(t,e))];return Object.fromEntries(n.flatMap(n=>{let r=Qe(Object.hasOwn(e,n)?e[n]:void 0,Object.hasOwn(t,n)?t[n]:void 0);return r===void 0?[]:[[n,r]]}))}const et=({fallback:t,preferred:n})=>e.try({catch:e=>new Te({cause:e}),try:()=>$e(n,t)}),tt=/^([ \t]+)"/mu;function nt(e){let t=tt.exec(e)?.[1]??` `,n=e.includes(`\r
7
+ `)?`\r
8
+ `:`
9
+ `;return t.startsWith(` `)?{eol:n,insertSpaces:!1,tabSize:1}:{eol:n,insertSpaces:!0,tabSize:t.length}}function rt(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function it(e,t,n){return k(e)&&k(t)?[...Object.keys(e),...Object.keys(t).filter(t=>!Object.hasOwn(e,t))].flatMap(r=>it(rt(e,r),rt(t,r),[...n,r])):b.equals(e,t)?[]:[[n,t]]}const at=/^(?<comma>[ \t]*,)?(?<comment>(?:[ \t]*(?:\/\/[^\r\n]*|\/\*[^\r\n]*?\*\/))+)/u;function ot(e,t){let n=t.at(-1),r=g(e),i=r&&m(r,t.slice(0,-1)),a=i?.type===`object`?(i.children??[]).filter(e=>e.children?.[0]?.value===n):[];return a.length>1?a[0]:void 0}function st(e,t){let n=t.offset+t.length,r;v(e,{onSeparator:(e,t)=>{r===void 0&&e===`,`&&t>=n&&(r=t)}});let i=r===void 0?e:e.slice(0,r)+e.slice(r+1),a=i.slice(0,t.offset)+i.slice(n),o=a.lastIndexOf(`
10
+ `,t.offset-1)+1,s=a.indexOf(`
11
+ `,t.offset),c=s===-1?a.length:s+1;return a.slice(o,c).trim()===``?a.slice(0,o)+a.slice(c):a}function ct(e,t){let n=e;for(let e of t.keys()){let r=t.slice(0,e+1);for(let e=ot(n,r);e;e=ot(n,r))n=st(n,e)}return n}function lt(e,t,n,r){let i=e=>p(e,ee(e,t,n,{formattingOptions:r})),a=g(e),o=t.slice(0,-1),c=a&&m(a,o)?.children?.at(-1),l=c?.children?.[0]?.value;if(n===void 0||a===void 0||m(a,t)!==void 0||c?.type!==`property`||!s.isString(l))return i(e);let u=c.offset+c.length,d=at.exec(e.slice(u));if(d?.groups?.comment===void 0)return i(e);let f=u+(d.groups.comma?.length??0),h=d.groups.comment,_=i(e.slice(0,f)+e.slice(f+h.length)),v=g(_),y=v&&m(v,[...o,l])?.parent,b=y?y.offset+y.length:f,x=b+(/^[ \t]*,/u.exec(_.slice(b))?.[0].length??0);return _.slice(0,x)+h+_.slice(x)}function j(e,t){let n=h(e,[],{allowTrailingComma:!0}),r=nt(e);return it(n,t,[]).reduce((e,[t,n])=>lt(ct(e,t),t,n,r),e)}const ut=t=>y.FileSystem.pipe(e.flatMap(e=>e.makeDirectory(t,{recursive:!0})),e.mapError(e=>new Se({cause:e,path:t}))),M=t=>y.FileSystem.pipe(e.flatMap(e=>e.readFileString(t)),e.mapError(e=>new w({cause:e,path:t}))),N=t=>y.FileSystem.pipe(e.flatMap(e=>e.readFileString(t)),e.asSome,e.catchReason(`PlatformError`,`NotFound`,()=>e.succeedNone,(n,r)=>e.fail(new w({cause:r,path:t})))),dt=t=>y.FileSystem.pipe(e.flatMap(e=>e.readFileString(t)),e.asSome,e.catchReasons(`PlatformError`,{BadResource:()=>e.succeedNone,NotFound:()=>e.succeedNone},(n,r)=>e.fail(new w({cause:r,path:t})))),ft=t=>y.FileSystem.pipe(e.flatMap(e=>e.exists(t)),e.mapError(e=>new w({cause:e,path:t}))),P=(t,n)=>y.FileSystem.pipe(e.flatMap(e=>e.readDirectory(t,n)),e.asSome,e.catchReasons(`PlatformError`,{BadResource:()=>e.succeed(i.none()),NotFound:()=>e.succeed(i.none())},(n,r)=>e.fail(new w({cause:r,path:t})))),F=(t,n)=>y.FileSystem.pipe(e.flatMap(e=>e.writeFileString(t,n)),e.mapError(e=>new Oe({cause:e,path:t}))),pt=(t,n)=>Ze(n).pipe(e.flatMap(e=>F(t,`${e}\n`))),mt=/^workspace:/,ht=/^[\^~]/,gt=/^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/,{$match:_t,Catalog:vt,Unreadable:yt,Version:bt}=u.taggedEnum();function xt(e){let t=e.trim();if(t.startsWith(`catalog:`))return vt({catalog:t.slice(8)||`default`});let n=t.replace(mt,``).replace(ht,``);return gt.test(n)?bt({version:n}):yt()}const I=x.Record(x.String,x.String),St=x.Struct({dependencies:x.optionalKey(I),devDependencies:x.optionalKey(I),name:x.optionalKey(x.String),scripts:x.optionalKey(I),version:x.optionalKey(x.String),workspaces:x.optionalKey(x.Union([x.Array(x.String),x.Struct({packages:x.optionalKey(x.Array(x.String))})]))}),L=(t=r.cwd())=>e.gen(function*(){let n=(yield*o.Path).join(t,`package.json`),r=yield*M(n),i=yield*D(r,n);return yield*x.decodeUnknownEffect(St)(i).pipe(e.mapError(e=>new Ae({issue:e.message,path:n}))),i}),Ct=(t,n)=>e.gen(function*(){let e=(yield*o.Path).join(t,`package.json`),r=yield*M(e);yield*F(e,j(r,n))}),R=[`bun`,`deno`,`npm`,`pnpm`,`yarn`],wt=x.is(x.Literals(R));function Tt(e){return new Intl.ListFormat(`en-US`,{type:e}).format(R)}const z={analyze:{ci:!0,command:`adamantite analyze`,tools:[`knip`,`sherif`]},check:{ci:!0,command:`adamantite check`,tools:[`oxfmt`,`oxlint`]},fix:{ci:!1,command:`adamantite fix`,tools:[`oxfmt`,`oxlint`]}},B=re.map(z,e=>e.command),V=[`check`,`fix`,`analyze`],Et=V.filter(e=>z[e].ci);function Dt(e){return V.filter(t=>Ot([t],e))}function Ot(e,t){return e.some(e=>z[e].tools.includes(t))}function kt(e){let n=e.scripts??{};return d(re.keys(B),t.filter(e=>n[e]===B[e]))}function At(e,n){let r=e.scripts??{};return t.filterMap(n,e=>{let t=r[e];return t!==void 0&&t!==``&&t!==B[e]?l.succeed({command:t,script:e}):l.failVoid})}const jt=x.Struct({packages:x.Array(x.String)}),Mt=x.Union([x.String,x.Finite.pipe(x.decodeTo(x.String,ne.transform({decode:String,encode:Number})))]),H=x.Record(x.String,Mt),Nt=x.Struct({catalog:x.optionalKey(H),catalogs:x.optionalKey(x.Record(x.String,H))}),U=t=>e.try({catch:e=>new C({cause:e,path:`pnpm-workspace.yaml`}),try:()=>te.parse(t)}),Pt=t=>U(t).pipe(e.flatMap(e=>x.decodeUnknownEffect(jt)(e)),e.map(({packages:e})=>e),e.orElseSucceed(()=>[])),Ft=t=>U(t).pipe(e.flatMap(e=>x.decodeUnknownEffect(Nt)(e)),e.map(({catalog:e,catalogs:t={}})=>e===void 0?t:{...t,default:e}),e.orElseSucceed(()=>({}))),W=n=>e.gen(function*(){let r=yield*o.Path,a=yield*N(r.join(n,`pnpm-workspace.yaml`)),[s,c]=i.isSome(a)?yield*e.all([Pt(a.value),Ft(a.value)]):[[],{}];if(s.length>0)return{catalogs:c,patterns:s};let{workspaces:l}=yield*L(n);return{catalogs:c,patterns:(t.isArray(l)?l:l?.packages)??[]}}),G=(t=r.cwd())=>W(t).pipe(e.map(({patterns:e})=>e.length>0));function It(e){return e.replaceAll(/[$()+.[\\\]^{|}]/gu,String.raw`\$&`)}function Lt(e){let t=e.replace(/^\.\//u,``).replace(/\/+$/u,``).split(`/`),n=``;for(let[e,r]of t.entries()){let i=e===0||t[e-1]===`**`?``:`/`;r===`**`?e<t.length-1?n+=`${i}(?:[^/]+/)*`:n+=e===0?`(?:[^/]+(?:/[^/]+)*)?`:`(?:/[^/]+)*`:n+=`${i}${It(r).replaceAll(`*`,`[^/]*`).replaceAll(`?`,`[^/]`)}`}return RegExp(`^${n}$`,`u`)}function Rt(e){let t=e.replace(/^\.\//u,``).replace(/\/+$/u,``).split(`/`),n=t.findIndex(e=>/[*?]/u.test(e));return n===-1?{base:t.join(`/`),depth:0}:{base:t.slice(0,n).join(`/`),depth:t.includes(`**`)?1/0:t.length-n}}const zt=/* @__PURE__ */ new Set([`node_modules`]),Bt=(t,n,r)=>e.gen(function*(){let a=yield*o.Path,s=yield*P(a.resolve(t,n));return i.isNone(s)?[]:r===0?[n]:[n,...(yield*e.forEach(s.value.filter(e=>!e.startsWith(`.`)&&!zt.has(e)),e=>Bt(t,n===``?e:`${n}/${e}`,r-1),{concurrency:`unbounded`})).flat()]}),Vt=(n,r)=>e.gen(function*(){let a=yield*o.Path,s=r.filter(e=>!e.startsWith(`!`)),c=r.flatMap(e=>e.startsWith(`!`)?[Lt(e.slice(1))]:[]),l=yield*e.forEach(s,t=>e.gen(function*(){let{base:e,depth:r}=Rt(t),i=Lt(t);return(yield*Bt(n,e,r)).filter(e=>e!==``&&i.test(e))}),{concurrency:`unbounded`}),u=t.dedupe(l.flat()).filter(e=>!c.some(t=>t.test(e)));return(yield*e.forEach(u,t=>N(a.join(n,t,`package.json`)).pipe(e.map(e=>i.isSome(e)?[a.resolve(n,t)]:[])),{concurrency:`unbounded`})).flat()}),Ht=t=>e.gen(function*(){let{catalogs:e,patterns:n}=yield*W(t);return{catalogs:e,isMonorepo:n.length>0,packageDirectories:yield*Vt(t,n)}}),Ut=`oxlint.js`,Wt=`node_modules/adamantite/dist/${Ut}`,Gt=ie(new URL(Ut,import.meta.url)),Kt=`ADAMANTITE_PROJECT`;function qt(e){return{args:[Gt],command:`node`,cwd:e,env:{[Kt]:e},name:`oxlint`}}function Jt(e,t,n){if(n!==void 0&&n!==``)return n;let r=[e.indexOf(`/node_modules/`),e.indexOf(`\\node_modules\\`)].filter(e=>e!==-1);return r.length===0?t:e.slice(0,Math.min(...r))}var Yt=class extends u.TaggedClass(`Binding`){},Xt=class extends u.TaggedClass(`Backend`){},Zt=class extends u.TaggedClass(`JavaScript`){},K=class extends u.TaggedClass(`Native`){};function q(e){return e}var Qt=class extends a.Service()(`ModuleResolver`){static layer=n.sync(this,()=>{let t=new oe({conditionNames:[`node`,`import`,`default`],extensionAlias:{".cjs":[`.cjs`,`.cts`],".js":[`.js`,`.ts`],".mjs":[`.mjs`,`.mts`]},extensions:[`.ts`,`.mts`,`.cts`,`.js`,`.mjs`,`.cjs`]});return{clearCache:e.sync(()=>{t.clearCache()}),resolve:(n,r)=>e.sync(()=>i.fromUndefinedOr(t.sync(n,r).path))}})};const J=e.fn(`resolvePackageDirectory`)(function*(e,t){let n=yield*o.Path,r=yield*(yield*Qt).resolve(e,`${t}/package.json`);return d(r,i.map(e=>n.dirname(e)))}),$t=`@effect/tsgo`,Y=e.fn(`readVersion`)(function*(e){let{version:t}=yield*L(e);return t??``}),en=e.fn(`findArtifact`)(function*(e,n,r,a,s){let c=yield*o.Path,l=c.join(e,`artifacts`,r),u=yield*P(c.join(l,a)),f=d(u,i.flatMap(e=>t.findFirst(e,e=>s(e))));if(i.isSome(f))return c.join(l,a,f.value);let p=yield*P(l);return yield*new ye({effectVersion:n,supported:t.sort(i.getOrElse(p,()=>[]),ae.String),tool:r,version:a})}),tn=e.fn(`resolveEffectRuntime`)(function*(t,n){let a=yield*J(t,$t);if(i.isNone(a))return[];let o=`${r.platform}-${r.arch}`,s=yield*J(a.value,`${$t}-${o}`);if(i.isNone(s))return yield*new be({platform:o});let c=yield*J(t,`tsrs`);if(i.isNone(c))return yield*new E({packageName:`tsrs`,project:t});let[l,u,d]=yield*e.all([Y(a.value),Y(c.value),Y(n)],{concurrency:`unbounded`}),f=r.platform===`win32`?`tsrs.exe`:`tsrs`,p=yield*en(s.value,l,`tsrs`,u,e=>e===f);return[new Yt({path:yield*en(s.value,l,`oxlint`,d,e=>e.endsWith(`.node`))}),new Xt({env:{EFFECT_TSGO_TSGOLINT_MODE:`tsrs`,EFFECT_TSGO_TSGOLINT_PATH:p}})]}),X=`tsconfig.json`,Z=`@effect/language-service`,Q={diagnostics:!0,name:Z},nn=`${JSON.stringify({compilerOptions:{plugins:[Q]}},null,2)}\n`;function rn(e){return A(e)?e.find(e=>k(e)&&e.name===Z):void 0}const an=e.fn(`assessTsconfigPlugin`)(function*({cwd:t,workspace:n},r){if(n.isMonorepo)return{findings:[],warnings:[`Skipping the root \`${X}\` check for \`${r}\`: in a monorepo, add \`${yield*O(Q)}\` to \`compilerOptions.plugins\` in each package's \`${X}\` or in a shared base config.`]};let a=(yield*o.Path).join(t,X),s=yield*N(a),c=i.isNone(s)?void 0:yield*D(s.value,a).pipe(e.map(e=>k(e)&&k(e.compilerOptions)?rn(e.compilerOptions.plugins):void 0));return c!==void 0&&c.diagnostics!==!1?{findings:[],warnings:[]}:{findings:[{currentState:c===void 0?`\`${X}\` does not configure the \`${Z}\` plugin.`:`The \`${Z}\` plugin in \`${X}\` disables its diagnostics, so semantic quick fixes do not work.`,goal:[`Add \`${yield*O(Q)}\` to \`compilerOptions.plugins\` in \`${X}\`, or set \`diagnostics\` to \`true\` in the existing entry. Keep every other plugin and option.`],id:`missing-effect-language-service-plugin`,integration:r,notes:["The `effecttsgo` rules read their options, such as `allowedUnstableApis`, from this entry.",`The managed editor settings hide duplicate Effect reports from the Oxlint editor service. CLI Oxlint keeps its Effect rules.`],reference:{content:nn,language:`json`},title:`Effect language service is not configured`}],warnings:[]}}),on=e.fn(`updateTsconfigPlugin`)(function*(e){if(yield*G(e))return`monorepo`;let t=(yield*o.Path).join(e,X),n=yield*N(t);if(i.isNone(n))return`missing`;let r=yield*D(n.value,t);if(!k(r))return yield*new T({path:t});let a=r.compilerOptions??{};if(!k(a))return yield*new T({path:t});let s=a.plugins??[];if(!A(s))return yield*new T({path:t});let c=rn(s),l=c?s.map(e=>e===c?{...c,diagnostics:!0}:e):[...s,Q];return yield*F(t,j(n.value,{...r,compilerOptions:{...a,plugins:l}})),`updated`}),sn=`@effect/tsgo`;var cn=q({assess:t=>e.gen(function*(){let e=yield*an(t,sn);return{findings:e.findings,warnings:e.warnings}}),name:sn,runtime:new K({resolve:tn}),update:e=>on(e)}),ln=q({name:`oxlint-plugin-react-doctor`,runtime:new Zt}),un=q({name:`@shadcn/lint`,runtime:new Zt});const $=[{hint:`Check React code, JSX accessibility, and performance.`,label:`react`,name:`react`},{hint:`Keep state, effect, and memo hooks in hook files.`,label:`react-strict`,name:`react-strict`,plugin:ln,requires:[`react`]},{hint:`Use queryOptions() and keep query data out of state.`,label:`tanstack`,name:`tanstack`},{hint:`Check Next.js scripts, fonts, images, and head usage.`,label:`next.js`,name:`nextjs`},{hint:`Check Vue 3 code for errors and deprecated APIs.`,label:`vue`,name:`vue`},{hint:`Find effects that never run.`,label:`effect`,name:`effect`,plugin:cn},{hint:`Find focused or skipped tests and check assertions.`,label:`jest`,name:`jest`},{hint:`Find focused or skipped tests and check assertions.`,label:`vitest`,name:`vitest`},{hint:`Check Node.js callbacks and CommonJS modules.`,label:`node`,name:`node`},{hint:`Check the layer maps and import owners you define.`,label:`architecture`,name:`architecture`},{hint:`Ban type assertions, unknown parameters, module mocks, and TODOs.`,label:`strict`,name:`strict`},{hint:`Check Tailwind v4 classes.`,label:`tailwind`,name:`tailwind`,plugin:un}],dn=$.map(e=>e.name),fn=[`shadcn`,`react-doctor`,`antislop`];function pn(e){let t=[...e.plugin===void 0?[]:[`installs ${e.plugin.name}`],...(e.requires??[]).map(e=>`selects the ${e} preset`)].join(` and `);return t===``?e.hint:`${e.hint} ${t.charAt(0).toUpperCase()}${t.slice(1)}.`}function mn(e){return $.flatMap(t=>e.includes(t.name)&&`requires`in t?t.requires.filter(t=>!e.includes(t)).map(e=>({required:e,requiredBy:t.name})):[])}const hn=$.flatMap(e=>`plugin`in e?[e.plugin]:[]);var gn=class extends u.TaggedClass(`Stock`){},_n=class extends u.TaggedClass(`Replaced`){},vn=class extends u.TaggedClass(`None`){},yn=class extends u.TaggedClass(`Tsrs`){},bn=class extends u.TaggedClass(`Replaced`){};function xn(e){return se.valueTags(e,{None:()=>({}),Replaced:({env:e})=>e,Tsrs:({launcher:e})=>({OXLINT_TSGOLINT_PATH:e})})}const Sn=[`tsrs-lint.cmd`,`tsrs-lint.exe`],Cn=e.fn(`findWindowsLauncher`)(function*(t){let n=yield*y.FileSystem,r=yield*o.Path,i=[];for(let e=t;i.push(...Sn.map(t=>r.join(e,`node_modules`,`.bin`,t))),r.dirname(e)!==e;e=r.dirname(e));return yield*e.findFirst(i,t=>n.exists(t).pipe(e.orElseSucceed(()=>!1)))}),wn=e.fn(`resolveDefaultBackend`)(function*(e){let t=yield*o.Path,n=yield*J(e,`tsrs`),a=i.isNone(n)?i.none():r.platform===`win32`?yield*Cn(e):i.some(t.join(n.value,`bin`,`tsrs-lint`));return i.match(a,{onNone:()=>new vn,onSome:e=>new yn({launcher:e})})}),Tn=e.fn(`resolveOxlintRuntime`)(function*(e,t=hn){let n=yield*J(e,`oxlint`);if(i.isNone(n))return yield*new E({packageName:`oxlint`,project:e});let r=new gn,a,o=/* @__PURE__ */ new Map;for(let i of t){if(!(i.runtime instanceof K))continue;let t=yield*i.runtime.resolve(e,n.value);for(let e of t){let t=o.get(e._tag);if(t!==void 0)return yield*new Be({part:e._tag,plugins:[t,i.name]});o.set(e._tag,i.name),e instanceof Yt?r=new _n({path:e.path}):a=new bn({env:e.env})}}return{backend:a??(yield*wn(e)),binding:r,oxlint:n.value}});export{de as $,kt as A,Ke as At,M as B,Et as C,Ve as Ct,wt as D,Ue as Dt,R as E,He as Et,L as F,A as G,dt as H,Ct as I,et as J,k as K,ft as L,Tt as M,Je as Mt,_t as N,Ot as O,We as Ot,xt as P,fe as Q,ut as R,Ht as S,E as St,V as T,me as Tt,F as U,N as V,pt as W,O as X,D as Y,j as Z,Wt as _,Le as _t,Tn as a,xe as at,Jt as b,Re as bt,dn as c,De as ct,mn as d,Oe as dt,pe as et,$ as f,je as ft,K as g,Pe as gt,J as h,Ne as ht,yn as i,ve as it,Dt as j,qe as jt,At as k,Ge as kt,fn as l,C as lt,Qt as m,T as mt,_n as n,ge as nt,xn as o,Ce as ot,cn as p,Me as pt,Ze as q,gn as r,_e as rt,hn as s,we as st,vn as t,he as tt,pn as u,w as ut,Kt as v,Fe as vt,B as w,ke as wt,G as x,ze as xt,qt as y,Ie as yt,P as z};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adamantite",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "description": "An strict and opinionated set of presets for modern TypeScript applications",
5
5
  "keywords": [
6
6
  "adamantite",
@@ -32,7 +32,6 @@
32
32
  "!skills/_artifacts"
33
33
  ],
34
34
  "type": "module",
35
- "main": "dist/presets/lint/core.js",
36
35
  "imports": {
37
36
  "#*": "./src/*",
38
37
  "#presets/*": "./presets/*"
@@ -50,32 +49,84 @@
50
49
  "types": "./dist/presets/lint/core.d.ts",
51
50
  "default": "./dist/presets/lint/core.js"
52
51
  },
53
- "./lint/*": {
54
- "types": "./dist/presets/lint/*.d.ts",
55
- "default": "./dist/presets/lint/*.js"
52
+ "./lint/architecture": {
53
+ "types": "./dist/presets/lint/architecture.d.ts",
54
+ "default": "./dist/presets/lint/architecture.js"
55
+ },
56
+ "./lint/effect": {
57
+ "types": "./dist/presets/lint/effect.d.ts",
58
+ "default": "./dist/presets/lint/effect.js"
59
+ },
60
+ "./lint/jest": {
61
+ "types": "./dist/presets/lint/jest.d.ts",
62
+ "default": "./dist/presets/lint/jest.js"
63
+ },
64
+ "./lint/nextjs": {
65
+ "types": "./dist/presets/lint/nextjs.d.ts",
66
+ "default": "./dist/presets/lint/nextjs.js"
67
+ },
68
+ "./lint/node": {
69
+ "types": "./dist/presets/lint/node.d.ts",
70
+ "default": "./dist/presets/lint/node.js"
71
+ },
72
+ "./lint/react": {
73
+ "types": "./dist/presets/lint/react.d.ts",
74
+ "default": "./dist/presets/lint/react.js"
75
+ },
76
+ "./lint/react-strict": {
77
+ "types": "./dist/presets/lint/react-strict.d.ts",
78
+ "default": "./dist/presets/lint/react-strict.js"
79
+ },
80
+ "./lint/strict": {
81
+ "types": "./dist/presets/lint/strict.d.ts",
82
+ "default": "./dist/presets/lint/strict.js"
83
+ },
84
+ "./lint/tailwind": {
85
+ "types": "./dist/presets/lint/tailwind.d.ts",
86
+ "default": "./dist/presets/lint/tailwind.js"
87
+ },
88
+ "./lint/tanstack": {
89
+ "types": "./dist/presets/lint/tanstack.d.ts",
90
+ "default": "./dist/presets/lint/tanstack.js"
91
+ },
92
+ "./lint/vitest": {
93
+ "types": "./dist/presets/lint/vitest.d.ts",
94
+ "default": "./dist/presets/lint/vitest.js"
95
+ },
96
+ "./lint/vue": {
97
+ "types": "./dist/presets/lint/vue.d.ts",
98
+ "default": "./dist/presets/lint/vue.js"
56
99
  },
57
100
  "./rules": {
58
101
  "types": "./dist/presets/rules/index.d.ts",
59
102
  "default": "./dist/presets/rules/index.js"
60
103
  },
104
+ "./rules/plugin": {
105
+ "types": "./dist/presets/rules/plugin.d.ts",
106
+ "default": "./dist/presets/rules/plugin.js"
107
+ },
108
+ "./rules/testing": {
109
+ "types": "./dist/presets/rules/testing.d.ts",
110
+ "default": "./dist/presets/rules/testing.js"
111
+ },
61
112
  "./typescript": "./dist/presets/tsconfig.json"
62
113
  },
63
114
  "dependencies": {
64
115
  "@clack/prompts": "1.8.1",
65
- "@effect/platform-node": "4.0.5",
66
- "@effect/platform-node-shared": "4.0.5",
67
- "@oxlint/plugins": "1.88.0",
68
- "defu": "6.1.7",
69
- "effect": "4.0.5",
116
+ "@effect/platform-node": "4.1.2",
117
+ "@effect/platform-node-shared": "4.1.2",
118
+ "@oxlint/plugins": "1.91.0",
119
+ "effect": "4.1.2",
70
120
  "jsonc-parser": "3.3.1",
71
121
  "nypm": "0.6.10",
72
- "oxc-parser": "0.154.0"
122
+ "oxc-parser": "0.154.0",
123
+ "oxc-resolver": "11.24.2"
73
124
  },
74
125
  "devDependencies": {
75
126
  "@changesets/changelog-github": "1.0.1",
76
127
  "@changesets/cli": "3.0.3",
77
- "@effect/tsgo": "0.54.0",
78
- "@effect/vitest": "4.0.5",
128
+ "@effect/tsgo": "0.67.3",
129
+ "@effect/vitest": "4.1.2",
79
130
  "@shadcn/lint": "0.2.1",
80
131
  "@tanstack/intent": "0.5.5",
81
132
  "@types/figlet": "1.7.0",
@@ -84,20 +135,30 @@
84
135
  "@vitest/ui": "5.0.5",
85
136
  "figlet": "1.12.0",
86
137
  "knip": "6.42.0",
87
- "oxfmt": "0.73.0",
88
- "oxlint": "1.88.0",
138
+ "oxfmt": "0.76.0",
139
+ "oxlint": "1.91.0",
89
140
  "oxlint-plugin-react-doctor": "0.9.18",
90
- "oxlint-tsgolint": "7.0.2004",
91
141
  "sherif": "1.13.0",
92
142
  "tsdown": "0.23.1",
143
+ "tsrs": "0.21.0-ts7.1.0-beta",
93
144
  "type-fest": "5.10.0",
94
145
  "typescript": "7.0.2",
95
146
  "unplugin-macros": "0.23.3",
96
147
  "vitest": "5.0.5"
97
148
  },
98
149
  "peerDependencies": {
150
+ "oxlint": ">=1.88.0",
151
+ "tsrs": ">=0.21.0-ts7.1.0-beta",
99
152
  "typescript": ">=7"
100
153
  },
154
+ "peerDependenciesMeta": {
155
+ "oxlint": {
156
+ "optional": true
157
+ },
158
+ "tsrs": {
159
+ "optional": true
160
+ }
161
+ },
101
162
  "engines": {
102
163
  "bun": ">=1.0.0",
103
164
  "node": ">=22.19.0"
@@ -107,9 +168,9 @@
107
168
  "build": "tsdown",
108
169
  "build:verify": "pnpm run build && pnpm run test:build",
109
170
  "bump:deps": "pnpm update --interactive --latest",
110
- "check": "oxlint",
171
+ "check": "node src/oxlint.ts",
111
172
  "dev": "tsdown --watch",
112
- "fix": "oxlint --fix",
173
+ "fix": "node src/oxlint.ts --fix",
113
174
  "format": "oxfmt",
114
175
  "release": "changeset publish",
115
176
  "test": "vitest run",