@r_masseater/msch 0.9.0 → 0.10.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 +2 -34
- package/dist/{cli-contract-DlE7gy0b.mjs → cli-contract-ChzTJ0Na.mjs} +2 -1
- package/dist/{cli-contract-DlE7gy0b.mjs.map → cli-contract-ChzTJ0Na.mjs.map} +1 -1
- package/dist/cli.mjs +176 -75
- package/dist/cli.mjs.map +1 -1
- package/dist/lint.d.mts +8 -1
- package/dist/lint.mjs +49 -30
- package/dist/lint.mjs.map +1 -1
- package/dist/oxlint.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,24 +29,13 @@ export default defineConfig({ lint });
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
リポジトリに固有のルールや overrides は、`lint` を広げてから足す。
|
|
32
|
+
`fsdRules` には、masseater のリポジトリが `fsd.configs.recommended` の後に足す Steiger のルールが入っている。
|
|
32
33
|
decision ルールは呼ぶたびに費用がかかるので、プリセットは有効にしない。
|
|
33
|
-
`import/no-nodejs-modules` は使わず、Effect に代わりのある Node.js の組み込みだけを `effecttsgo/node-builtin-import` で止める。
|
|
34
|
-
`eslint/new-cap` は `capIsNew` を切る。`new` なしでクラスを呼ぶ誤りは型検査が落とすので、大文字で始まる関数の呼び出しを例外として並べずに済む。
|
|
35
34
|
`decisionRules` を掛けたいファイルの overrides に渡す。
|
|
36
35
|
|
|
37
36
|
Vite+ はワークスペースの `vite.config.ts` の `lint` を使わない。
|
|
38
37
|
1 つのワークスペースだけに効く設定は、そのワークスペースの `vite.config.ts` の `msch` にリテラルで書く。
|
|
39
38
|
ルートの `vite.config.ts` は `@r_masseater/msch/workspace-settings` の `workspaceSettings` でそれを読む。
|
|
40
|
-
ワークスペースは `pnpm-workspace.yaml` の `packages` から求める。
|
|
41
|
-
ワークスペースの `vite.config.ts` は実行しないので、アプリの重いプラグインを読み込まずに済む。
|
|
42
|
-
`msch.lint` には overrides と ignorePatterns を書く。読んだパスの前には、ワークスペースのディレクトリが付く。
|
|
43
|
-
`msch.devDependencies` には、ルートが禁じた依存を devDependencies にだけ許す理由を鍵にして、許す依存を書く。
|
|
44
|
-
`use` は、ルートが `workspaceSettings` に渡す `ruleSets` と `dependencySets` の名前を指す。
|
|
45
|
-
import した値が要る規則と依存は、ルートの集合に名前を付けて置く。
|
|
46
|
-
`test` タスクを持たないワークスペースは `testProjects` に入り、ルートの `vp test` が動かす。
|
|
47
|
-
`workspaceSettings` はタスクも返す。`tasks.verify` は、`vite.config.ts` が `verify` タスクを書く各ワークスペースの `verify` タスクを列挙し、ルートの `verify` はそれらに依存する。
|
|
48
|
-
`components.json` の `aliases.ui` は `package.json` の `imports` で解決し、shadcn の部品の置き場を `lint.shadcnUi` として返す。
|
|
49
|
-
`package.json` の `exports` と `bin` が指すファイルは `lint.publicEntries` として返す。`dist` を指す入口は、`pack.entry` から元のファイルをたどる。プラグインや textlint のルールのように、読み込む側が default export を求める入口に使う。
|
|
50
39
|
|
|
51
40
|
`effecttsgo` のルールは、@effect/tsgo が手を入れた oxlint でだけ動く。
|
|
52
41
|
`prepare` で `effect-tsgo patch --typescript --oxlint` を実行するか、`effect-tsgo vp check` で動かす。
|
|
@@ -54,30 +43,9 @@ oxlint のバージョンは、@effect/tsgo が対応するものに合わせる
|
|
|
54
43
|
|
|
55
44
|
## msch の検査
|
|
56
45
|
|
|
57
|
-
リポジトリのルートで `msch`
|
|
58
|
-
外部から読んだ値を Effect Schema で確かめるときは、`satisfies Schema.Decoder<ライブラリの型>` か変数の型注釈でライブラリの型に結びつける。結びつけた Schema は、ライブラリの形の写しとして指摘しない。
|
|
59
|
-
見えない文字は、ゼロ幅の文字・書字方向を変える制御文字・タグ文字のように、エディタやレビューで見えずに意味を変えうる文字で、`git ls-files` に載るテキストのファイルから探す。ファイル先頭の BOM と、NUL を含むバイナリは対象にしない。
|
|
46
|
+
リポジトリのルートで `msch` を実行する。チェックポリシーに従っていない箇所を報告する。
|
|
60
47
|
コメントは、コード・マークアップ・設定・クエリのどれにも書かない。
|
|
61
|
-
msch は `git ls-files` に載るファイルを、その言語のパーサーで読んでコメントを探す。
|
|
62
|
-
TypeScript・JavaScript・Rust・C#・shell・PowerShell・Go・Java・Ruby・PHP・C・C++・シェーダー・CSS は tree-sitter で読む。
|
|
63
|
-
HTML と XML は htmlparser2 で読み、HTML の中のスクリプトとスタイルも調べる。画像の SVG は調べない。
|
|
64
|
-
YAML・TOML・SQL・Dockerfile は、それぞれのパーサーで読む。
|
|
65
48
|
許すのは、ツールが読むコメントだけである。
|
|
66
|
-
`oxlint-disable`・`/** @internal */`・`/** @msch <概念> */` などの lint のディレクティブと、1 行目のシェバンを許す。
|
|
67
|
-
`shellcheck`・`zizmor: ignore[...]`・`renovate:` も許す。
|
|
68
|
-
コミットに固定した action の後ろに書くバージョンと、drizzle の `--> statement-breakpoint` も許す。
|
|
69
|
-
lint のプリセットの `no-comments/disallowComments` も、同じ一覧を許す。
|
|
70
|
-
`.gitattributes` に `linguist-generated` や `linguist-vendored` とマークされたファイルや、ルートの `lint.ignorePatterns` で除外されたファイルは読み込まない。
|
|
71
49
|
リポジトリがコメントから独自のフォーマットを読み込む際は、ルートの `vite.config.ts` の `msch.comments.allow` に、それらのコメント用の正規表現を記述する。各記述は、コメントマーカー以降のテキストと照合される。
|
|
72
|
-
Python は使わない方針なので、`.py`・`pyproject.toml`・`uv.lock` などのファイルを指摘する。スクリプト・CI・設定の中で `python3`・`pip`・`uv`・`poetry` を呼ぶ箇所と、`actions/setup-python` などの action、`mise.toml` に書いた Python の道具も指摘する。
|
|
73
|
-
案内文書は、`AGENTS.md`・`CLAUDE.md` をルートにだけ置かせる。
|
|
74
|
-
ルートの `vite.config.ts` の文字列がワークスペースの中を指していると指摘する。そのワークスペースだけの設定は、そのワークスペースの `vite.config.ts` に移す。
|
|
75
|
-
Cargo のワークスペースがあれば、`verify` タスクを持つワークスペースの中にない crate を指摘する。
|
|
76
|
-
msch は、`vite.config.ts` の `verify` タスクを別のファイル内のコードから取得しているワークスペースを指摘する。ルートの `verify` は `vite.config.ts` を実行せずに読み込むため、その `verify` を一度も実行しないからである。
|
|
77
|
-
ルートの `vite.config.ts` に `msch: { workspaceAgentsMd: true }` と書くと、ワークスペース(`package.json` のあるディレクトリ)の直下にも `AGENTS.md` を置ける。`CLAUDE.md` はルートだけに置く。
|
|
78
|
-
README はルートまたはワークスペースのディレクトリ(`git ls-files` に載る `package.json` が格納されているディレクトリ)でのみ許可される。
|
|
79
|
-
msch は、ワークスペースのパス、ディレクトリ名、パッケージ名のいずれかを記載したルートの README を指摘する。ルートの README はリポジトリ全体について説明し、各ワークスペースの使用方法はそのワークスペースの README に記載する。
|
|
80
|
-
npm に出すワークスペースでは、インストールした側に増える依存の容量を `installSize` の予算と比べる。容量は、`dependencies`・`optionalDependencies`・必須の peer を node_modules からたどった合計で、そのパッケージ自身の `peerDependencies` に書いたものは数えない。予算を超えると、重い順に依存を並べ、公開の入口(`exports` と `bin`)の一部からしか import されないものにはその入口を添える。
|
|
81
|
-
`dependencies` に `catalog:stack` の依存があると、使う側がすでに持っているものとして、`peerDependencies` へ移すよう指摘する。
|
|
82
50
|
`tsconfig.json` の `types` に `@r_masseater/msch/vite` を足すと、`defineConfig` の `msch` に型が付く。
|
|
83
51
|
指摘があれば終了コードは 1 になる。`--json` を付けると結果を JSON で出す。
|
|
@@ -74,6 +74,7 @@ const RuleNameSchema = Schema.Literals([
|
|
|
74
74
|
"unverified-crate",
|
|
75
75
|
"hidden-verify",
|
|
76
76
|
"root-workspace-path",
|
|
77
|
+
"colocated-test",
|
|
77
78
|
"comment"
|
|
78
79
|
]);
|
|
79
80
|
const ProblemSchema = Schema.Struct({
|
|
@@ -112,4 +113,4 @@ const formatProblem = (relative) => (problem) => `${relative(problem.file)}:${St
|
|
|
112
113
|
const JSON_FLAG = "--json";
|
|
113
114
|
export { isTypeAliasDeclaration as $, getTextOfJSDocComment as A, isInterfaceDeclaration as B, API as C, getJSDocTags as D, SyntaxKind as E, isElementAccessExpression as F, isObjectLiteralExpression as G, isModuleDeclaration as H, isEnumDeclaration as I, isSatisfiesExpression as J, isPropertyAccessExpression as K, isExportDeclaration as L, isBinaryExpression as M, isCallExpression as N, getLeadingCommentRanges as O, isClassDeclaration as P, isStringLiteral as Q, isIdentifier as R, uniqueByReference as S, InternalSymbolName as T, isNewExpression as U, isModuleBlock as V, isNumericLiteral as W, isSourceFile as X, isSignatureDeclaration as Y, isSpreadElement as Z, lineOf as _, problemAt as a, isVariableStatement as at, resolvedSymbol as b, childrenOf as c, declarationsOf as d, isTypeLiteralNode as et, descendantsOf as f, isTypeDeclaration as g, isGenericDeclaration as h, formatProblem as i, isVariableDeclarationList as it, isArrayLiteralExpression as j, getNameOfDeclaration as k, columnOf as l, isExternalDeclaration as m, ProblemList as n, isUnionTypeNode as nt, sortProblems as o, importedModulesOf as p, isPropertyAssignment as q, describeFinding as r, isVariableDeclaration as rt, NODE_MODULES_SEGMENT as s, JSON_FLAG as t, isTypeReferenceNode as tt, contains as u, propertyNamesOf as v, IndexKind as w, symbolAt as x, referencedSymbols as y, isImportDeclaration as z };
|
|
114
115
|
|
|
115
|
-
//# sourceMappingURL=cli-contract-
|
|
116
|
+
//# sourceMappingURL=cli-contract-ChzTJ0Na.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-contract-DlE7gy0b.mjs","names":["Arr","Str","Arr"],"sources":["../src/syntax.ts","../src/problem.ts","../src/cli-contract.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isEnumDeclaration,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./dependencies.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nconst POSITION_BASE = 1;\n\nconst uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nconst childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile);\n\nconst isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nconst declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isAliasDeclaration = (declaration: Node): boolean => ALIAS_KINDS.has(declaration.kind);\n\nconst resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nconst symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(\n Option.map(resolvedSymbol(checker)),\n );\n\nconst referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nconst lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nconst columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nconst contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nconst isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nconst propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nconst importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n\nexport {\n NODE_MODULES_SEGMENT,\n POSITION_BASE,\n childrenOf,\n columnOf,\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n isExternalDeclaration,\n isGenericDeclaration,\n isTypeDeclaration,\n lineOf,\n propertyNamesOf,\n referencedSymbols,\n resolvedSymbol,\n symbolAt,\n uniqueByReference,\n};\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.Literals([\n \"owner-annotation\",\n \"duplicate-value-set\",\n \"owner-value-set\",\n \"owner-extension\",\n \"owned-literal\",\n \"library-value-set\",\n \"library-shape\",\n \"unused-override\",\n \"removable-override\",\n \"hidden-unicode\",\n \"python-file\",\n \"python-command\",\n \"nested-docs\",\n \"root-readme\",\n \"stack-dependency\",\n \"install-size\",\n \"unverified-crate\",\n \"hidden-verify\",\n \"root-workspace-path\",\n \"comment\",\n]);\n\ntype RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\ntype Problem = typeof ProblemSchema.Type;\n\nconst ProblemList = Schema.Array(ProblemSchema);\n\nconst CANDIDATE_LIMIT = 3;\n\ninterface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nconst problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nconst sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nconst describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nconst formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n\nexport { CANDIDATE_LIMIT, ProblemList, describeFinding, formatProblem, problemAt, sortProblems };\nexport type { Finding, Problem, RuleName };\n","const JSON_FLAG = \"--json\";\n\nexport { JSON_FLAG };\n"],"mappings":";;;;;;AA0BA,MAAM,uBAAuB,IAAI,aAAa;AAI9C,MAAM,qBAA2B,UAC/BA,MAAI,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAK;AAEvD,MAAM,cAAc,SAAgC;CAClD,MAAM,WAAmB,CAAC;CAC1B,KAAK,cAAc,UAAU;EAC3B,SAAS,KAAK,KAAK;CACrB,CAAC;CACD,OAAO;AACT;AAEA,MAAM,iBAAiB,SACrB,KACE,WAAW,IAAI,GACfA,MAAI,SAAS,UAAUA,MAAI,QAAQ,cAAc,KAAK,GAAG,KAAK,CAAC,CACjE;AAEF,MAAM,kBACH,aACA,eACCC,SAAI,SAAS,oBAAoB,CAAC,CAAC,WAAW,QAAQ,KACtD,QAAQ,gCAAgC,UAAU;AAEtD,MAAM,yBACH,aACA,gBACC,eAAe,OAAO,CAAC,CAAC,YAAY,cAAc,CAAC;AAEvD,MAAM,8BAAuC,IAAI,IAAI;CACnD,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC;AAED,MAAM,kBAAkB,WACtB,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QAAQ,MAAM;CACjE,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,IAAI;CAC/D,MAAM,SAAS,MAAM,SAAS,YAAqB,QAAQ,OAAO;AACpE,CAAC;AAED,MAAM,cAAc,YAClB,KACE;CAAC,QAAQ;CAAM,OAAO,QAAQ,IAAI;CAAG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,MAAM,gBAAgB,aACpBA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAM,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAEnF,MAAM,iBACH,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO;;ACpF1G,MAAM,YAAY"}
|
|
1
|
+
{"version":3,"file":"cli-contract-ChzTJ0Na.mjs","names":["Arr","Str","Arr"],"sources":["../src/syntax.ts","../src/problem.ts","../src/cli-contract.ts"],"sourcesContent":["import { Array as Arr, Option, String as Str, pipe } from \"effect\";\n\nimport {\n isEnumDeclaration,\n isExportDeclaration,\n isIdentifier,\n isImportDeclaration,\n isInterfaceDeclaration,\n isStringLiteral,\n isTypeAliasDeclaration,\n SyntaxKind,\n} from \"./compiler.ts\";\nimport type {\n Checker,\n Declaration,\n EnumDeclaration,\n InterfaceDeclaration,\n Node,\n Program,\n SourceFile,\n TypeSymbol,\n Type,\n TypeAliasDeclaration,\n} from \"./compiler.ts\";\nimport { NODE_MODULES } from \"./dependencies.ts\";\n\nconst NODE_MODULES_SEGMENT = `/${NODE_MODULES}/`;\n\nconst POSITION_BASE = 1;\n\nconst uniqueByReference = <Item>(items: readonly Item[]): readonly Item[] =>\n Arr.dedupeWith(items, (left, right) => left === right);\n\nconst childrenOf = (node: Node): readonly Node[] => {\n const children: Node[] = [];\n node.forEachChild((child) => {\n children.push(child);\n });\n return children;\n};\n\nconst descendantsOf = (node: Node): readonly Node[] =>\n pipe(\n childrenOf(node),\n Arr.flatMap((child) => Arr.prepend(descendantsOf(child), child)),\n );\n\nconst isExternalFile =\n (program: Program) =>\n (sourceFile: SourceFile): boolean =>\n Str.includes(NODE_MODULES_SEGMENT)(sourceFile.fileName) ||\n program.isSourceFileFromExternalLibrary(sourceFile);\n\nconst isExternalDeclaration =\n (program: Program) =>\n (declaration: Node): boolean =>\n isExternalFile(program)(declaration.getSourceFile());\n\nconst ALIAS_KINDS: ReadonlySet<SyntaxKind> = new Set([\n SyntaxKind.ImportSpecifier,\n SyntaxKind.ImportClause,\n SyntaxKind.NamespaceImport,\n SyntaxKind.ExportSpecifier,\n SyntaxKind.ImportEqualsDeclaration,\n SyntaxKind.ExportAssignment,\n]);\n\nconst declarationsOf = (symbol: TypeSymbol): readonly Declaration[] =>\n pipe(\n symbol.declarations,\n Arr.flatMap((handle) => Option.toArray(Option.fromUndefinedOr(handle.resolve()))),\n );\n\nconst isAliasDeclaration = (declaration: Node): boolean => ALIAS_KINDS.has(declaration.kind);\n\nconst resolvedSymbol =\n (checker: Checker) =>\n (symbol: TypeSymbol): TypeSymbol => {\n if (\n !pipe(\n declarationsOf(symbol),\n Arr.some((declaration) => isAliasDeclaration(declaration)),\n )\n ) {\n return symbol;\n }\n return checker.getAliasedSymbol(symbol);\n };\n\nconst symbolAt =\n (checker: Checker) =>\n (node: Node): Option.Option<TypeSymbol> =>\n Option.fromUndefinedOr(checker.getSymbolAtLocation(node)).pipe(\n Option.map(resolvedSymbol(checker)),\n );\n\nconst referencedSymbols =\n (checker: Checker) =>\n (node: Node): readonly TypeSymbol[] => {\n const identifiers = pipe(\n Arr.prepend(descendantsOf(node), node),\n Arr.filter((candidate) => isIdentifier(candidate)),\n );\n const symbols = pipe(\n checker.getSymbolAtLocation(identifiers),\n Arr.flatMap((symbol) => Option.toArray(Option.fromUndefinedOr(symbol))),\n Arr.map(resolvedSymbol(checker)),\n );\n return uniqueByReference(symbols);\n };\n\nconst lineOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + POSITION_BASE;\n};\n\nconst columnOf = (node: Node): number => {\n const sourceFile = node.getSourceFile();\n return (\n sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).character + POSITION_BASE\n );\n};\n\nconst contains =\n (outer: Node) =>\n (inner: Node): boolean =>\n outer.getSourceFile().fileName === inner.getSourceFile().fileName &&\n outer.getStart() <= inner.getStart() &&\n inner.getEnd() <= outer.getEnd();\n\nconst isTypeDeclaration = (\n declaration: Node,\n): declaration is TypeAliasDeclaration | InterfaceDeclaration | EnumDeclaration =>\n isTypeAliasDeclaration(declaration) ||\n isInterfaceDeclaration(declaration) ||\n isEnumDeclaration(declaration);\n\nconst isGenericDeclaration = (declaration: Node): boolean =>\n (isTypeAliasDeclaration(declaration) || isInterfaceDeclaration(declaration)) &&\n Arr.isReadonlyArrayNonEmpty(declaration.typeParameters ?? []);\n\nconst propertyNamesOf =\n (checker: Checker) =>\n (type: Type): readonly string[] =>\n pipe(\n checker.getPropertiesOfType(type),\n Arr.map((property) => property.name),\n );\n\nconst moduleSpecifierOf = (statement: Node): Option.Option<string> => {\n if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) {\n return Option.none();\n }\n return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(\n Option.filter((specifier) => isStringLiteral(specifier)),\n Option.map((specifier) => specifier.text),\n );\n};\n\nconst importedModulesOf = (sourceFile: SourceFile): readonly string[] =>\n pipe(\n sourceFile.statements,\n Arr.map((statement) => moduleSpecifierOf(statement)),\n Arr.getSomes,\n );\n\nexport {\n NODE_MODULES_SEGMENT,\n POSITION_BASE,\n childrenOf,\n columnOf,\n contains,\n declarationsOf,\n descendantsOf,\n importedModulesOf,\n isExternalDeclaration,\n isGenericDeclaration,\n isTypeDeclaration,\n lineOf,\n propertyNamesOf,\n referencedSymbols,\n resolvedSymbol,\n symbolAt,\n uniqueByReference,\n};\n","import { Array as Arr, Order, Schema, pipe } from \"effect\";\n\nimport type { Node } from \"./compiler.ts\";\nimport { columnOf, lineOf } from \"./syntax.ts\";\n\nconst RuleNameSchema = Schema.Literals([\n \"owner-annotation\",\n \"duplicate-value-set\",\n \"owner-value-set\",\n \"owner-extension\",\n \"owned-literal\",\n \"library-value-set\",\n \"library-shape\",\n \"unused-override\",\n \"removable-override\",\n \"hidden-unicode\",\n \"python-file\",\n \"python-command\",\n \"nested-docs\",\n \"root-readme\",\n \"stack-dependency\",\n \"install-size\",\n \"unverified-crate\",\n \"hidden-verify\",\n \"root-workspace-path\",\n \"colocated-test\",\n \"comment\",\n]);\n\ntype RuleName = typeof RuleNameSchema.Type;\n\nconst ProblemSchema = Schema.Struct({\n file: Schema.String,\n line: Schema.Int,\n column: Schema.Int,\n rule: RuleNameSchema,\n message: Schema.String,\n});\n\ntype Problem = typeof ProblemSchema.Type;\n\nconst ProblemList = Schema.Array(ProblemSchema);\n\nconst CANDIDATE_LIMIT = 3;\n\ninterface Finding {\n readonly rule: RuleName;\n readonly message: string;\n}\n\nconst problemAt =\n ({ rule, message }: Finding) =>\n (node: Node): Problem => ({\n file: node.getSourceFile().fileName,\n line: lineOf(node),\n column: columnOf(node),\n rule,\n message,\n });\n\nconst problemOrder: Order.Order<Problem> = Order.combineAll([\n Order.mapInput(Order.String, (problem: Problem) => problem.file),\n Order.mapInput(Order.Number, (problem: Problem) => problem.line),\n Order.mapInput(Order.Number, (problem: Problem) => problem.column),\n Order.mapInput(Order.String, (problem: Problem) => problem.rule),\n Order.mapInput(Order.String, (problem: Problem) => problem.message),\n]);\n\nconst problemKey = (problem: Problem): string =>\n pipe(\n [problem.file, String(problem.line), String(problem.column), problem.rule, problem.message],\n Arr.join(\"\\0\"),\n );\n\nconst sortProblems = (problems: readonly Problem[]): readonly Problem[] =>\n Arr.sort(\n Arr.dedupeWith(problems, (left, right) => problemKey(left) === problemKey(right)),\n problemOrder,\n );\n\nconst describeFinding = (problem: Problem): string => `[${problem.rule}] ${problem.message}`;\n\nconst formatProblem =\n (relative: (file: string) => string) =>\n (problem: Problem): string =>\n `${relative(problem.file)}:${String(problem.line)}:${String(problem.column)} ${describeFinding(problem)}`;\n\nexport { CANDIDATE_LIMIT, ProblemList, describeFinding, formatProblem, problemAt, sortProblems };\nexport type { Finding, Problem, RuleName };\n","const JSON_FLAG = \"--json\";\n\nexport { JSON_FLAG };\n"],"mappings":";;;;;;AA0BA,MAAM,uBAAuB,IAAI,aAAa;AAI9C,MAAM,qBAA2B,UAC/BA,MAAI,WAAW,QAAQ,MAAM,UAAU,SAAS,KAAK;AAEvD,MAAM,cAAc,SAAgC;CAClD,MAAM,WAAmB,CAAC;CAC1B,KAAK,cAAc,UAAU;EAC3B,SAAS,KAAK,KAAK;CACrB,CAAC;CACD,OAAO;AACT;AAEA,MAAM,iBAAiB,SACrB,KACE,WAAW,IAAI,GACfA,MAAI,SAAS,UAAUA,MAAI,QAAQ,cAAc,KAAK,GAAG,KAAK,CAAC,CACjE;AAEF,MAAM,kBACH,aACA,eACCC,SAAI,SAAS,oBAAoB,CAAC,CAAC,WAAW,QAAQ,KACtD,QAAQ,gCAAgC,UAAU;AAEtD,MAAM,yBACH,aACA,gBACC,eAAe,OAAO,CAAC,CAAC,YAAY,cAAc,CAAC;AAEvD,MAAM,8BAAuC,IAAI,IAAI;CACnD,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC;AAED,MAAM,kBAAkB,WACtB,KACE,OAAO,cACPD,MAAI,SAAS,WAAW,OAAO,QAAQ,OAAO,gBAAgB,OAAO,QAAQ,CAAC,CAAC,CAAC,CAClF;AAEF,MAAM,sBAAsB,gBAA+B,YAAY,IAAI,YAAY,IAAI;AAE3F,MAAM,kBACH,aACA,WAAmC;CAClC,IACE,CAAC,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AG,OAAO,QAAQ,MAAM;CAAG,QAAQ;CAAM,QAAQ;AAAO,GAC1FE,MAAI,KAAK,IAAI,CACf;AAEF,MAAM,gBAAgB,aACpBA,MAAI,KACFA,MAAI,WAAW,WAAW,MAAM,UAAU,WAAW,IAAI,MAAM,WAAW,KAAK,CAAC,GAChF,YACF;AAEF,MAAM,mBAAmB,YAA6B,IAAI,QAAQ,KAAK,IAAI,QAAQ;AAEnF,MAAM,iBACH,cACA,YACC,GAAG,SAAS,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,IAAI,EAAE,GAAG,OAAO,QAAQ,MAAM,EAAE,GAAG,gBAAgB,OAAO;;ACrF1G,MAAM,YAAY"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as isTypeAliasDeclaration, A as getTextOfJSDocComment, B as isInterfaceDeclaration, C as API, D as getJSDocTags, E as SyntaxKind, F as isElementAccessExpression, G as isObjectLiteralExpression, H as isModuleDeclaration, I as isEnumDeclaration, J as isSatisfiesExpression, K as isPropertyAccessExpression, L as isExportDeclaration, M as isBinaryExpression, N as isCallExpression, O as getLeadingCommentRanges, P as isClassDeclaration, Q as isStringLiteral, R as isIdentifier, S as uniqueByReference, T as InternalSymbolName, U as isNewExpression, V as isModuleBlock, W as isNumericLiteral, X as isSourceFile, Y as isSignatureDeclaration, Z as isSpreadElement, _ as lineOf, a as problemAt, at as isVariableStatement, b as resolvedSymbol, c as childrenOf$2, d as declarationsOf, et as isTypeLiteralNode, f as descendantsOf, g as isTypeDeclaration, h as isGenericDeclaration, i as formatProblem, it as isVariableDeclarationList, j as isArrayLiteralExpression, k as getNameOfDeclaration, l as columnOf, m as isExternalDeclaration, n as ProblemList, nt as isUnionTypeNode, o as sortProblems, p as importedModulesOf, q as isPropertyAssignment, rt as isVariableDeclaration, s as NODE_MODULES_SEGMENT, tt as isTypeReferenceNode, u as contains, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isImportDeclaration } from "./cli-contract-
|
|
2
|
+
import { $ as isTypeAliasDeclaration, A as getTextOfJSDocComment, B as isInterfaceDeclaration, C as API, D as getJSDocTags, E as SyntaxKind, F as isElementAccessExpression, G as isObjectLiteralExpression, H as isModuleDeclaration, I as isEnumDeclaration, J as isSatisfiesExpression, K as isPropertyAccessExpression, L as isExportDeclaration, M as isBinaryExpression, N as isCallExpression, O as getLeadingCommentRanges, P as isClassDeclaration, Q as isStringLiteral, R as isIdentifier, S as uniqueByReference, T as InternalSymbolName, U as isNewExpression, V as isModuleBlock, W as isNumericLiteral, X as isSourceFile, Y as isSignatureDeclaration, Z as isSpreadElement, _ as lineOf, a as problemAt, at as isVariableStatement, b as resolvedSymbol, c as childrenOf$2, d as declarationsOf, et as isTypeLiteralNode, f as descendantsOf, g as isTypeDeclaration, h as isGenericDeclaration, i as formatProblem, it as isVariableDeclarationList, j as isArrayLiteralExpression, k as getNameOfDeclaration, l as columnOf, m as isExternalDeclaration, n as ProblemList, nt as isUnionTypeNode, o as sortProblems, p as importedModulesOf, q as isPropertyAssignment, rt as isVariableDeclaration, s as NODE_MODULES_SEGMENT, tt as isTypeReferenceNode, u as contains, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isImportDeclaration } from "./cli-contract-ChzTJ0Na.mjs";
|
|
3
3
|
import { a as workspaceDependencies, c as nodeServicesLayer, i as readManifest, n as NODE_MODULES, o as RepositoryFiles, r as dependencyEntries, s as nodeRepositoryFiles, t as MANIFEST_FILE } from "./dependencies-x3j9tLcR.mjs";
|
|
4
4
|
import { _ as publishedWorkspaces, c as programOf, d as childrenOf$3, i as hasVerifyTask, m as workspaceDirectories, n as VERIFY_TASK, r as definesTask, v as publicEntriesOf } from "./workspace-tasks-CRL-gm__.mjs";
|
|
5
5
|
import { t as COMMENT_DIRECTIVES } from "./comment-directives-DApQXgQf.mjs";
|
|
@@ -167,7 +167,7 @@ const scanned = (owners, problems) => ({
|
|
|
167
167
|
owners,
|
|
168
168
|
problems
|
|
169
169
|
});
|
|
170
|
-
const ownerOf = (project) => (annotated) => {
|
|
170
|
+
const ownerOf$1 = (project) => (annotated) => {
|
|
171
171
|
const { node, conceptId } = annotated;
|
|
172
172
|
if (!isModuleConst(node)) return scanned([], [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)]);
|
|
173
173
|
if (conceptId === "") return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);
|
|
@@ -201,7 +201,7 @@ const conflictProblems = (owners) => pipe(owners, Array.flatMap((owner, index) =
|
|
|
201
201
|
return [...pipe(Array.take(sameConcept, FIRST_OWNER_COUNT), Array.map(() => ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner))), ...pipe(Array.take(sameSet, FIRST_OWNER_COUNT), Array.map((other) => ownerProblem(`The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`)(owner)))];
|
|
202
202
|
}));
|
|
203
203
|
const ownersIn = (project) => {
|
|
204
|
-
const results = pipe(project.sourceFiles, Array.flatMap((sourceFile) => pipe(annotatedIn(sourceFile), Array.map((annotated) => ownerOf(project)(annotated)))));
|
|
204
|
+
const results = pipe(project.sourceFiles, Array.flatMap((sourceFile) => pipe(annotatedIn(sourceFile), Array.map((annotated) => ownerOf$1(project)(annotated)))));
|
|
205
205
|
return scanned(pipe(results, Array.flatMap((result) => result.owners)), pipe(results, Array.flatMap((result) => result.problems)));
|
|
206
206
|
};
|
|
207
207
|
const combineOwnerScans = (scans) => {
|
|
@@ -913,7 +913,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
913
913
|
peerDependencies: DependencyMap,
|
|
914
914
|
peerDependenciesMeta: PeerMeta
|
|
915
915
|
});
|
|
916
|
-
const decodeManifest = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
916
|
+
const decodeManifest$1 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
917
917
|
const keysOf$1 = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
918
918
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
919
919
|
const installedNames = (manifest) => [
|
|
@@ -924,7 +924,7 @@ const installedNames = (manifest) => [
|
|
|
924
924
|
const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
925
925
|
const files = yield* RepositoryFiles;
|
|
926
926
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));
|
|
927
|
-
return pipe(text, Option.flatMap(decodeManifest), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
927
|
+
return pipe(text, Option.flatMap(decodeManifest$1), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
928
928
|
});
|
|
929
929
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
930
930
|
const files = yield* RepositoryFiles;
|
|
@@ -1111,72 +1111,6 @@ const checkPublishedPackages = Effect.fn("checkPublishedPackages")(function* che
|
|
|
1111
1111
|
const found = yield* pipe(workspaces, Effect.forEach(workspaceProblems));
|
|
1112
1112
|
return Array.flatten(found);
|
|
1113
1113
|
});
|
|
1114
|
-
// src/nested-docs.ts
|
|
1115
|
-
const RULE$6 = "nested-docs";
|
|
1116
|
-
const CONFIG_FILE$4 = "vite.config.ts";
|
|
1117
|
-
const SEPARATOR$2 = "/";
|
|
1118
|
-
const FIRST$3 = 1;
|
|
1119
|
-
const READ_CONCURRENCY$6 = 64;
|
|
1120
|
-
const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
1121
|
-
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
1122
|
-
const README$1 = /^README(?:\.[^/]+)?$/iu;
|
|
1123
|
-
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1124
|
-
const taggedError$4 = Schema.TaggedError;
|
|
1125
|
-
var RootConfigUnreadable = class extends taggedError$4()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1126
|
-
const isNested = (name) => String$1.includes(SEPARATOR$2)(name);
|
|
1127
|
-
const problemFor$1 = (file, message) => ({
|
|
1128
|
-
file,
|
|
1129
|
-
line: FIRST$3,
|
|
1130
|
-
column: FIRST$3,
|
|
1131
|
-
rule: RULE$6,
|
|
1132
|
-
message
|
|
1133
|
-
});
|
|
1134
|
-
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1135
|
-
const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
|
|
1136
|
-
const README_MESSAGE = "is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.";
|
|
1137
|
-
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
1138
|
-
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$1(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
1139
|
-
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1140
|
-
return Option.some(problemFor$1(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
1141
|
-
};
|
|
1142
|
-
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
1143
|
-
if (!README$1.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1144
|
-
return Option.some(problemFor$1(file, `${base} ${README_MESSAGE}`));
|
|
1145
|
-
};
|
|
1146
|
-
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
1147
|
-
const files = yield* RepositoryFiles;
|
|
1148
|
-
const file = files.join(root, name);
|
|
1149
|
-
const doc = {
|
|
1150
|
-
file,
|
|
1151
|
-
base: files.basename(name),
|
|
1152
|
-
directory: files.dirname(file)
|
|
1153
|
-
};
|
|
1154
|
-
if (AGENT_DOCS.test(doc.base)) return agentDocProblem(doc, allowed);
|
|
1155
|
-
return readmeProblem(doc, allowed);
|
|
1156
|
-
});
|
|
1157
|
-
const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function* allowsWorkspaceAgentDocs(root) {
|
|
1158
|
-
const files = yield* RepositoryFiles;
|
|
1159
|
-
const file = files.join(root, CONFIG_FILE$4);
|
|
1160
|
-
if (!(yield* files.exists(file))) return false;
|
|
1161
|
-
const config = yield* Effect.tryPromise({
|
|
1162
|
-
try: () => resolveConfigFromFile(file),
|
|
1163
|
-
catch: () => RootConfigUnreadable.make({ file })
|
|
1164
|
-
}).pipe(Effect.option);
|
|
1165
|
-
return pipe(config, Option.flatMap(Schema.decodeUnknownOption(RootConfig$1)), Option.isSome);
|
|
1166
|
-
});
|
|
1167
|
-
/** @internal */
|
|
1168
|
-
const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(root) {
|
|
1169
|
-
const files = yield* RepositoryFiles;
|
|
1170
|
-
const names = yield* files.listedFiles(root);
|
|
1171
|
-
const nested = pipe(names, Array.filter(isNested));
|
|
1172
|
-
const workspaceAgentDocs = yield* allowsWorkspaceAgentDocs(root);
|
|
1173
|
-
const allowed = {
|
|
1174
|
-
workspaces: pipe(nested, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map((name) => files.dirname(files.join(root, name))), HashSet.fromIterable),
|
|
1175
|
-
workspaceAgentDocs
|
|
1176
|
-
};
|
|
1177
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$2(root, allowed, name), { concurrency: READ_CONCURRENCY$6 });
|
|
1178
|
-
return Array.getSomes(found);
|
|
1179
|
-
});
|
|
1180
1114
|
// src/override-findings.ts
|
|
1181
1115
|
const describeVersions = (versions) => Option.getOrElse(Option.liftPredicate(Array.join(versions, ","), (joined) => joined !== ""), () => "-");
|
|
1182
1116
|
const describeChanges = (report) => {
|
|
@@ -1368,8 +1302,8 @@ const RESOLUTION_FILES = [
|
|
|
1368
1302
|
];
|
|
1369
1303
|
const RESOLUTION_CONCURRENCY = 4;
|
|
1370
1304
|
const SUCCEEDED = 0;
|
|
1371
|
-
const taggedError$
|
|
1372
|
-
var OverrideResolutionFailed = class extends taggedError$
|
|
1305
|
+
const taggedError$4 = Schema.TaggedError;
|
|
1306
|
+
var OverrideResolutionFailed = class extends taggedError$4()("OverrideResolutionFailed", {
|
|
1373
1307
|
override: Schema.String,
|
|
1374
1308
|
output: Schema.String
|
|
1375
1309
|
}) {};
|
|
@@ -1471,6 +1405,164 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
1471
1405
|
if (Option.isNone(manifest) || !Array.isReadonlyArrayNonEmpty(keys)) return [];
|
|
1472
1406
|
return yield* problemsFor(root, manifest.value, keys);
|
|
1473
1407
|
});
|
|
1408
|
+
// src/colocated-tests.ts
|
|
1409
|
+
const RULE$7 = "colocated-test";
|
|
1410
|
+
const FIRST$4 = 1;
|
|
1411
|
+
const READ_CONCURRENCY$7 = 64;
|
|
1412
|
+
const ROOT_SUBPATH = ".";
|
|
1413
|
+
const NAME_GROUP = "name";
|
|
1414
|
+
const SPECIFIER_GROUP = "specifier";
|
|
1415
|
+
const SCRIPT = /\.[cm]?[jt]sx?$/u;
|
|
1416
|
+
const TEST_FILE = /\.test\.[cm]?[jt]sx?$/u;
|
|
1417
|
+
const MANIFEST_NAME = /package\.json$/u;
|
|
1418
|
+
const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?|specs?)\//u;
|
|
1419
|
+
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
1420
|
+
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
1421
|
+
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
1422
|
+
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
1423
|
+
const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
|
|
1424
|
+
const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
|
|
1425
|
+
const Manifest = Schema.Struct({
|
|
1426
|
+
name: Schema.optional(Schema.String),
|
|
1427
|
+
exports: Schema.optional(Schema.Unknown)
|
|
1428
|
+
});
|
|
1429
|
+
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
1430
|
+
const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1431
|
+
const problemFor$2 = (test, message) => ({
|
|
1432
|
+
file: test.file,
|
|
1433
|
+
line: FIRST$4,
|
|
1434
|
+
column: FIRST$4,
|
|
1435
|
+
rule: RULE$7,
|
|
1436
|
+
message: `${test.base} ${message}`
|
|
1437
|
+
});
|
|
1438
|
+
const groupsOf = (source, pattern, group) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array.getSomes);
|
|
1439
|
+
const namesSibling = (source) => pipe([...groupsOf(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE.test(name)));
|
|
1440
|
+
const ownerOf = (packages, name) => {
|
|
1441
|
+
const owners = pipe(packages, Array.filter((directory) => String$1.startsWith(directory)(name)));
|
|
1442
|
+
return Array.last(Array.sort(owners, byLength));
|
|
1443
|
+
};
|
|
1444
|
+
const specifiersBeside = ({ join, dirname, directory }) => (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.map((name) => pipe(publicEntriesOf({
|
|
1445
|
+
manifest,
|
|
1446
|
+
join,
|
|
1447
|
+
packEntries: []
|
|
1448
|
+
}), Array.filter(({ source }) => dirname(source) === directory), Array.map(({ label }) => String$1.replace(ROOT_SUBPATH, name)(label)))), Option.getOrElse(() => []));
|
|
1449
|
+
const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context, test) {
|
|
1450
|
+
const files = yield* RepositoryFiles;
|
|
1451
|
+
const owner = ownerOf(context.packages, test.name);
|
|
1452
|
+
if (Option.isNone(owner)) return [];
|
|
1453
|
+
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));
|
|
1454
|
+
const join = (target) => files.join(context.root, owner.value, target);
|
|
1455
|
+
return pipe(text, Option.flatMap(decodeManifest), Option.map(specifiersBeside({
|
|
1456
|
+
join,
|
|
1457
|
+
dirname: files.dirname,
|
|
1458
|
+
directory: test.directory
|
|
1459
|
+
})), Option.getOrElse(() => []));
|
|
1460
|
+
});
|
|
1461
|
+
const refersToOwnDirectory = Effect.fn("refersToOwnDirectory")(function* refersToOwnDirectory(context, test, source) {
|
|
1462
|
+
if (namesSibling(source)) return true;
|
|
1463
|
+
const specifiers = groupsOf(source, MODULE_SPECIFIER, SPECIFIER_GROUP);
|
|
1464
|
+
if (Array.isReadonlyArrayEmpty(specifiers)) return false;
|
|
1465
|
+
const own = yield* ownSpecifiers(context, test);
|
|
1466
|
+
return pipe(specifiers, Array.some((specifier) => pipe(own, Array.contains(specifier))));
|
|
1467
|
+
});
|
|
1468
|
+
const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
1469
|
+
const source = yield* (yield* RepositoryFiles).readFile(test.file);
|
|
1470
|
+
if (Option.isNone(source)) return true;
|
|
1471
|
+
return yield* refersToOwnDirectory(context, test, source.value);
|
|
1472
|
+
});
|
|
1473
|
+
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
1474
|
+
if (SEPARATE_TEST_DIRECTORY.test(test.name)) return Option.some(problemFor$2(test, DIRECTORY_MESSAGE));
|
|
1475
|
+
if (!TEST_FILE.test(test.name)) return Option.none();
|
|
1476
|
+
if (yield* refersIn(context, test)) return Option.none();
|
|
1477
|
+
return Option.some(problemFor$2(test, SIBLING_MESSAGE));
|
|
1478
|
+
});
|
|
1479
|
+
/** @internal */
|
|
1480
|
+
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
1481
|
+
const files = yield* RepositoryFiles;
|
|
1482
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED);
|
|
1483
|
+
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
1484
|
+
const context = {
|
|
1485
|
+
root,
|
|
1486
|
+
packages: pipe(names, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map(String$1.replace(MANIFEST_NAME, "")))
|
|
1487
|
+
};
|
|
1488
|
+
const tests = pipe(names, Array.filter((name) => SCRIPT.test(name)), Array.map((name) => {
|
|
1489
|
+
const file = files.join(root, name);
|
|
1490
|
+
return {
|
|
1491
|
+
name,
|
|
1492
|
+
base: files.basename(name),
|
|
1493
|
+
file,
|
|
1494
|
+
directory: files.dirname(file)
|
|
1495
|
+
};
|
|
1496
|
+
}));
|
|
1497
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$3(context, test), { concurrency: READ_CONCURRENCY$7 });
|
|
1498
|
+
return Array.getSomes(found);
|
|
1499
|
+
});
|
|
1500
|
+
// src/nested-docs.ts
|
|
1501
|
+
const RULE$6 = "nested-docs";
|
|
1502
|
+
const CONFIG_FILE$4 = "vite.config.ts";
|
|
1503
|
+
const SEPARATOR$2 = "/";
|
|
1504
|
+
const FIRST$3 = 1;
|
|
1505
|
+
const READ_CONCURRENCY$6 = 64;
|
|
1506
|
+
const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
1507
|
+
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
1508
|
+
const README$1 = /^README(?:\.[^/]+)?$/iu;
|
|
1509
|
+
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1510
|
+
const taggedError$3 = Schema.TaggedError;
|
|
1511
|
+
var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1512
|
+
const isNested = (name) => String$1.includes(SEPARATOR$2)(name);
|
|
1513
|
+
const problemFor$1 = (file, message) => ({
|
|
1514
|
+
file,
|
|
1515
|
+
line: FIRST$3,
|
|
1516
|
+
column: FIRST$3,
|
|
1517
|
+
rule: RULE$6,
|
|
1518
|
+
message
|
|
1519
|
+
});
|
|
1520
|
+
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1521
|
+
const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
|
|
1522
|
+
const README_MESSAGE = "is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.";
|
|
1523
|
+
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
1524
|
+
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$1(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
1525
|
+
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1526
|
+
return Option.some(problemFor$1(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
1527
|
+
};
|
|
1528
|
+
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
1529
|
+
if (!README$1.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1530
|
+
return Option.some(problemFor$1(file, `${base} ${README_MESSAGE}`));
|
|
1531
|
+
};
|
|
1532
|
+
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
1533
|
+
const files = yield* RepositoryFiles;
|
|
1534
|
+
const file = files.join(root, name);
|
|
1535
|
+
const doc = {
|
|
1536
|
+
file,
|
|
1537
|
+
base: files.basename(name),
|
|
1538
|
+
directory: files.dirname(file)
|
|
1539
|
+
};
|
|
1540
|
+
if (AGENT_DOCS.test(doc.base)) return agentDocProblem(doc, allowed);
|
|
1541
|
+
return readmeProblem(doc, allowed);
|
|
1542
|
+
});
|
|
1543
|
+
const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function* allowsWorkspaceAgentDocs(root) {
|
|
1544
|
+
const files = yield* RepositoryFiles;
|
|
1545
|
+
const file = files.join(root, CONFIG_FILE$4);
|
|
1546
|
+
if (!(yield* files.exists(file))) return false;
|
|
1547
|
+
const config = yield* Effect.tryPromise({
|
|
1548
|
+
try: () => resolveConfigFromFile(file),
|
|
1549
|
+
catch: () => RootConfigUnreadable.make({ file })
|
|
1550
|
+
}).pipe(Effect.option);
|
|
1551
|
+
return pipe(config, Option.flatMap(Schema.decodeUnknownOption(RootConfig$1)), Option.isSome);
|
|
1552
|
+
});
|
|
1553
|
+
/** @internal */
|
|
1554
|
+
const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(root) {
|
|
1555
|
+
const files = yield* RepositoryFiles;
|
|
1556
|
+
const names = yield* files.listedFiles(root);
|
|
1557
|
+
const nested = pipe(names, Array.filter(isNested));
|
|
1558
|
+
const workspaceAgentDocs = yield* allowsWorkspaceAgentDocs(root);
|
|
1559
|
+
const allowed = {
|
|
1560
|
+
workspaces: pipe(nested, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map((name) => files.dirname(files.join(root, name))), HashSet.fromIterable),
|
|
1561
|
+
workspaceAgentDocs
|
|
1562
|
+
};
|
|
1563
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$2(root, allowed, name), { concurrency: READ_CONCURRENCY$6 });
|
|
1564
|
+
return Array.getSomes(found);
|
|
1565
|
+
});
|
|
1474
1566
|
// src/root-readme.ts
|
|
1475
1567
|
const RULE$5 = "root-readme";
|
|
1476
1568
|
const SEPARATOR$1 = "/";
|
|
@@ -1531,6 +1623,16 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1531
1623
|
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces), { concurrency: READ_CONCURRENCY$5 });
|
|
1532
1624
|
return Array.flatten(found);
|
|
1533
1625
|
});
|
|
1626
|
+
// src/placement-checks.ts
|
|
1627
|
+
/** @internal */
|
|
1628
|
+
const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root) {
|
|
1629
|
+
const found = yield* Effect.all([
|
|
1630
|
+
checkNestedDocs(root),
|
|
1631
|
+
checkRootReadme(root),
|
|
1632
|
+
checkColocatedTests(root)
|
|
1633
|
+
], { concurrency: "unbounded" });
|
|
1634
|
+
return Array.flatten(found);
|
|
1635
|
+
});
|
|
1534
1636
|
// src/found-comment.ts
|
|
1535
1637
|
const taggedError$2 = Schema.TaggedError;
|
|
1536
1638
|
var CommentsUnreadable = class extends taggedError$2()("CommentsUnreadable", {
|
|
@@ -2113,8 +2215,7 @@ const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
|
|
|
2113
2215
|
checkRepository(root),
|
|
2114
2216
|
checkOverrides(root),
|
|
2115
2217
|
checkTrackedText(root),
|
|
2116
|
-
|
|
2117
|
-
checkRootReadme(root),
|
|
2218
|
+
checkPlacement(root),
|
|
2118
2219
|
checkPublishedPackages(root),
|
|
2119
2220
|
checkWorkspaces(root)
|
|
2120
2221
|
], { concurrency: "unbounded" });
|