@r_masseater/msch 0.71.0 → 0.72.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/dist/changed.mjs +3 -2
- package/dist/changed.mjs.map +1 -1
- package/dist/cli.mjs +4 -3
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-TN74hRYq.mjs → define-lint-preset-Bawe3IU5.mjs} +6 -1
- package/dist/define-lint-preset-Bawe3IU5.mjs.map +1 -0
- package/dist/exits.mjs +3 -3
- package/dist/exits.mjs.map +1 -1
- package/dist/{index-BvxWopv8.d.mts → index-DEuWKkok.d.mts} +2 -1
- package/dist/lint-rules.mjs +16 -0
- package/dist/lint-rules.mjs.map +1 -1
- package/dist/lint.d.mts +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/{lookup-report-D1VTEK5k.mjs → lookup-report-Dp36RBaW.mjs} +2 -2
- package/dist/{lookup-report-D1VTEK5k.mjs.map → lookup-report-Dp36RBaW.mjs.map} +1 -1
- package/dist/output-DrM4OsOJ.mjs +14 -0
- package/dist/output-DrM4OsOJ.mjs.map +1 -0
- package/dist/publish.mjs +39 -19
- package/dist/publish.mjs.map +1 -1
- package/dist/published.mjs +3 -3
- package/dist/published.mjs.map +1 -1
- package/dist/refs.mjs +3 -3
- package/dist/refs.mjs.map +1 -1
- package/dist/runtime-Q9CzisOt.mjs +40 -0
- package/dist/runtime-Q9CzisOt.mjs.map +1 -0
- package/dist/wake.mjs +2 -2
- package/dist/wake.mjs.map +1 -1
- package/package.json +7 -6
- package/dist/define-lint-preset-TN74hRYq.mjs.map +0 -1
- package/dist/runtime-1exMm81b.mjs +0 -45
- package/dist/runtime-1exMm81b.mjs.map +0 -1
package/dist/lint-rules.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint-rules.mjs","names":["ONE","Str","Arr","MESSAGE","ONE","Arr","Arr","Rec","MESSAGE_ID","MESSAGE","Str","Arr","visitorOf","MESSAGE","Arr","MESSAGE","Arr","MESSAGE","Str","Arr","Arr","Arr","Str","Arr","Str","Arr","Rec"],"sources":["../src/features/define-lint-rules/model/get-or-insert-ast.ts","../src/features/define-lint-rules/model/array-from-async.ts","../src/features/define-lint-rules/model/ecosystem-readers.ts","../src/features/define-lint-rules/model/typed-rule.ts","../src/features/define-lint-rules/model/explicit-import-path.ts","../src/features/define-lint-rules/model/get-or-insert.ts","../src/features/define-lint-rules/model/inline-exports.ts","../src/features/define-lint-rules/model/mcp-tool-layer.ts","../src/features/define-lint-rules/model/declared-outside.ts","../src/features/define-lint-rules/model/writable-part.ts","../src/features/define-lint-rules/model/readonly-parameters.ts","../src/features/define-lint-rules/model/coded-rules.ts","../src/features/define-lint-rules/model/intent-rule.ts","../src/features/define-lint-rules/model/intents.ts","../src/features/define-lint-rules/model/plugin.ts"],"sourcesContent":["import { Array as Arr, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nexport type Keys = Readonly<Record<string, readonly string[] | undefined>>;\n\nexport interface Scope {\n readonly text: string;\n readonly keys: Keys;\n}\n\nexport interface Access {\n readonly map: string;\n readonly key: string;\n readonly value: Option.Option<string>;\n}\n\nconst START = 0;\nconst END = 1;\nconst KEY = 0;\nconst VALUE = 1;\nconst ONE = 1;\n\nconst RangeSchema = Schema.Tuple([Schema.Finite, Schema.Finite]);\nconst RangedSchema = Schema.Struct({ range: RangeSchema });\n\ntype Ranged = typeof RangedSchema.Type;\n\nconst decodeRanged = Schema.decodeUnknownOption(RangedSchema);\n\nconst IdentifierSchema = Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String });\n\nconst MemberSchema = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n computed: Schema.Literal(false),\n object: RangedSchema,\n property: IdentifierSchema,\n});\n\nconst MemberCallSchema = Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: MemberSchema,\n arguments: Schema.Array(RangedSchema),\n});\n\nconst decodeMemberCall = Schema.decodeUnknownOption(MemberCallSchema);\n\nconst decodeCall = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: RangedSchema,\n arguments: Schema.Array(Schema.Unknown),\n }),\n);\n\nconst decodeBlock = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"BlockStatement\"), body: Schema.Array(Schema.Unknown) }),\n);\n\nconst decodeExpressionStatement = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"ExpressionStatement\"), expression: Schema.Unknown }),\n);\n\nconst decodeReturn = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"ReturnStatement\"), argument: RangedSchema }),\n);\n\nconst decodeTyped = Schema.decodeUnknownOption(Schema.Struct({ type: Schema.String }));\n\nconst textOf =\n (scope: Scope) =>\n (node: Ranged): string =>\n Str.slice(node.range[START], node.range[END])(scope.text);\n\nexport const textOfNode =\n (scope: Scope) =>\n (node: unknown): Option.Option<string> =>\n pipe(decodeRanged(node), Option.map(textOf(scope)));\n\nexport const accessOf =\n (scope: Scope) =>\n (method: string) =>\n (node: unknown): Option.Option<Access> =>\n pipe(\n decodeMemberCall(node),\n Option.filter((call) => call.callee.property.name === method),\n Option.flatMap((call) =>\n pipe(\n Arr.get(call.arguments, KEY),\n Option.map((key) => ({\n map: textOf(scope)(call.callee.object),\n key: textOf(scope)(key),\n value: pipe(Arr.get(call.arguments, VALUE), Option.map(textOf(scope))),\n })),\n ),\n ),\n );\n\nexport const sameEntry =\n (left: Access) =>\n (right: Access): boolean =>\n left.map === right.map && left.key === right.key;\n\nexport const calleeMatches =\n (scope: Scope) =>\n (pattern: RegExp) =>\n (node: unknown): Option.Option<readonly unknown[]> =>\n pipe(\n decodeCall(node),\n Option.filter((call) => pattern.test(textOf(scope)(call.callee))),\n Option.map((call) => call.arguments),\n );\n\nexport const expressionOf = (statement: unknown): Option.Option<unknown> =>\n pipe(\n decodeExpressionStatement(statement),\n Option.map((found) => found.expression),\n );\n\nexport const returnedText =\n (scope: Scope) =>\n (statement: unknown): Option.Option<string> =>\n pipe(\n decodeReturn(statement),\n Option.map((found) => textOf(scope)(found.argument)),\n );\n\nexport const bodyOf = (node: unknown): Option.Option<readonly unknown[]> =>\n pipe(\n decodeBlock(node),\n Option.map((block) => block.body),\n );\n\nexport const onlyStatement = (statement: unknown): Option.Option<unknown> =>\n Option.match(bodyOf(statement), {\n onNone: () => Option.some(statement),\n onSome: (body) =>\n Option.flatMap(\n Option.liftPredicate(body, (all) => all.length === ONE),\n Arr.head,\n ),\n });\n\nexport const typeOf = (node: unknown): string =>\n pipe(decodeTyped(node), Option.match({ onNone: () => \"\", onSome: (found) => found.type }));\n\nexport const parentOf = (node: unknown): Option.Option<unknown> =>\n pipe(\n Option.liftPredicate(node, Predicate.hasProperty(\"parent\")),\n Option.flatMap((found) => Option.fromNullishOr(found.parent)),\n );\n\nconst childrenOf = (keys: Keys, node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, Predicate.isObject),\n Option.match({\n onNone: (): readonly unknown[] => [],\n onSome: (found) =>\n pipe(\n keys[typeOf(found)] ?? [],\n Arr.flatMap((key): readonly unknown[] =>\n pipe(\n Option.liftPredicate(found, Predicate.hasProperty(key)),\n Option.match({\n onNone: (): readonly unknown[] => [],\n onSome: (owner) => Arr.ensure(owner[key]),\n }),\n ),\n ),\n Arr.filter(Predicate.isObject),\n ),\n }),\n );\n\nexport const descendants =\n (keys: Keys) =>\n (node: unknown): readonly unknown[] => [\n node,\n ...pipe(childrenOf(keys, node), Arr.flatMap(descendants(keys))),\n ];\n\nexport const accessesIn =\n (scope: Scope) =>\n (method: string) =>\n (node: unknown): readonly Access[] =>\n pipe(descendants(scope.keys)(node), Arr.map(accessOf(scope)(method)), Arr.getSomes);\n","import { Array as Arr, Option, Schema, pipe } from \"effect\";\nimport type { Rule } from \"vite-plus/lint/plugins\";\n\nimport { expressionOf, onlyStatement } from \"./get-or-insert-ast.ts\";\n\nconst MESSAGE =\n \"Collect an async iterable with Array.fromAsync, passing the mapping as its second argument. Do not push each item from a for await loop.\";\n\nconst ONE = 1;\n\nconst DeclarationSchema = Schema.Struct({\n type: Schema.Literal(\"VariableDeclaration\"),\n declarations: Schema.Array(Schema.Unknown),\n});\n\nconst decodeLoop = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"ForOfStatement\"),\n await: Schema.Literal(true),\n left: DeclarationSchema,\n body: Schema.Unknown,\n }),\n);\n\nconst PushNameSchema = Schema.Struct({\n type: Schema.Literal(\"Identifier\"),\n name: Schema.Literal(\"push\"),\n});\n\nconst PushCalleeSchema = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n computed: Schema.Literal(false),\n property: PushNameSchema,\n});\n\nconst ArgumentSchema = Schema.Struct({ type: Schema.String });\n\nconst decodePush = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: PushCalleeSchema,\n arguments: Schema.Array(ArgumentSchema),\n }),\n);\n\nconst pushesOne = (statement: unknown): boolean =>\n pipe(\n expressionOf(statement),\n Option.flatMap(decodePush),\n Option.exists(\n (call) =>\n call.arguments.length === ONE &&\n !pipe(\n call.arguments,\n Arr.some((argument) => argument.type === \"SpreadElement\"),\n ),\n ),\n );\n\nconst collectsByHand = (node: unknown): boolean =>\n pipe(\n decodeLoop(node),\n Option.filter((loop) => loop.left.declarations.length === ONE),\n Option.flatMap((loop) => onlyStatement(loop.body)),\n Option.exists(pushesOne),\n );\n\nexport const arrayFromAsync: Rule = {\n meta: { type: \"suggestion\" },\n create: (context) => ({\n ForOfStatement: (node): void => {\n if (collectsByHand(node)) {\n context.report({ node, message: MESSAGE });\n }\n },\n }),\n};\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\nimport type { Context, ESTree, Rule } from \"vite-plus/lint/plugins\";\n\ntype Format = \"json\" | \"toml\" | \"typescript\" | \"yaml\";\n\ninterface EcosystemFile {\n readonly name: RegExp;\n readonly format: Format;\n readonly reader: string;\n}\n\nconst ECOSYSTEM_FILES: readonly EcosystemFile[] = [\n {\n name: /^pnpm-workspace\\.yaml$/u,\n format: \"yaml\",\n reader:\n \"readWorkspaceManifest from @pnpm/workspace.workspace-manifest-reader, findWorkspaceProjects from @pnpm/workspace.projects-reader or updateWorkspaceManifest from @pnpm/workspace.workspace-manifest-writer\",\n },\n {\n name: /^pnpm-lock\\.yaml$/u,\n format: \"yaml\",\n reader: \"readWantedLockfile from @pnpm/lockfile.fs\",\n },\n { name: /^Cargo\\.(?:toml|lock)$/u, format: \"toml\", reader: \"cargo metadata\" },\n {\n name: /^tsconfig(?:\\.[\\w-]+)?\\.json$/u,\n format: \"json\",\n reader: \"parse from tsconfck or the TypeScript compiler API\",\n },\n {\n name: /^vite\\.config\\.[cm]?[jt]s$/u,\n format: \"typescript\",\n reader:\n \"resolveConfigFromFile from vite-plus, or parse from vite-plus for a read that must not run the file\",\n },\n];\n\nconst PARSER_MODULES: Readonly<Record<Format, readonly string[]>> = {\n json: [\"jsonc-parser\", \"json5\", \"strip-json-comments\"],\n toml: [\"smol-toml\", \"@iarna/toml\", \"toml\", \"toml-eslint-parser\"],\n typescript: [\"typescript\", \"oxc-parser\", \"@babel/parser\", \"@typescript-eslint/parser\", \"acorn\"],\n yaml: [\"yaml\", \"js-yaml\"],\n};\n\nconst PARSER_CALLS: Readonly<Record<Format, Option.Option<RegExp>>> = {\n json: Option.some(/\\b(?:JSON\\.parse|parseJson)\\b/u),\n toml: Option.none(),\n typescript: Option.none(),\n yaml: Option.none(),\n};\n\nconst importedModules = (statements: readonly ESTree.Statement[]): readonly string[] =>\n pipe(\n statements,\n Arr.filter((statement) => statement.type === \"ImportDeclaration\"),\n Arr.map((declaration) => declaration.source.value),\n );\n\nconst parserIn =\n (context: Context) =>\n (format: Format): Option.Option<string> => {\n const imported = importedModules(context.sourceCode.ast.body);\n const fromModule = pipe(\n Rec.get(PARSER_MODULES, format),\n Option.getOrElse((): readonly string[] => []),\n Arr.findFirst((module) => Arr.contains(imported, module)),\n );\n if (Option.isSome(fromModule)) {\n return fromModule;\n }\n return pipe(\n Rec.get(PARSER_CALLS, format),\n Option.flatten,\n Option.flatMap((pattern) => Option.fromNullishOr(pattern.exec(context.sourceCode.text))),\n Option.map(([call]) => call),\n );\n };\n\nconst messageFor =\n (context: Context) =>\n (text: string): Option.Option<string> => {\n const name = baseName(text);\n return pipe(\n ECOSYSTEM_FILES,\n Arr.findFirst((entry) => entry.name.test(name)),\n Option.flatMap(({ format, reader }) =>\n pipe(\n parserIn(context)(format),\n Option.map(\n (parser) =>\n `${name} has an official reader: ${reader}. Read it with that instead of parsing it with ${parser}, so that the file means what its own tool says it means.`,\n ),\n ),\n ),\n );\n };\n\nexport const ecosystemReaders: Rule = {\n meta: { type: \"problem\" },\n create: (context) => ({\n Literal: (node): void => {\n const message = pipe(\n Option.liftPredicate(node.value, (value) => typeof value === \"string\"),\n Option.flatMap(messageFor(context)),\n );\n if (Option.isSome(message)) {\n context.report({ node, message: message.value });\n }\n },\n TemplateElement: (node): void => {\n const message = messageFor(context)(node.value.raw);\n if (Option.isSome(message)) {\n context.report({ node, message: message.value });\n }\n },\n }),\n};\n","import { withTypeInformation } from \"@r_masseater/oxlint-typed-rules\";\nimport type { ParserServices, TypedContext } from \"@r_masseater/oxlint-typed-rules\";\nimport { Option, pipe } from \"effect\";\nimport type { Rule, RuleMeta, Visitor } from \"vite-plus/lint/plugins\";\n\nexport interface TypedRuleParts {\n readonly meta: RuleMeta;\n readonly visitorOf: (context: TypedContext, services: ParserServices) => Visitor;\n}\n\nexport const typedRuleOf = ({ meta, visitorOf }: TypedRuleParts): Rule =>\n withTypeInformation({\n meta,\n create: (context: TypedContext) =>\n pipe(\n Option.fromNullishOr(context.sourceCode.parserServices),\n Option.match({\n onNone: (): Visitor => ({}),\n onSome: (services) => visitorOf(context, services),\n }),\n ),\n });\n","import { baseName, parent } from \"@masseater.dev/path-kit\";\nimport type { ParserServices, TypedContext } from \"@r_masseater/oxlint-typed-rules\";\nimport { Array as Arr, Option, Predicate, String as Str, pipe } from \"effect\";\nimport type { ESTree, Rule, Visitor } from \"vite-plus/lint/plugins\";\n\nimport { typedRuleOf } from \"./typed-rule.ts\";\n\nconst MESSAGE_ID = \"spellOut\";\nconst MESSAGE =\n \"`{{specifier}}` does not name a file. Write `{{fixed}}`: Node ESM and TypeScript nodenext resolve neither a missing extension nor a directory index, so spelling out the file works under every resolver.\";\n\nconst RELATIVE = /^\\.{1,2}(?:\\/|$)/u;\nconst PARTS = /^(?<path>[^?]*)(?<query>.*)$/su;\nconst TRAILING_SEPARATORS = /\\/+$/u;\nconst DIRECTORY_NAMES: readonly string[] = [\".\", \"..\"];\nconst INDEX = \"index.\";\nconst DEFAULT_QUOTE = '\"';\nconst FIRST = 0;\n\ninterface Parts {\n readonly path: string;\n readonly query: string;\n}\n\nconst partsOf = (specifier: string): Option.Option<Parts> =>\n pipe(\n Str.match(PARTS)(specifier),\n Option.flatMap((matched) => Option.fromNullishOr(matched.groups)),\n Option.map((groups) => ({ path: groups[\"path\"] ?? \"\", query: groups[\"query\"] ?? \"\" })),\n );\n\nconst completionOf = (resolved: string, path: string): Option.Option<string> => {\n const file = baseName(resolved);\n const name = baseName(path);\n const index = Str.startsWith(INDEX)(file);\n if (Arr.contains(DIRECTORY_NAMES, name)) {\n return Option.liftPredicate(`/${file}`, () => index);\n }\n if (Str.startsWith(`${name}.`)(file)) {\n return Option.some(Str.slice(name.length)(file));\n }\n return Option.liftPredicate(`/${file}`, () => index && baseName(parent(resolved)) === name);\n};\n\nconst resolvedFileOf = (\n services: ParserServices,\n source: ESTree.StringLiteral,\n): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(services.getSymbolAtLocation(source)),\n Option.flatMap((symbol) => Arr.head(symbol.declarations)),\n Option.map((declaration) => declaration.getSourceFile().fileName),\n );\n\nconst fixedOf = (services: ParserServices, source: ESTree.StringLiteral): Option.Option<string> =>\n pipe(\n partsOf(source.value),\n Option.filter(({ path }) => RELATIVE.test(path)),\n Option.flatMap(({ path, query }) =>\n pipe(\n resolvedFileOf(services, source),\n Option.flatMap((resolved) =>\n completionOf(resolved, Str.replace(TRAILING_SEPARATORS, \"\")(path)),\n ),\n Option.map(\n (completion) => `${Str.replace(TRAILING_SEPARATORS, \"\")(path)}${completion}${query}`,\n ),\n ),\n ),\n );\n\nconst quoteOf = (source: ESTree.StringLiteral): string =>\n pipe(\n Option.fromNullishOr(source.raw),\n Option.flatMap(Str.charAt(FIRST)),\n Option.getOrElse(() => DEFAULT_QUOTE),\n );\n\nconst isStringLiteral = (node: ESTree.Node | null): node is ESTree.StringLiteral =>\n Predicate.isNotNull(node) && node.type === \"Literal\" && Predicate.isString(node.value);\n\nconst visitorOf = (context: TypedContext, services: ParserServices): Visitor => {\n const check = (source: ESTree.Node | null): void => {\n if (!isStringLiteral(source)) {\n return;\n }\n const fixed = fixedOf(services, source);\n if (Option.isSome(fixed)) {\n context.report({\n node: source,\n messageId: MESSAGE_ID,\n data: { specifier: source.value, fixed: fixed.value },\n fix: (fixer) =>\n fixer.replaceText(source, `${quoteOf(source)}${fixed.value}${quoteOf(source)}`),\n });\n }\n };\n return {\n ImportDeclaration: (node): void => {\n check(node.source);\n },\n ExportAllDeclaration: (node): void => {\n check(node.source);\n },\n ExportNamedDeclaration: (node): void => {\n check(node.source);\n },\n ImportExpression: (node): void => {\n check(node.source);\n },\n };\n};\n\nexport const explicitImportPath: Rule = typedRuleOf({\n meta: { type: \"suggestion\", fixable: \"code\", messages: { [MESSAGE_ID]: MESSAGE } },\n visitorOf,\n});\n","import { Array as Arr, Option, Schema, pipe } from \"effect\";\nimport type { Rule } from \"vite-plus/lint/plugins\";\n\nimport {\n accessOf,\n accessesIn,\n bodyOf,\n calleeMatches,\n descendants,\n expressionOf,\n onlyStatement,\n parentOf,\n returnedText,\n sameEntry,\n textOfNode,\n typeOf,\n} from \"./get-or-insert-ast.ts\";\nimport type { Access, Scope } from \"./get-or-insert-ast.ts\";\n\nconst MESSAGE =\n \"Use getOrInsert or getOrInsertComputed on the Map or WeakMap, so that reading a key and storing its first value is one call. Do not read the key and then set it by hand.\";\n\nconst ONE = 1;\nconst TWO = 2;\nconst OPTION_FROM = /^(?:Option\\.)?from(?:NullishOr|UndefinedOr|Nullable)$/u;\nconst GET_OR_ELSE = /^(?:Option\\.)?getOrElse$/u;\nconst FUNCTIONS: readonly string[] = [\"ArrowFunctionExpression\", \"FunctionExpression\"];\n\nconst decodeGuard = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"IfStatement\"),\n test: Schema.Unknown,\n consequent: Schema.Unknown,\n alternate: Schema.Null,\n }),\n);\n\nconst decodeNot = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"UnaryExpression\"),\n operator: Schema.Literal(\"!\"),\n argument: Schema.Unknown,\n }),\n);\n\nconst DeclaratorSchema = Schema.Struct({\n id: Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String }),\n init: Schema.Unknown,\n});\n\ntype Declarator = typeof DeclaratorSchema.Type;\n\nconst decodeDeclaration = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"VariableDeclaration\"),\n declarations: Schema.Array(DeclaratorSchema),\n }),\n);\n\nconst decodeNullish = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"LogicalExpression\"),\n operator: Schema.Literal(\"??\"),\n left: Schema.Unknown,\n }),\n);\n\nconst storeOf =\n (scope: Scope) =>\n (statement: unknown): Option.Option<Access> =>\n pipe(expressionOf(statement), Option.flatMap(accessOf(scope)(\"set\")));\n\nconst isHasGuard = (scope: Scope, node: unknown): boolean =>\n pipe(\n decodeGuard(node),\n Option.exists((guard) => {\n const guarded = pipe(\n decodeNot(guard.test),\n Option.flatMap((not) => accessOf(scope)(\"has\")(not.argument)),\n );\n const stored = pipe(onlyStatement(guard.consequent), Option.flatMap(storeOf(scope)));\n return Option.isSome(guarded) && Option.exists(stored, sameEntry(guarded.value));\n }),\n );\n\nconst deletes =\n (scope: Scope, read: Access) =>\n (statement: unknown): boolean =>\n pipe(\n expressionOf(statement),\n Option.flatMap(accessOf(scope)(\"delete\")),\n Option.exists(sameEntry(read)),\n );\n\nconst storesBack =\n (scope: Scope, read: Access, name: string) =>\n (statement: unknown): boolean =>\n Option.exists(\n storeOf(scope)(statement),\n (stored) => sameEntry(read)(stored) && Option.exists(stored.value, (value) => value === name),\n );\n\nconst fallsBack =\n (scope: Scope, later: readonly unknown[]) =>\n (declarator: Declarator): boolean =>\n pipe(\n decodeNullish(declarator.init),\n Option.flatMap((nullish) => accessOf(scope)(\"get\")(nullish.left)),\n Option.exists(\n (read) =>\n pipe(later, Arr.some(storesBack(scope, read, declarator.id.name))) &&\n !pipe(later, Arr.some(deletes(scope, read))),\n ),\n );\n\nconst fallbackIndices = (scope: Scope, body: readonly unknown[]): readonly number[] =>\n pipe(\n body,\n Arr.map((statement, index) => {\n const fallsBackLater = fallsBack(scope, Arr.drop(body, index + ONE));\n return pipe(\n decodeDeclaration(statement),\n Option.map((declaration) => declaration.declarations),\n Option.filter(Arr.some(fallsBackLater)),\n Option.as(index),\n );\n }),\n Arr.getSomes,\n );\n\ninterface CachedCheck {\n readonly test: (name: string) => string;\n readonly value: (name: string) => string;\n}\n\nconst itself = (name: string): string => name;\n\nconst CACHED_CHECKS: readonly CachedCheck[] = [\n { test: (name) => `${name} !== undefined`, value: itself },\n { test: (name) => `${name} != null`, value: itself },\n { test: (name) => `${name} !== null`, value: itself },\n { test: (name) => `Predicate.isNotUndefined(${name})`, value: itself },\n { test: (name) => `Predicate.isNotNullish(${name})`, value: itself },\n { test: itself, value: itself },\n { test: (name) => `Option.isSome(${name})`, value: (name) => `${name}.value` },\n];\n\nconst returnsCached =\n (scope: Scope, name: string) =>\n (statement: unknown): boolean =>\n pipe(\n decodeGuard(statement),\n Option.exists((guard) => {\n const tested = textOfNode(scope)(guard.test);\n const returned = pipe(onlyStatement(guard.consequent), Option.flatMap(returnedText(scope)));\n return pipe(\n CACHED_CHECKS,\n Arr.some(\n (check) =>\n Option.exists(tested, (found) => found === check.test(name)) &&\n Option.exists(returned, (found) => found === check.value(name)),\n ),\n );\n }),\n );\n\nconst unwrapOption =\n (scope: Scope) =>\n (node: unknown): unknown =>\n pipe(\n calleeMatches(scope)(OPTION_FROM)(node),\n Option.flatMap(Arr.head),\n Option.getOrElse(() => node),\n );\n\nconst readsCached =\n (scope: Scope, stored: Access) =>\n (declarator: Declarator): boolean =>\n pipe(\n unwrapOption(scope)(declarator.init),\n accessOf(scope)(\"get\"),\n Option.exists(sameEntry(stored)),\n );\n\nconst earlyReturn = (scope: Scope, body: readonly unknown[], stored: Access): boolean =>\n pipe(\n body,\n Arr.some((statement, index) =>\n pipe(\n decodeDeclaration(statement),\n Option.flatMap((declaration) => Arr.head(declaration.declarations)),\n Option.filter(readsCached(scope, stored)),\n Option.exists((declarator) =>\n Option.exists(Arr.get(body, index + ONE), returnsCached(scope, declarator.id.name)),\n ),\n ),\n ),\n );\n\nconst storedAndReturned = (scope: Scope, body: readonly unknown[]): Option.Option<Access> => {\n const returned = pipe(Arr.last(body), Option.flatMap(returnedText(scope)));\n return pipe(\n Arr.get(body, body.length - TWO),\n Option.flatMap(storeOf(scope)),\n Option.filter(\n (stored) => Option.isSome(returned) && Option.contains(stored.value, returned.value),\n ),\n );\n};\n\nconst optionRegion = (scope: Scope, block: unknown): Option.Option<unknown> =>\n pipe(\n parentOf(block),\n Option.filter((fn) => Arr.contains(FUNCTIONS, typeOf(fn))),\n Option.flatMap(parentOf),\n Option.filter((call) => Option.isSome(calleeMatches(scope)(GET_OR_ELSE)(call))),\n Option.flatMap(parentOf),\n );\n\nconst readsThroughOption =\n (scope: Scope, stored: Access) =>\n (node: unknown): boolean =>\n pipe(\n calleeMatches(scope)(OPTION_FROM)(node),\n Option.flatMap(Arr.head),\n Option.flatMap(accessOf(scope)(\"get\")),\n Option.exists(sameEntry(stored)),\n );\n\nconst storesOnce =\n (scope: Scope, stored: Access) =>\n (region: unknown): boolean =>\n pipe(accessesIn(scope)(\"set\")(region), Arr.filter(sameEntry(stored))).length === ONE;\n\nconst returnsOnce = (scope: Scope, block: unknown): boolean =>\n pipe(\n descendants(scope.keys)(block),\n Arr.filter((node) => typeOf(node) === \"ReturnStatement\"),\n ).length === ONE;\n\nconst fallsBackInOption = (scope: Scope, block: unknown, stored: Access): boolean =>\n returnsOnce(scope, block) &&\n Option.exists(\n optionRegion(scope, block),\n (region) =>\n pipe(descendants(scope.keys)(region), Arr.some(readsThroughOption(scope, stored))) &&\n storesOnce(scope, stored)(region),\n );\n\nconst isMemoized = (scope: Scope, block: unknown): boolean =>\n pipe(\n bodyOf(block),\n Option.exists((body) =>\n Option.exists(storedAndReturned(scope, body), (stored) => {\n if (earlyReturn(scope, body, stored)) {\n return storesOnce(scope, stored)(block);\n }\n return fallsBackInOption(scope, block, stored);\n }),\n ),\n );\n\nexport const getOrInsert: Rule = {\n meta: { type: \"suggestion\" },\n create: (context) => {\n const scope: Scope = { text: context.sourceCode.text, keys: context.sourceCode.visitorKeys };\n return {\n IfStatement: (node): void => {\n if (isHasGuard(scope, node)) {\n context.report({ node, message: MESSAGE });\n }\n },\n BlockStatement: (node): void => {\n for (const index of fallbackIndices(scope, node.body)) {\n for (const statement of Option.toArray(Arr.get(node.body, index))) {\n context.report({ node: statement, message: MESSAGE });\n }\n }\n if (isMemoized(scope, node)) {\n context.report({ node, message: MESSAGE });\n }\n },\n };\n },\n};\n","import { Array as Arr, pipe } from \"effect\";\nimport type { Context, ESTree, Rule } from \"vite-plus/lint/plugins\";\n\nconst MESSAGE =\n \"export は宣言に付ける(export const・export function など)。ファイルの末尾で export { … } にまとめない。\";\nconst TYPE = \"type\";\nconst CLASS_NAME = \"ClassName\";\n\nconst isList = (node: ESTree.ExportNamedDeclaration): boolean =>\n node.declaration === null && node.source === null && !Arr.isReadonlyArrayEmpty(node.specifiers);\n\nconst localName = (specifier: ESTree.ExportSpecifier): string => {\n if (specifier.local.type === \"Literal\") {\n return specifier.local.value;\n }\n return specifier.local.name;\n};\n\nconst isClass = (context: Context, name: string): boolean =>\n pipe(\n context.sourceCode.scopeManager.scopes,\n Arr.flatMap((scope) => scope.variables),\n Arr.filter((variable) => variable.name === name),\n Arr.flatMap((variable) => variable.defs),\n (defs) =>\n Arr.isReadonlyArrayNonEmpty(defs) &&\n pipe(\n defs,\n Arr.every(({ type }) => type === CLASS_NAME),\n ),\n );\n\nconst isTypeOnlyClass =\n (context: Context, node: ESTree.ExportNamedDeclaration) =>\n (specifier: ESTree.ExportSpecifier): boolean =>\n (node.exportKind === TYPE || specifier.exportKind === TYPE) &&\n isClass(context, localName(specifier));\n\nexport const inlineExports: Rule = {\n meta: { type: \"suggestion\" },\n create: (context) => ({\n ExportNamedDeclaration: (node): void => {\n if (isList(node) && !pipe(node.specifiers, Arr.every(isTypeOnlyClass(context, node)))) {\n context.report({ node, message: MESSAGE });\n }\n },\n }),\n};\n","import { segments, toPosix } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\nimport type { Rule } from \"vite-plus/lint/plugins\";\n\nconst SOURCE = \"/src/\";\nconst TOOL_LAYERS: readonly string[] = [\"features\", \"shared\"];\nconst TEST_FILE = /\\.test(?:\\.support)?\\.[cm]?[jt]sx?$/u;\nconst METHOD = \"registerTool\";\n\nconst MESSAGE =\n \"Register an MCP tool in the features slice of the operation it performs. A tool is one operation, so app/ only composes the slices' register functions and entities/ only holds the data they share.\";\n\nconst layerIn = (path: string): Option.Option<string> =>\n pipe(\n Str.lastIndexOf(SOURCE)(path),\n Option.map((index) => Arr.headNonEmpty(segments(Str.slice(index + SOURCE.length)(path)))),\n );\n\nconst layerOf = (filename: string): Option.Option<string> => layerIn(toPosix(filename));\n\nconst outsideToolLayers = (filename: string): boolean =>\n !TEST_FILE.test(filename) &&\n Option.exists(layerOf(filename), (layer) => !Arr.contains(TOOL_LAYERS, layer));\n\nexport const mcpToolLayer: Rule = {\n meta: { type: \"problem\" },\n create: (context) => {\n if (!outsideToolLayers(context.filename)) {\n return {};\n }\n return {\n CallExpression: (node): void => {\n const { callee } = node;\n if (\n callee.type === \"MemberExpression\" &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === METHOD\n ) {\n context.report({ node: callee.property, message: MESSAGE });\n }\n },\n };\n },\n};\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { SymbolFlags } from \"typescript/sync\";\nimport type { NodeHandle, Project, Symbol as TypeSymbol } from \"typescript/sync\";\n\nexport type Origin = \"own\" | \"package\" | \"builtin\";\n\nconst origins = new WeakMap<TypeSymbol, Origin>();\nconst readonlyForms = new WeakMap<Project, Map<string, Option.Option<string>>>();\n\nconst fileOrigin = (project: Project, handle: NodeHandle): Option.Option<Origin> =>\n pipe(\n Option.fromNullishOr(project.program.getSourceFileMetadataByPath(handle.path)),\n Option.flatMap(({ isDefaultLibrary, isFromExternalLibrary }): Option.Option<Origin> => {\n if (isDefaultLibrary) {\n return Option.some(\"builtin\");\n }\n if (isFromExternalLibrary) {\n return Option.some(\"package\");\n }\n return Option.none();\n }),\n );\n\nconst declarationOrigin =\n (project: Project) =>\n (handle: NodeHandle): Origin =>\n pipe(\n fileOrigin(project, handle),\n Option.orElse(() =>\n pipe(\n Option.fromNullishOr(handle.resolve(project)),\n Option.filter((node) => node.getSourceFile().isDeclarationFile),\n Option.as<Origin>(\"package\"),\n ),\n ),\n Option.getOrElse((): Origin => \"own\"),\n );\n\nexport const originOf =\n (project: Project) =>\n (symbol: TypeSymbol): Origin =>\n origins.getOrInsertComputed(symbol, () => {\n const found = pipe(symbol.declarations, Arr.map(declarationOrigin(project)));\n if (Arr.contains(found, \"builtin\")) {\n return \"builtin\";\n }\n if (Arr.contains(found, \"package\")) {\n return \"package\";\n }\n return \"own\";\n });\n\nconst builtinNamed =\n (project: Project) =>\n (name: string): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(project.checker.resolveName(name, SymbolFlags.Type)),\n Option.filter((symbol) => originOf(project)(symbol) === \"builtin\"),\n Option.as(name),\n );\n\nexport const readonlyFormOf =\n (project: Project) =>\n (name: string): Option.Option<string> =>\n readonlyForms\n .getOrInsertComputed(project, () => new Map<string, Option.Option<string>>())\n .getOrInsertComputed(name, () =>\n pipe([`Readonly${name}`, `${name}ReadOnly`], Arr.findFirst(builtinNamed(project))),\n );\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\nimport type { Checker, Project, Symbol as TypeSymbol, Type } from \"typescript/sync\";\n\nimport { originOf, readonlyFormOf } from \"./declared-outside.ts\";\nimport type { Origin } from \"./declared-outside.ts\";\n\nexport type Mutability =\n | { readonly kind: \"array\" }\n | { readonly kind: \"tuple\" }\n | { readonly kind: \"property\" }\n | { readonly kind: \"index\" }\n | { readonly kind: \"form\"; readonly name: string; readonly readonlyName: string };\n\nexport interface WritablePart {\n readonly path: readonly string[];\n readonly mutability: Mutability;\n}\n\ntype Found = Option.Option<WritablePart>;\n\ninterface Search {\n readonly project: Project;\n readonly partOf: (type: Type) => Found;\n}\n\nexport const ELEMENT = \"[]\";\n\nconst MUTABLE_ARRAY = \"Array\";\nconst PRIVATE_NAME = \"__#\";\nconst SYMBOL_NAME = \"__@\";\n\nconst here = (mutability: Mutability): Found => Option.some({ path: [], mutability });\n\nconst under =\n (segment: string) =>\n (part: WritablePart): WritablePart => ({ ...part, path: [segment, ...part.path] });\n\nconst firstPart = (search: Search, types: readonly Type[]): Found =>\n pipe(types, Arr.findFirst(search.partOf));\n\nconst formOf =\n (project: Project) =>\n (name: string): Found =>\n pipe(\n readonlyFormOf(project)(name),\n Option.flatMap((readonlyName) => here({ kind: \"form\", name, readonlyName })),\n );\n\nconst isOpaqueAlias = (project: Project, type: Type): boolean =>\n pipe(\n Option.fromNullishOr(type.getAliasSymbol()),\n Option.exists((alias) => {\n const origin = originOf(project)(alias);\n return (\n origin === \"package\" ||\n (origin === \"builtin\" && Arr.isReadonlyArrayEmpty(type.getAliasTypeArguments()))\n );\n }),\n );\n\nconst isNamed = (type: Type): boolean =>\n type.isClassOrInterface() || (type.isTypeReference() && type.getTarget().isClassOrInterface());\n\nconst declaredOutside = (project: Project, type: Type): Option.Option<Found> =>\n pipe(\n Option.fromNullishOr(type.getSymbol()),\n Option.flatMap((symbol): Option.Option<Found> => {\n const origin = originOf(project)(symbol);\n if (origin === \"package\") {\n return Option.some(Option.none());\n }\n if (origin === \"own\" || !isNamed(type)) {\n return Option.none();\n }\n return Option.some(formOf(project)(symbol.name));\n }),\n );\n\nconst isOutside = (project: Project, type: Type): boolean =>\n isOpaqueAlias(project, type) ||\n (type.isObjectType() && Option.exists(declaredOutside(project, type), Option.isNone));\n\nconst sourceOf = (type: Type): Option.Option<Type> => {\n if (!type.isMappedType()) {\n return Option.none();\n }\n const template = type.getTemplateType();\n if (!template.isIndexedAccessType()) {\n return Option.none();\n }\n return Option.some(template.getObjectType());\n};\n\nconst takenFromOutside =\n (project: Project) =>\n (type: Type): readonly string[] => {\n if (isOutside(project, type)) {\n return pipe(\n type.getProperties(),\n Arr.map((property) => property.name),\n );\n }\n if (type.isUnionType() || type.isIntersectionType()) {\n return pipe(type.getTypes(), Arr.flatMap(takenFromOutside(project)));\n }\n return pipe(\n sourceOf(type),\n Option.map(takenFromOutside(project)),\n Option.getOrElse((): readonly string[] => []),\n );\n };\n\nconst elementsPart = (search: Search, type: Type): Found => {\n if (!type.isTypeReference()) {\n return Option.none();\n }\n return pipe(\n firstPart(search, search.project.checker.getTypeArguments(type)),\n Option.map(under(ELEMENT)),\n );\n};\n\nconst arrayPart = (search: Search, type: Type): Found => {\n const mutable = pipe(\n Option.fromNullishOr(type.getSymbol()),\n Option.exists((symbol) => symbol.name === MUTABLE_ARRAY),\n );\n if (mutable) {\n return here({ kind: \"array\" });\n }\n return elementsPart(search, type);\n};\n\nconst tuplePart = (search: Search, type: Type): Found => {\n if (type.isTupleType() && !type.getTarget().readonly) {\n return here({ kind: \"tuple\" });\n }\n return elementsPart(search, type);\n};\n\nconst named =\n (prefix: string) =>\n (property: TypeSymbol): boolean =>\n pipe(String(property.escapedName), Str.startsWith(prefix));\n\nconst isWritable =\n (checker: Checker) =>\n (property: TypeSymbol): boolean =>\n !checker.isReadonlySymbol(property) && !named(PRIVATE_NAME)(property);\n\nconst isStringNamed = (property: TypeSymbol): boolean =>\n !named(PRIVATE_NAME)(property) && !named(SYMBOL_NAME)(property);\n\nconst declaredIn =\n (project: Project, origin: Origin) =>\n (property: TypeSymbol): boolean =>\n originOf(project)(property) === origin;\n\nconst inheritedForm =\n (project: Project) =>\n (property: TypeSymbol): Found =>\n pipe(\n Option.fromNullishOr(property.getParent()),\n Option.flatMap((owner) => formOf(project)(owner.name)),\n );\n\nconst propertyTypesPart = (search: Search, properties: readonly TypeSymbol[]): Found => {\n const judged = pipe(properties, Arr.filter(isStringNamed));\n return pipe(\n Arr.zip(judged, search.project.checker.getTypeOfSymbol(judged)),\n Arr.findFirst(([property, type]) =>\n pipe(search.partOf(type), Option.map(under(property.name))),\n ),\n );\n};\n\nconst indexPart = (search: Search, type: Type): Found =>\n pipe(\n type.getIndexInfos(),\n Arr.findFirst((info) => {\n if (!info.isReadonly) {\n return here({ kind: \"index\" });\n }\n return pipe(search.partOf(info.valueType), Option.map(under(ELEMENT)));\n }),\n );\n\nconst membersPart = (search: Search, type: Type): Found => {\n const { project } = search;\n const properties = type.getProperties();\n const taken = pipe(\n sourceOf(type),\n Option.map(takenFromOutside(project)),\n Option.getOrElse((): readonly string[] => []),\n );\n const own = pipe(\n properties,\n Arr.filter(\n (property) => declaredIn(project, \"own\")(property) && !Arr.contains(taken, property.name),\n ),\n );\n return pipe(\n own,\n Arr.findFirst(isWritable(project.checker)),\n Option.map((property): WritablePart => ({\n path: [property.name],\n mutability: { kind: \"property\" },\n })),\n Option.orElse(() =>\n pipe(\n properties,\n Arr.filter(declaredIn(project, \"builtin\")),\n Arr.findFirst(inheritedForm(project)),\n ),\n ),\n Option.orElse(() => propertyTypesPart(search, own)),\n Option.orElse(() => indexPart(search, type)),\n );\n};\n\nconst isFunction = (type: Type): boolean =>\n Arr.isReadonlyArrayNonEmpty(type.getCallSignatures()) &&\n Arr.isReadonlyArrayEmpty(type.getProperties());\n\nconst objectPart = (search: Search, type: Type): Found => {\n if (isFunction(type)) {\n return Option.none();\n }\n if (search.project.checker.isArrayType(type)) {\n return arrayPart(search, type);\n }\n if (type.isTupleType()) {\n return tuplePart(search, type);\n }\n return pipe(\n declaredOutside(search.project, type),\n Option.getOrElse(() => membersPart(search, type)),\n );\n};\n\nconst typePart = (search: Search, type: Type): Found => {\n if (isOpaqueAlias(search.project, type)) {\n return Option.none();\n }\n if (type.isUnionType() || type.isIntersectionType()) {\n return firstPart(search, type.getTypes());\n }\n if (type.isConditionalType()) {\n return firstPart(search, [type.getTrueType(), type.getFalseType()]);\n }\n if (!type.isObjectType()) {\n return Option.none();\n }\n return objectPart(search, type);\n};\n\nexport const writablePartOf =\n (project: Project) =>\n (type: Type): Option.Option<WritablePart> => {\n const seen = new Set<Type>();\n const partOf = (inner: Type): Found => {\n if (seen.has(inner)) {\n return Option.none();\n }\n seen.add(inner);\n return typePart({ project, partOf }, inner);\n };\n return partOf(type);\n };\n","import type { ParserServices, TypedContext } from \"@r_masseater/oxlint-typed-rules\";\nimport { Array as Arr, Match, Option, String as Str, pipe } from \"effect\";\nimport type { Node } from \"typescript/ast\";\nimport { isTypeNode } from \"typescript/ast/is\";\nimport type { Type } from \"typescript/sync\";\nimport type { ESTree, Rule, Visitor } from \"vite-plus/lint/plugins\";\n\nimport { typedRuleOf } from \"./typed-rule.ts\";\nimport { ELEMENT, writablePartOf } from \"./writable-part.ts\";\nimport type { Mutability, WritablePart } from \"./writable-part.ts\";\n\nconst MESSAGE =\n \"A function must not be able to change its arguments, but {{part}}. Declare the parameter with a read-only type. Types declared by a package or by the language are exempt unless the language has a read-only form of them.\";\nconst MESSAGE_ID = \"shouldBeReadonly\";\nconst WHOLE = \"the type\";\nconst SEPARATOR = \".\";\nconst TAGGABLE: readonly string[] = [\"string\", \"number\", \"bigint\"];\n\ntype Annotated = ESTree.FormalParameter | ESTree.FormalParameterRest;\n\ntype FunctionLike =\n | ESTree.ArrowFunctionExpression\n | ESTree.Function\n | ESTree.TSCallSignatureDeclaration\n | ESTree.TSConstructSignatureDeclaration\n | ESTree.TSFunctionType\n | ESTree.TSMethodSignature;\n\nconst isBrandObject = (type: Type): boolean =>\n type.isObjectType() &&\n Arr.isReadonlyArrayEmpty(type.getCallSignatures()) &&\n Arr.isReadonlyArrayEmpty(type.getConstructSignatures());\n\nconst isTaggable = (type: Type): boolean =>\n type.isLiteralType() ||\n type.isTemplateLiteralType() ||\n (type.isIntrinsicType() && Arr.contains(TAGGABLE, type.intrinsicName));\n\nconst isBrandedLiteral = (type: Type): boolean => {\n if (!type.isIntersectionType()) {\n return false;\n }\n const parts = type.getTypes();\n const objects = pipe(parts, Arr.filter(isBrandObject));\n const primitives = pipe(parts, Arr.filter(isTaggable));\n return (\n Arr.isReadonlyArrayNonEmpty(objects) &&\n Arr.isReadonlyArrayNonEmpty(primitives) &&\n objects.length + primitives.length === parts.length\n );\n};\n\nconst isBrandedLiteralLike = (type: Type): boolean => {\n if (type.isUnionType()) {\n return pipe(type.getTypes(), Arr.every(isBrandedLiteral));\n }\n return isBrandedLiteral(type);\n};\n\nconst outermost = (node: Node): Node =>\n pipe(\n Option.fromNullishOr(node.parent),\n Option.filter((parent) => parent.getStart() === node.getStart() && parent.end === node.end),\n Option.match({ onNone: () => node, onSome: outermost }),\n );\n\nconst unwrapped = (parameter: ESTree.ParamPattern): Annotated => {\n if (parameter.type === \"TSParameterProperty\") {\n return parameter.parameter;\n }\n return parameter;\n};\n\nconst annotationOf = (parameter: Annotated): Option.Option<ESTree.TSTypeAnnotation> => {\n if (parameter.type === \"AssignmentPattern\") {\n return Option.fromNullishOr(parameter.left.typeAnnotation);\n }\n return Option.fromNullishOr(parameter.typeAnnotation);\n};\n\nconst annotatedType = (services: ParserServices, parameter: Annotated): Option.Option<Type> =>\n pipe(\n annotationOf(parameter),\n Option.map((annotation) =>\n outermost(services.esTreeNodeToTSNodeMap.get(annotation.typeAnnotation)),\n ),\n Option.filter(isTypeNode),\n Option.map((node) => services.program.native.checker.getTypeFromTypeNode(node)),\n );\n\nconst subjectOf = (path: readonly string[]): string => {\n if (Arr.isReadonlyArrayEmpty(path)) {\n return WHOLE;\n }\n return `\\`${pipe(Arr.join(path, SEPARATOR), Str.replaceAll(`${SEPARATOR}${ELEMENT}`, ELEMENT))}\\``;\n};\n\nconst predicateOf = Match.type<Mutability>().pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n array: () => \"is a mutable array\",\n tuple: () => \"is a mutable tuple\",\n property: () => \"is writable\",\n index: () => \"has a writable index signature\",\n form: ({ name, readonlyName }) =>\n `is a \\`${name}\\`, which has the read-only form \\`${readonlyName}\\``,\n }),\n);\n\nconst describe = ({ path, mutability }: WritablePart): string =>\n `${subjectOf(path)} ${predicateOf(mutability)}`;\n\nconst visitorOf = (context: TypedContext, services: ParserServices): Visitor => {\n const partOf = writablePartOf(services.program.native);\n const check = ({ params }: FunctionLike): void => {\n for (const parameter of pipe(params, Arr.map(unwrapped))) {\n const part = pipe(\n annotatedType(services, parameter),\n Option.filter((type) => !isBrandedLiteralLike(type)),\n Option.flatMap(partOf),\n );\n if (Option.isSome(part)) {\n context.report({\n node: parameter,\n messageId: MESSAGE_ID,\n data: { part: describe(part.value) },\n });\n }\n }\n };\n return {\n ArrowFunctionExpression: check,\n FunctionDeclaration: check,\n FunctionExpression: check,\n TSCallSignatureDeclaration: check,\n TSConstructSignatureDeclaration: check,\n TSDeclareFunction: check,\n TSEmptyBodyFunctionExpression: check,\n TSFunctionType: check,\n TSMethodSignature: check,\n };\n};\n\nexport const readonlyParameters: Rule = typedRuleOf({\n meta: { type: \"suggestion\", messages: { [MESSAGE_ID]: MESSAGE } },\n visitorOf,\n});\n","import type { Rule } from \"vite-plus/lint/plugins\";\n\nimport { arrayFromAsync } from \"./array-from-async.ts\";\nimport { ecosystemReaders } from \"./ecosystem-readers.ts\";\nimport { explicitImportPath } from \"./explicit-import-path.ts\";\nimport { getOrInsert } from \"./get-or-insert.ts\";\nimport { inlineExports } from \"./inline-exports.ts\";\nimport { mcpToolLayer } from \"./mcp-tool-layer.ts\";\nimport { readonlyParameters } from \"./readonly-parameters.ts\";\n\nexport const CODED_RULES: Readonly<Record<string, Rule>> = {\n \"array-from-async\": arrayFromAsync,\n \"ecosystem-readers\": ecosystemReaders,\n \"explicit-import-path\": explicitImportPath,\n \"get-or-insert\": getOrInsert,\n \"inline-exports\": inlineExports,\n \"mcp-tool-layer\": mcpToolLayer,\n \"readonly-parameters\": readonlyParameters,\n};\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport type { Context, ESTree, Rule } from \"vite-plus/lint/plugins\";\n\nconst NAMESPACE = \"*\";\nconst DEFAULT = \"default\";\n\nexport interface ImportBan {\n readonly module: string;\n readonly names: Option.Option<readonly string[]>;\n readonly typesAllowed: boolean;\n}\n\nexport interface MemberBan {\n readonly object: string;\n readonly properties: readonly string[];\n}\n\nexport interface Intent {\n readonly message: string;\n readonly imports: readonly ImportBan[];\n readonly members: readonly MemberBan[];\n}\n\nconst importedName = (specifier: ESTree.ImportDeclarationSpecifier): string => {\n if (specifier.type === \"ImportDefaultSpecifier\") {\n return DEFAULT;\n }\n if (specifier.type === \"ImportNamespaceSpecifier\") {\n return NAMESPACE;\n }\n if (specifier.imported.type === \"Identifier\") {\n return specifier.imported.name;\n }\n return specifier.imported.value;\n};\n\nconst isTypeOnly = (\n node: ESTree.ImportDeclaration,\n specifier: ESTree.ImportDeclarationSpecifier,\n): boolean =>\n node.importKind === \"type\" ||\n (specifier.type === \"ImportSpecifier\" && specifier.importKind === \"type\");\n\nconst isBannedSpecifier =\n (node: ESTree.ImportDeclaration, ban: ImportBan, names: readonly string[]) =>\n (specifier: ESTree.ImportDeclarationSpecifier): boolean =>\n !(ban.typesAllowed && isTypeOnly(node, specifier)) &&\n Arr.contains([NAMESPACE, ...names], importedName(specifier));\n\nconst wholeImport = (node: ESTree.ImportDeclaration, ban: ImportBan): readonly ESTree.Node[] => {\n if (ban.typesAllowed && node.importKind === \"type\") {\n return [];\n }\n return [node];\n};\n\nconst bannedIn =\n (node: ESTree.ImportDeclaration) =>\n (ban: ImportBan): readonly ESTree.Node[] => {\n if (node.source.value !== ban.module) {\n return [];\n }\n return Option.match(ban.names, {\n onNone: () => wholeImport(node, ban),\n onSome: (names): readonly ESTree.Node[] =>\n pipe(node.specifiers, Arr.filter(isBannedSpecifier(node, ban, names))),\n });\n };\n\nconst propertyOf = (node: ESTree.MemberExpression): Option.Option<string> => {\n if (!node.computed && node.property.type === \"Identifier\") {\n return Option.some(node.property.name);\n }\n if (node.property.type === \"Literal\" && typeof node.property.value === \"string\") {\n return Option.some(node.property.value);\n }\n return Option.none();\n};\n\nconst isBannedMember =\n (node: ESTree.MemberExpression) =>\n (ban: MemberBan): boolean =>\n node.object.type === \"Identifier\" &&\n node.object.name === ban.object &&\n pipe(\n propertyOf(node),\n Option.exists((property) => Arr.contains(ban.properties, property)),\n );\n\nconst reportImports = (context: Context, intent: Intent, node: ESTree.ImportDeclaration): void => {\n const banned = pipe(intent.imports, Arr.flatMap(bannedIn(node)));\n for (const found of banned) {\n context.report({ node: found, message: intent.message });\n }\n};\n\nexport const ruleOf = (intent: Intent): Rule => ({\n meta: { type: \"problem\" },\n create: (context) => ({\n ImportDeclaration: (node): void => {\n reportImports(context, intent, node);\n },\n MemberExpression: (node): void => {\n if (pipe(intent.members, Arr.some(isBannedMember(node)))) {\n context.report({ node, message: intent.message });\n }\n },\n }),\n});\n","import { Option } from \"effect\";\n\nimport type { Intent } from \"./intent-rule.ts\";\n\nconst RUN_MESSAGE =\n \"Run Effects with run or runner from @r_masseater/workers-tracing/effect, so their spans reach the Workers trace.\";\n\nconst RUN_FUNCTIONS: readonly string[] = [\n \"runPromise\",\n \"runPromiseExit\",\n \"runFork\",\n \"runCallback\",\n \"runSync\",\n \"runSyncExit\",\n \"runPromiseWith\",\n \"runPromiseExitWith\",\n \"runForkWith\",\n \"runCallbackWith\",\n \"runSyncWith\",\n \"runSyncExitWith\",\n];\n\nconst HAND_WRITTEN_SQL =\n \"Build queries with the Drizzle query builder, so that their columns and types come from the schema. Do not write SQL by hand with sql.\";\n\nexport const INTENTS: Readonly<Record<string, Intent>> = {\n \"ui-state-in-atoms\": {\n message:\n \"Keep UI state in effect-atom (Atom.make, useAtom, useAtomValue), so that state has one home outside the component tree. Do not use React state hooks or context.\",\n imports: [\n {\n module: \"react\",\n names: Option.some([\"useState\", \"useReducer\", \"createContext\", \"useContext\"]),\n typesAllowed: false,\n },\n ],\n members: [],\n },\n \"no-hand-written-sql\": {\n message: HAND_WRITTEN_SQL,\n imports: [\n { module: \"drizzle-orm\", names: Option.some([\"sql\"]), typesAllowed: false },\n { module: \"drizzle-orm/sql\", names: Option.none(), typesAllowed: false },\n ],\n members: [],\n },\n \"traced-elysia\": {\n message:\n \"Import Elysia from @r_masseater/workers-tracing/elysia, so every handle call is a span.\",\n imports: [{ module: \"elysia\", names: Option.some([\"Elysia\", \"default\"]), typesAllowed: true }],\n members: [],\n },\n \"traced-effect-run\": {\n message: RUN_MESSAGE,\n imports: [\n { module: \"effect/Effect\", names: Option.some(RUN_FUNCTIONS), typesAllowed: false },\n { module: \"effect/ManagedRuntime\", names: Option.some([\"make\"]), typesAllowed: false },\n ],\n members: [\n { object: \"Effect\", properties: RUN_FUNCTIONS },\n { object: \"ManagedRuntime\", properties: [\"make\"] },\n ],\n },\n \"platform-node-by-module\": {\n message:\n 'Import names from a module path, such as import { layer } from \"@effect/platform-node/NodeServices\". The package root loads every module, the Redis client included, and adds about 250 ms to each start.',\n imports: [{ module: \"@effect/platform-node\", names: Option.none(), typesAllowed: true }],\n members: [],\n },\n \"typed-calls-not-reflect\": {\n message:\n \"Read properties and call functions through typed access, or decode untyped values with Schema at the boundary. Do not go around the types with Reflect.\",\n imports: [],\n members: [{ object: \"Reflect\", properties: [\"get\", \"apply\"] }],\n },\n \"db-writes-in-writers\": {\n message:\n \"Write tables only from a *-writer.server.ts module, so that a table update and its revision go into the same batch. Call the writer here instead of writing through db.\",\n imports: [],\n members: [{ object: \"db\", properties: [\"insert\", \"update\", \"delete\", \"batch\", \"run\"] }],\n },\n};\n","import { Record as Rec, pipe } from \"effect\";\nimport type { Plugin } from \"vite-plus/lint/plugins\";\n\nimport { CODED_RULES } from \"./coded-rules.ts\";\nimport { ruleOf } from \"./intent-rule.ts\";\nimport { INTENTS } from \"./intents.ts\";\n\nexport const mschLintPlugin: Plugin & { readonly meta: { readonly name: string } } = {\n meta: { name: \"msch-lint\" },\n rules: {\n ...CODED_RULES,\n ...pipe(INTENTS, Rec.map(ruleOf)),\n },\n};\n"],"mappings":";;;;;;AAeA,MAAM,QAAQ;AACd,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,MAAM,QAAQ;AACd,MAAMA,QAAM;AAEZ,MAAM,cAAc,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,MAAM,CAAC;AAC/D,MAAM,eAAe,OAAO,OAAO,EAAE,OAAO,YAAY,CAAC;AAIzD,MAAM,eAAe,OAAO,oBAAoB,YAAY;AAE5D,MAAM,mBAAmB,OAAO,OAAO;CAAE,MAAM,OAAO,QAAQ,YAAY;CAAG,MAAM,OAAO;AAAO,CAAC;AAElG,MAAM,eAAe,OAAO,OAAO;CACjC,MAAM,OAAO,QAAQ,kBAAkB;CACvC,UAAU,OAAO,QAAQ,KAAK;CAC9B,QAAQ;CACR,UAAU;AACZ,CAAC;AAED,MAAM,mBAAmB,OAAO,OAAO;CACrC,MAAM,OAAO,QAAQ,gBAAgB;CACrC,QAAQ;CACR,WAAW,OAAO,MAAM,YAAY;AACtC,CAAC;AAED,MAAM,mBAAmB,OA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A2B;EACzB,SACE;EACF,SAAS,CAAC;EACV,SAAS,CAAC;GAAE,QAAQ;GAAW,YAAY,CAAC,OAAO,OAAO;EAAE,CAAC;CAC/D;CACA,wBAAwB;EACtB,SACE;EACF,SAAS,CAAC;EACV,SAAS,CAAC;GAAE,QAAQ;GAAM,YAAY;IAAC;IAAU;IAAU;IAAU;IAAS;GAAK;EAAE,CAAC;CACxF;AACF;;AC1EA,MAAa,iBAAwE;CACnF,MAAM,EAAE,MAAM,YAAY;CAC1B,OAAO;EACL,GAAG;EACH,GAAG,KAAK,SAASC,OAAI,IAAI,MAAM,CAAC;CAClC;AACF"}
|
|
1
|
+
{"version":3,"file":"lint-rules.mjs","names":["ONE","Str","Arr","MESSAGE","ONE","Arr","Arr","Rec","MESSAGE_ID","MESSAGE","Str","Arr","visitorOf","MESSAGE","Arr","MESSAGE","Arr","MESSAGE","Str","Arr","Arr","Arr","Str","Arr","Str","Arr","Rec"],"sources":["../src/features/define-lint-rules/model/get-or-insert-ast.ts","../src/features/define-lint-rules/model/array-from-async.ts","../src/features/define-lint-rules/model/ecosystem-readers.ts","../src/features/define-lint-rules/model/typed-rule.ts","../src/features/define-lint-rules/model/explicit-import-path.ts","../src/features/define-lint-rules/model/get-or-insert.ts","../src/features/define-lint-rules/model/inline-exports.ts","../src/features/define-lint-rules/model/mcp-tool-layer.ts","../src/features/define-lint-rules/model/declared-outside.ts","../src/features/define-lint-rules/model/writable-part.ts","../src/features/define-lint-rules/model/readonly-parameters.ts","../src/features/define-lint-rules/model/coded-rules.ts","../src/features/define-lint-rules/model/intent-rule.ts","../src/features/define-lint-rules/model/intents.ts","../src/features/define-lint-rules/model/plugin.ts"],"sourcesContent":["import { Array as Arr, Option, Predicate, Schema, String as Str, pipe } from \"effect\";\n\nexport type Keys = Readonly<Record<string, readonly string[] | undefined>>;\n\nexport interface Scope {\n readonly text: string;\n readonly keys: Keys;\n}\n\nexport interface Access {\n readonly map: string;\n readonly key: string;\n readonly value: Option.Option<string>;\n}\n\nconst START = 0;\nconst END = 1;\nconst KEY = 0;\nconst VALUE = 1;\nconst ONE = 1;\n\nconst RangeSchema = Schema.Tuple([Schema.Finite, Schema.Finite]);\nconst RangedSchema = Schema.Struct({ range: RangeSchema });\n\ntype Ranged = typeof RangedSchema.Type;\n\nconst decodeRanged = Schema.decodeUnknownOption(RangedSchema);\n\nconst IdentifierSchema = Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String });\n\nconst MemberSchema = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n computed: Schema.Literal(false),\n object: RangedSchema,\n property: IdentifierSchema,\n});\n\nconst MemberCallSchema = Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: MemberSchema,\n arguments: Schema.Array(RangedSchema),\n});\n\nconst decodeMemberCall = Schema.decodeUnknownOption(MemberCallSchema);\n\nconst decodeCall = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: RangedSchema,\n arguments: Schema.Array(Schema.Unknown),\n }),\n);\n\nconst decodeBlock = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"BlockStatement\"), body: Schema.Array(Schema.Unknown) }),\n);\n\nconst decodeExpressionStatement = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"ExpressionStatement\"), expression: Schema.Unknown }),\n);\n\nconst decodeReturn = Schema.decodeUnknownOption(\n Schema.Struct({ type: Schema.Literal(\"ReturnStatement\"), argument: RangedSchema }),\n);\n\nconst decodeTyped = Schema.decodeUnknownOption(Schema.Struct({ type: Schema.String }));\n\nconst textOf =\n (scope: Scope) =>\n (node: Ranged): string =>\n Str.slice(node.range[START], node.range[END])(scope.text);\n\nexport const textOfNode =\n (scope: Scope) =>\n (node: unknown): Option.Option<string> =>\n pipe(decodeRanged(node), Option.map(textOf(scope)));\n\nexport const accessOf =\n (scope: Scope) =>\n (method: string) =>\n (node: unknown): Option.Option<Access> =>\n pipe(\n decodeMemberCall(node),\n Option.filter((call) => call.callee.property.name === method),\n Option.flatMap((call) =>\n pipe(\n Arr.get(call.arguments, KEY),\n Option.map((key) => ({\n map: textOf(scope)(call.callee.object),\n key: textOf(scope)(key),\n value: pipe(Arr.get(call.arguments, VALUE), Option.map(textOf(scope))),\n })),\n ),\n ),\n );\n\nexport const sameEntry =\n (left: Access) =>\n (right: Access): boolean =>\n left.map === right.map && left.key === right.key;\n\nexport const calleeMatches =\n (scope: Scope) =>\n (pattern: RegExp) =>\n (node: unknown): Option.Option<readonly unknown[]> =>\n pipe(\n decodeCall(node),\n Option.filter((call) => pattern.test(textOf(scope)(call.callee))),\n Option.map((call) => call.arguments),\n );\n\nexport const expressionOf = (statement: unknown): Option.Option<unknown> =>\n pipe(\n decodeExpressionStatement(statement),\n Option.map((found) => found.expression),\n );\n\nexport const returnedText =\n (scope: Scope) =>\n (statement: unknown): Option.Option<string> =>\n pipe(\n decodeReturn(statement),\n Option.map((found) => textOf(scope)(found.argument)),\n );\n\nexport const bodyOf = (node: unknown): Option.Option<readonly unknown[]> =>\n pipe(\n decodeBlock(node),\n Option.map((block) => block.body),\n );\n\nexport const onlyStatement = (statement: unknown): Option.Option<unknown> =>\n Option.match(bodyOf(statement), {\n onNone: () => Option.some(statement),\n onSome: (body) =>\n Option.flatMap(\n Option.liftPredicate(body, (all) => all.length === ONE),\n Arr.head,\n ),\n });\n\nexport const typeOf = (node: unknown): string =>\n pipe(decodeTyped(node), Option.match({ onNone: () => \"\", onSome: (found) => found.type }));\n\nexport const parentOf = (node: unknown): Option.Option<unknown> =>\n pipe(\n Option.liftPredicate(node, Predicate.hasProperty(\"parent\")),\n Option.flatMap((found) => Option.fromNullishOr(found.parent)),\n );\n\nconst childrenOf = (keys: Keys, node: unknown): readonly unknown[] =>\n pipe(\n Option.liftPredicate(node, Predicate.isObject),\n Option.match({\n onNone: (): readonly unknown[] => [],\n onSome: (found) =>\n pipe(\n keys[typeOf(found)] ?? [],\n Arr.flatMap((key): readonly unknown[] =>\n pipe(\n Option.liftPredicate(found, Predicate.hasProperty(key)),\n Option.match({\n onNone: (): readonly unknown[] => [],\n onSome: (owner) => Arr.ensure(owner[key]),\n }),\n ),\n ),\n Arr.filter(Predicate.isObject),\n ),\n }),\n );\n\nexport const descendants =\n (keys: Keys) =>\n (node: unknown): readonly unknown[] => [\n node,\n ...pipe(childrenOf(keys, node), Arr.flatMap(descendants(keys))),\n ];\n\nexport const accessesIn =\n (scope: Scope) =>\n (method: string) =>\n (node: unknown): readonly Access[] =>\n pipe(descendants(scope.keys)(node), Arr.map(accessOf(scope)(method)), Arr.getSomes);\n","import { Array as Arr, Option, Schema, pipe } from \"effect\";\nimport type { Rule } from \"vite-plus/lint/plugins\";\n\nimport { expressionOf, onlyStatement } from \"./get-or-insert-ast.ts\";\n\nconst MESSAGE =\n \"Collect an async iterable with Array.fromAsync, passing the mapping as its second argument. Do not push each item from a for await loop.\";\n\nconst ONE = 1;\n\nconst DeclarationSchema = Schema.Struct({\n type: Schema.Literal(\"VariableDeclaration\"),\n declarations: Schema.Array(Schema.Unknown),\n});\n\nconst decodeLoop = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"ForOfStatement\"),\n await: Schema.Literal(true),\n left: DeclarationSchema,\n body: Schema.Unknown,\n }),\n);\n\nconst PushNameSchema = Schema.Struct({\n type: Schema.Literal(\"Identifier\"),\n name: Schema.Literal(\"push\"),\n});\n\nconst PushCalleeSchema = Schema.Struct({\n type: Schema.Literal(\"MemberExpression\"),\n computed: Schema.Literal(false),\n property: PushNameSchema,\n});\n\nconst ArgumentSchema = Schema.Struct({ type: Schema.String });\n\nconst decodePush = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"CallExpression\"),\n callee: PushCalleeSchema,\n arguments: Schema.Array(ArgumentSchema),\n }),\n);\n\nconst pushesOne = (statement: unknown): boolean =>\n pipe(\n expressionOf(statement),\n Option.flatMap(decodePush),\n Option.exists(\n (call) =>\n call.arguments.length === ONE &&\n !pipe(\n call.arguments,\n Arr.some((argument) => argument.type === \"SpreadElement\"),\n ),\n ),\n );\n\nconst collectsByHand = (node: unknown): boolean =>\n pipe(\n decodeLoop(node),\n Option.filter((loop) => loop.left.declarations.length === ONE),\n Option.flatMap((loop) => onlyStatement(loop.body)),\n Option.exists(pushesOne),\n );\n\nexport const arrayFromAsync: Rule = {\n meta: { type: \"suggestion\" },\n create: (context) => ({\n ForOfStatement: (node): void => {\n if (collectsByHand(node)) {\n context.report({ node, message: MESSAGE });\n }\n },\n }),\n};\n","import { baseName } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Option, Record as Rec, pipe } from \"effect\";\nimport type { Context, ESTree, Rule } from \"vite-plus/lint/plugins\";\n\ntype Format = \"json\" | \"toml\" | \"typescript\" | \"yaml\";\n\ninterface EcosystemFile {\n readonly name: RegExp;\n readonly format: Format;\n readonly reader: string;\n}\n\nconst ECOSYSTEM_FILES: readonly EcosystemFile[] = [\n {\n name: /^pnpm-workspace\\.yaml$/u,\n format: \"yaml\",\n reader:\n \"readWorkspaceManifest from @pnpm/workspace.workspace-manifest-reader, findWorkspaceProjects from @pnpm/workspace.projects-reader or updateWorkspaceManifest from @pnpm/workspace.workspace-manifest-writer\",\n },\n {\n name: /^pnpm-lock\\.yaml$/u,\n format: \"yaml\",\n reader: \"readWantedLockfile from @pnpm/lockfile.fs\",\n },\n { name: /^Cargo\\.(?:toml|lock)$/u, format: \"toml\", reader: \"cargo metadata\" },\n {\n name: /^tsconfig(?:\\.[\\w-]+)?\\.json$/u,\n format: \"json\",\n reader: \"parse from tsconfck or the TypeScript compiler API\",\n },\n {\n name: /^vite\\.config\\.[cm]?[jt]s$/u,\n format: \"typescript\",\n reader:\n \"resolveConfigFromFile from vite-plus, or parse from vite-plus for a read that must not run the file\",\n },\n];\n\nconst PARSER_MODULES: Readonly<Record<Format, readonly string[]>> = {\n json: [\"jsonc-parser\", \"json5\", \"strip-json-comments\"],\n toml: [\"smol-toml\", \"@iarna/toml\", \"toml\", \"toml-eslint-parser\"],\n typescript: [\"typescript\", \"oxc-parser\", \"@babel/parser\", \"@typescript-eslint/parser\", \"acorn\"],\n yaml: [\"yaml\", \"js-yaml\"],\n};\n\nconst PARSER_CALLS: Readonly<Record<Format, Option.Option<RegExp>>> = {\n json: Option.some(/\\b(?:JSON\\.parse|parseJson)\\b/u),\n toml: Option.none(),\n typescript: Option.none(),\n yaml: Option.none(),\n};\n\nconst importedModules = (statements: readonly ESTree.Statement[]): readonly string[] =>\n pipe(\n statements,\n Arr.filter((statement) => statement.type === \"ImportDeclaration\"),\n Arr.map((declaration) => declaration.source.value),\n );\n\nconst parserIn =\n (context: Context) =>\n (format: Format): Option.Option<string> => {\n const imported = importedModules(context.sourceCode.ast.body);\n const fromModule = pipe(\n Rec.get(PARSER_MODULES, format),\n Option.getOrElse((): readonly string[] => []),\n Arr.findFirst((module) => Arr.contains(imported, module)),\n );\n if (Option.isSome(fromModule)) {\n return fromModule;\n }\n return pipe(\n Rec.get(PARSER_CALLS, format),\n Option.flatten,\n Option.flatMap((pattern) => Option.fromNullishOr(pattern.exec(context.sourceCode.text))),\n Option.map(([call]) => call),\n );\n };\n\nconst messageFor =\n (context: Context) =>\n (text: string): Option.Option<string> => {\n const name = baseName(text);\n return pipe(\n ECOSYSTEM_FILES,\n Arr.findFirst((entry) => entry.name.test(name)),\n Option.flatMap(({ format, reader }) =>\n pipe(\n parserIn(context)(format),\n Option.map(\n (parser) =>\n `${name} has an official reader: ${reader}. Read it with that instead of parsing it with ${parser}, so that the file means what its own tool says it means.`,\n ),\n ),\n ),\n );\n };\n\nexport const ecosystemReaders: Rule = {\n meta: { type: \"problem\" },\n create: (context) => ({\n Literal: (node): void => {\n const message = pipe(\n Option.liftPredicate(node.value, (value) => typeof value === \"string\"),\n Option.flatMap(messageFor(context)),\n );\n if (Option.isSome(message)) {\n context.report({ node, message: message.value });\n }\n },\n TemplateElement: (node): void => {\n const message = messageFor(context)(node.value.raw);\n if (Option.isSome(message)) {\n context.report({ node, message: message.value });\n }\n },\n }),\n};\n","import { withTypeInformation } from \"@r_masseater/oxlint-typed-rules\";\nimport type { ParserServices, TypedContext } from \"@r_masseater/oxlint-typed-rules\";\nimport { Option, pipe } from \"effect\";\nimport type { Rule, RuleMeta, Visitor } from \"vite-plus/lint/plugins\";\n\nexport interface TypedRuleParts {\n readonly meta: RuleMeta;\n readonly visitorOf: (context: TypedContext, services: ParserServices) => Visitor;\n}\n\nexport const typedRuleOf = ({ meta, visitorOf }: TypedRuleParts): Rule =>\n withTypeInformation({\n meta,\n create: (context: TypedContext) =>\n pipe(\n Option.fromNullishOr(context.sourceCode.parserServices),\n Option.match({\n onNone: (): Visitor => ({}),\n onSome: (services) => visitorOf(context, services),\n }),\n ),\n });\n","import { baseName, parent } from \"@masseater.dev/path-kit\";\nimport type { ParserServices, TypedContext } from \"@r_masseater/oxlint-typed-rules\";\nimport { Array as Arr, Option, Predicate, String as Str, pipe } from \"effect\";\nimport type { ESTree, Rule, Visitor } from \"vite-plus/lint/plugins\";\n\nimport { typedRuleOf } from \"./typed-rule.ts\";\n\nconst MESSAGE_ID = \"spellOut\";\nconst MESSAGE =\n \"`{{specifier}}` does not name a file. Write `{{fixed}}`: Node ESM and TypeScript nodenext resolve neither a missing extension nor a directory index, so spelling out the file works under every resolver.\";\n\nconst RELATIVE = /^\\.{1,2}(?:\\/|$)/u;\nconst PARTS = /^(?<path>[^?]*)(?<query>.*)$/su;\nconst TRAILING_SEPARATORS = /\\/+$/u;\nconst DIRECTORY_NAMES: readonly string[] = [\".\", \"..\"];\nconst INDEX = \"index.\";\nconst DEFAULT_QUOTE = '\"';\nconst FIRST = 0;\n\ninterface Parts {\n readonly path: string;\n readonly query: string;\n}\n\nconst partsOf = (specifier: string): Option.Option<Parts> =>\n pipe(\n Str.match(PARTS)(specifier),\n Option.flatMap((matched) => Option.fromNullishOr(matched.groups)),\n Option.map((groups) => ({ path: groups[\"path\"] ?? \"\", query: groups[\"query\"] ?? \"\" })),\n );\n\nconst completionOf = (resolved: string, path: string): Option.Option<string> => {\n const file = baseName(resolved);\n const name = baseName(path);\n const index = Str.startsWith(INDEX)(file);\n if (Arr.contains(DIRECTORY_NAMES, name)) {\n return Option.liftPredicate(`/${file}`, () => index);\n }\n if (Str.startsWith(`${name}.`)(file)) {\n return Option.some(Str.slice(name.length)(file));\n }\n return Option.liftPredicate(`/${file}`, () => index && baseName(parent(resolved)) === name);\n};\n\nconst resolvedFileOf = (\n services: ParserServices,\n source: ESTree.StringLiteral,\n): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(services.getSymbolAtLocation(source)),\n Option.flatMap((symbol) => Arr.head(symbol.declarations)),\n Option.map((declaration) => declaration.getSourceFile().fileName),\n );\n\nconst fixedOf = (services: ParserServices, source: ESTree.StringLiteral): Option.Option<string> =>\n pipe(\n partsOf(source.value),\n Option.filter(({ path }) => RELATIVE.test(path)),\n Option.flatMap(({ path, query }) =>\n pipe(\n resolvedFileOf(services, source),\n Option.flatMap((resolved) =>\n completionOf(resolved, Str.replace(TRAILING_SEPARATORS, \"\")(path)),\n ),\n Option.map(\n (completion) => `${Str.replace(TRAILING_SEPARATORS, \"\")(path)}${completion}${query}`,\n ),\n ),\n ),\n );\n\nconst quoteOf = (source: ESTree.StringLiteral): string =>\n pipe(\n Option.fromNullishOr(source.raw),\n Option.flatMap(Str.charAt(FIRST)),\n Option.getOrElse(() => DEFAULT_QUOTE),\n );\n\nconst isStringLiteral = (node: ESTree.Node | null): node is ESTree.StringLiteral =>\n Predicate.isNotNull(node) && node.type === \"Literal\" && Predicate.isString(node.value);\n\nconst visitorOf = (context: TypedContext, services: ParserServices): Visitor => {\n const check = (source: ESTree.Node | null): void => {\n if (!isStringLiteral(source)) {\n return;\n }\n const fixed = fixedOf(services, source);\n if (Option.isSome(fixed)) {\n context.report({\n node: source,\n messageId: MESSAGE_ID,\n data: { specifier: source.value, fixed: fixed.value },\n fix: (fixer) =>\n fixer.replaceText(source, `${quoteOf(source)}${fixed.value}${quoteOf(source)}`),\n });\n }\n };\n return {\n ImportDeclaration: (node): void => {\n check(node.source);\n },\n ExportAllDeclaration: (node): void => {\n check(node.source);\n },\n ExportNamedDeclaration: (node): void => {\n check(node.source);\n },\n ImportExpression: (node): void => {\n check(node.source);\n },\n };\n};\n\nexport const explicitImportPath: Rule = typedRuleOf({\n meta: { type: \"suggestion\", fixable: \"code\", messages: { [MESSAGE_ID]: MESSAGE } },\n visitorOf,\n});\n","import { Array as Arr, Option, Schema, pipe } from \"effect\";\nimport type { Rule } from \"vite-plus/lint/plugins\";\n\nimport {\n accessOf,\n accessesIn,\n bodyOf,\n calleeMatches,\n descendants,\n expressionOf,\n onlyStatement,\n parentOf,\n returnedText,\n sameEntry,\n textOfNode,\n typeOf,\n} from \"./get-or-insert-ast.ts\";\nimport type { Access, Scope } from \"./get-or-insert-ast.ts\";\n\nconst MESSAGE =\n \"Use getOrInsert or getOrInsertComputed on the Map or WeakMap, so that reading a key and storing its first value is one call. Do not read the key and then set it by hand.\";\n\nconst ONE = 1;\nconst TWO = 2;\nconst OPTION_FROM = /^(?:Option\\.)?from(?:NullishOr|UndefinedOr|Nullable)$/u;\nconst GET_OR_ELSE = /^(?:Option\\.)?getOrElse$/u;\nconst FUNCTIONS: readonly string[] = [\"ArrowFunctionExpression\", \"FunctionExpression\"];\n\nconst decodeGuard = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"IfStatement\"),\n test: Schema.Unknown,\n consequent: Schema.Unknown,\n alternate: Schema.Null,\n }),\n);\n\nconst decodeNot = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"UnaryExpression\"),\n operator: Schema.Literal(\"!\"),\n argument: Schema.Unknown,\n }),\n);\n\nconst DeclaratorSchema = Schema.Struct({\n id: Schema.Struct({ type: Schema.Literal(\"Identifier\"), name: Schema.String }),\n init: Schema.Unknown,\n});\n\ntype Declarator = typeof DeclaratorSchema.Type;\n\nconst decodeDeclaration = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"VariableDeclaration\"),\n declarations: Schema.Array(DeclaratorSchema),\n }),\n);\n\nconst decodeNullish = Schema.decodeUnknownOption(\n Schema.Struct({\n type: Schema.Literal(\"LogicalExpression\"),\n operator: Schema.Literal(\"??\"),\n left: Schema.Unknown,\n }),\n);\n\nconst storeOf =\n (scope: Scope) =>\n (statement: unknown): Option.Option<Access> =>\n pipe(expressionOf(statement), Option.flatMap(accessOf(scope)(\"set\")));\n\nconst isHasGuard = (scope: Scope, node: unknown): boolean =>\n pipe(\n decodeGuard(node),\n Option.exists((guard) => {\n const guarded = pipe(\n decodeNot(guard.test),\n Option.flatMap((not) => accessOf(scope)(\"has\")(not.argument)),\n );\n const stored = pipe(onlyStatement(guard.consequent), Option.flatMap(storeOf(scope)));\n return Option.isSome(guarded) && Option.exists(stored, sameEntry(guarded.value));\n }),\n );\n\nconst deletes =\n (scope: Scope, read: Access) =>\n (statement: unknown): boolean =>\n pipe(\n expressionOf(statement),\n Option.flatMap(accessOf(scope)(\"delete\")),\n Option.exists(sameEntry(read)),\n );\n\nconst storesBack =\n (scope: Scope, read: Access, name: string) =>\n (statement: unknown): boolean =>\n Option.exists(\n storeOf(scope)(statement),\n (stored) => sameEntry(read)(stored) && Option.exists(stored.value, (value) => value === name),\n );\n\nconst fallsBack =\n (scope: Scope, later: readonly unknown[]) =>\n (declarator: Declarator): boolean =>\n pipe(\n decodeNullish(declarator.init),\n Option.flatMap((nullish) => accessOf(scope)(\"get\")(nullish.left)),\n Option.exists(\n (read) =>\n pipe(later, Arr.some(storesBack(scope, read, declarator.id.name))) &&\n !pipe(later, Arr.some(deletes(scope, read))),\n ),\n );\n\nconst fallbackIndices = (scope: Scope, body: readonly unknown[]): readonly number[] =>\n pipe(\n body,\n Arr.map((statement, index) => {\n const fallsBackLater = fallsBack(scope, Arr.drop(body, index + ONE));\n return pipe(\n decodeDeclaration(statement),\n Option.map((declaration) => declaration.declarations),\n Option.filter(Arr.some(fallsBackLater)),\n Option.as(index),\n );\n }),\n Arr.getSomes,\n );\n\ninterface CachedCheck {\n readonly test: (name: string) => string;\n readonly value: (name: string) => string;\n}\n\nconst itself = (name: string): string => name;\n\nconst CACHED_CHECKS: readonly CachedCheck[] = [\n { test: (name) => `${name} !== undefined`, value: itself },\n { test: (name) => `${name} != null`, value: itself },\n { test: (name) => `${name} !== null`, value: itself },\n { test: (name) => `Predicate.isNotUndefined(${name})`, value: itself },\n { test: (name) => `Predicate.isNotNullish(${name})`, value: itself },\n { test: itself, value: itself },\n { test: (name) => `Option.isSome(${name})`, value: (name) => `${name}.value` },\n];\n\nconst returnsCached =\n (scope: Scope, name: string) =>\n (statement: unknown): boolean =>\n pipe(\n decodeGuard(statement),\n Option.exists((guard) => {\n const tested = textOfNode(scope)(guard.test);\n const returned = pipe(onlyStatement(guard.consequent), Option.flatMap(returnedText(scope)));\n return pipe(\n CACHED_CHECKS,\n Arr.some(\n (check) =>\n Option.exists(tested, (found) => found === check.test(name)) &&\n Option.exists(returned, (found) => found === check.value(name)),\n ),\n );\n }),\n );\n\nconst unwrapOption =\n (scope: Scope) =>\n (node: unknown): unknown =>\n pipe(\n calleeMatches(scope)(OPTION_FROM)(node),\n Option.flatMap(Arr.head),\n Option.getOrElse(() => node),\n );\n\nconst readsCached =\n (scope: Scope, stored: Access) =>\n (declarator: Declarator): boolean =>\n pipe(\n unwrapOption(scope)(declarator.init),\n accessOf(scope)(\"get\"),\n Option.exists(sameEntry(stored)),\n );\n\nconst earlyReturn = (scope: Scope, body: readonly unknown[], stored: Access): boolean =>\n pipe(\n body,\n Arr.some((statement, index) =>\n pipe(\n decodeDeclaration(statement),\n Option.flatMap((declaration) => Arr.head(declaration.declarations)),\n Option.filter(readsCached(scope, stored)),\n Option.exists((declarator) =>\n Option.exists(Arr.get(body, index + ONE), returnsCached(scope, declarator.id.name)),\n ),\n ),\n ),\n );\n\nconst storedAndReturned = (scope: Scope, body: readonly unknown[]): Option.Option<Access> => {\n const returned = pipe(Arr.last(body), Option.flatMap(returnedText(scope)));\n return pipe(\n Arr.get(body, body.length - TWO),\n Option.flatMap(storeOf(scope)),\n Option.filter(\n (stored) => Option.isSome(returned) && Option.contains(stored.value, returned.value),\n ),\n );\n};\n\nconst optionRegion = (scope: Scope, block: unknown): Option.Option<unknown> =>\n pipe(\n parentOf(block),\n Option.filter((fn) => Arr.contains(FUNCTIONS, typeOf(fn))),\n Option.flatMap(parentOf),\n Option.filter((call) => Option.isSome(calleeMatches(scope)(GET_OR_ELSE)(call))),\n Option.flatMap(parentOf),\n );\n\nconst readsThroughOption =\n (scope: Scope, stored: Access) =>\n (node: unknown): boolean =>\n pipe(\n calleeMatches(scope)(OPTION_FROM)(node),\n Option.flatMap(Arr.head),\n Option.flatMap(accessOf(scope)(\"get\")),\n Option.exists(sameEntry(stored)),\n );\n\nconst storesOnce =\n (scope: Scope, stored: Access) =>\n (region: unknown): boolean =>\n pipe(accessesIn(scope)(\"set\")(region), Arr.filter(sameEntry(stored))).length === ONE;\n\nconst returnsOnce = (scope: Scope, block: unknown): boolean =>\n pipe(\n descendants(scope.keys)(block),\n Arr.filter((node) => typeOf(node) === \"ReturnStatement\"),\n ).length === ONE;\n\nconst fallsBackInOption = (scope: Scope, block: unknown, stored: Access): boolean =>\n returnsOnce(scope, block) &&\n Option.exists(\n optionRegion(scope, block),\n (region) =>\n pipe(descendants(scope.keys)(region), Arr.some(readsThroughOption(scope, stored))) &&\n storesOnce(scope, stored)(region),\n );\n\nconst isMemoized = (scope: Scope, block: unknown): boolean =>\n pipe(\n bodyOf(block),\n Option.exists((body) =>\n Option.exists(storedAndReturned(scope, body), (stored) => {\n if (earlyReturn(scope, body, stored)) {\n return storesOnce(scope, stored)(block);\n }\n return fallsBackInOption(scope, block, stored);\n }),\n ),\n );\n\nexport const getOrInsert: Rule = {\n meta: { type: \"suggestion\" },\n create: (context) => {\n const scope: Scope = { text: context.sourceCode.text, keys: context.sourceCode.visitorKeys };\n return {\n IfStatement: (node): void => {\n if (isHasGuard(scope, node)) {\n context.report({ node, message: MESSAGE });\n }\n },\n BlockStatement: (node): void => {\n for (const index of fallbackIndices(scope, node.body)) {\n for (const statement of Option.toArray(Arr.get(node.body, index))) {\n context.report({ node: statement, message: MESSAGE });\n }\n }\n if (isMemoized(scope, node)) {\n context.report({ node, message: MESSAGE });\n }\n },\n };\n },\n};\n","import { Array as Arr, pipe } from \"effect\";\nimport type { Context, ESTree, Rule } from \"vite-plus/lint/plugins\";\n\nconst MESSAGE =\n \"export は宣言に付ける(export const・export function など)。ファイルの末尾で export { … } にまとめない。\";\nconst TYPE = \"type\";\nconst CLASS_NAME = \"ClassName\";\n\nconst isList = (node: ESTree.ExportNamedDeclaration): boolean =>\n node.declaration === null && node.source === null && !Arr.isReadonlyArrayEmpty(node.specifiers);\n\nconst localName = (specifier: ESTree.ExportSpecifier): string => {\n if (specifier.local.type === \"Literal\") {\n return specifier.local.value;\n }\n return specifier.local.name;\n};\n\nconst isClass = (context: Context, name: string): boolean =>\n pipe(\n context.sourceCode.scopeManager.scopes,\n Arr.flatMap((scope) => scope.variables),\n Arr.filter((variable) => variable.name === name),\n Arr.flatMap((variable) => variable.defs),\n (defs) =>\n Arr.isReadonlyArrayNonEmpty(defs) &&\n pipe(\n defs,\n Arr.every(({ type }) => type === CLASS_NAME),\n ),\n );\n\nconst isTypeOnlyClass =\n (context: Context, node: ESTree.ExportNamedDeclaration) =>\n (specifier: ESTree.ExportSpecifier): boolean =>\n (node.exportKind === TYPE || specifier.exportKind === TYPE) &&\n isClass(context, localName(specifier));\n\nexport const inlineExports: Rule = {\n meta: { type: \"suggestion\" },\n create: (context) => ({\n ExportNamedDeclaration: (node): void => {\n if (isList(node) && !pipe(node.specifiers, Arr.every(isTypeOnlyClass(context, node)))) {\n context.report({ node, message: MESSAGE });\n }\n },\n }),\n};\n","import { segments, toPosix } from \"@masseater.dev/path-kit\";\nimport { Array as Arr, Option, String as Str, pipe } from \"effect\";\nimport type { Rule } from \"vite-plus/lint/plugins\";\n\nconst SOURCE = \"/src/\";\nconst TOOL_LAYERS: readonly string[] = [\"features\", \"shared\"];\nconst TEST_FILE = /\\.test(?:\\.support)?\\.[cm]?[jt]sx?$/u;\nconst METHOD = \"registerTool\";\n\nconst MESSAGE =\n \"Register an MCP tool in the features slice of the operation it performs. A tool is one operation, so app/ only composes the slices' register functions and entities/ only holds the data they share.\";\n\nconst layerIn = (path: string): Option.Option<string> =>\n pipe(\n Str.lastIndexOf(SOURCE)(path),\n Option.map((index) => Arr.headNonEmpty(segments(Str.slice(index + SOURCE.length)(path)))),\n );\n\nconst layerOf = (filename: string): Option.Option<string> => layerIn(toPosix(filename));\n\nconst outsideToolLayers = (filename: string): boolean =>\n !TEST_FILE.test(filename) &&\n Option.exists(layerOf(filename), (layer) => !Arr.contains(TOOL_LAYERS, layer));\n\nexport const mcpToolLayer: Rule = {\n meta: { type: \"problem\" },\n create: (context) => {\n if (!outsideToolLayers(context.filename)) {\n return {};\n }\n return {\n CallExpression: (node): void => {\n const { callee } = node;\n if (\n callee.type === \"MemberExpression\" &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === METHOD\n ) {\n context.report({ node: callee.property, message: MESSAGE });\n }\n },\n };\n },\n};\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport { SymbolFlags } from \"typescript/sync\";\nimport type { NodeHandle, Project, Symbol as TypeSymbol } from \"typescript/sync\";\n\nexport type Origin = \"own\" | \"package\" | \"builtin\";\n\nconst origins = new WeakMap<TypeSymbol, Origin>();\nconst readonlyForms = new WeakMap<Project, Map<string, Option.Option<string>>>();\n\nconst fileOrigin = (project: Project, handle: NodeHandle): Option.Option<Origin> =>\n pipe(\n Option.fromNullishOr(project.program.getSourceFileMetadataByPath(handle.path)),\n Option.flatMap(({ isDefaultLibrary, isFromExternalLibrary }): Option.Option<Origin> => {\n if (isDefaultLibrary) {\n return Option.some(\"builtin\");\n }\n if (isFromExternalLibrary) {\n return Option.some(\"package\");\n }\n return Option.none();\n }),\n );\n\nconst declarationOrigin =\n (project: Project) =>\n (handle: NodeHandle): Origin =>\n pipe(\n fileOrigin(project, handle),\n Option.orElse(() =>\n pipe(\n Option.fromNullishOr(handle.resolve(project)),\n Option.filter((node) => node.getSourceFile().isDeclarationFile),\n Option.as<Origin>(\"package\"),\n ),\n ),\n Option.getOrElse((): Origin => \"own\"),\n );\n\nexport const originOf =\n (project: Project) =>\n (symbol: TypeSymbol): Origin =>\n origins.getOrInsertComputed(symbol, () => {\n const found = pipe(symbol.declarations, Arr.map(declarationOrigin(project)));\n if (Arr.contains(found, \"builtin\")) {\n return \"builtin\";\n }\n if (Arr.contains(found, \"package\")) {\n return \"package\";\n }\n return \"own\";\n });\n\nconst builtinNamed =\n (project: Project) =>\n (name: string): Option.Option<string> =>\n pipe(\n Option.fromNullishOr(project.checker.resolveName(name, SymbolFlags.Type)),\n Option.filter((symbol) => originOf(project)(symbol) === \"builtin\"),\n Option.as(name),\n );\n\nexport const readonlyFormOf =\n (project: Project) =>\n (name: string): Option.Option<string> =>\n readonlyForms\n .getOrInsertComputed(project, () => new Map<string, Option.Option<string>>())\n .getOrInsertComputed(name, () =>\n pipe([`Readonly${name}`, `${name}ReadOnly`], Arr.findFirst(builtinNamed(project))),\n );\n","import { Array as Arr, Option, String as Str, pipe } from \"effect\";\nimport type { Checker, Project, Symbol as TypeSymbol, Type } from \"typescript/sync\";\n\nimport { originOf, readonlyFormOf } from \"./declared-outside.ts\";\nimport type { Origin } from \"./declared-outside.ts\";\n\nexport type Mutability =\n | { readonly kind: \"array\" }\n | { readonly kind: \"tuple\" }\n | { readonly kind: \"property\" }\n | { readonly kind: \"index\" }\n | { readonly kind: \"form\"; readonly name: string; readonly readonlyName: string };\n\nexport interface WritablePart {\n readonly path: readonly string[];\n readonly mutability: Mutability;\n}\n\ntype Found = Option.Option<WritablePart>;\n\ninterface Search {\n readonly project: Project;\n readonly partOf: (type: Type) => Found;\n}\n\nexport const ELEMENT = \"[]\";\n\nconst MUTABLE_ARRAY = \"Array\";\nconst PRIVATE_NAME = \"__#\";\nconst SYMBOL_NAME = \"__@\";\n\nconst here = (mutability: Mutability): Found => Option.some({ path: [], mutability });\n\nconst under =\n (segment: string) =>\n (part: WritablePart): WritablePart => ({ ...part, path: [segment, ...part.path] });\n\nconst firstPart = (search: Search, types: readonly Type[]): Found =>\n pipe(types, Arr.findFirst(search.partOf));\n\nconst formOf =\n (project: Project) =>\n (name: string): Found =>\n pipe(\n readonlyFormOf(project)(name),\n Option.flatMap((readonlyName) => here({ kind: \"form\", name, readonlyName })),\n );\n\nconst isOpaqueAlias = (project: Project, type: Type): boolean =>\n pipe(\n Option.fromNullishOr(type.getAliasSymbol()),\n Option.exists((alias) => {\n const origin = originOf(project)(alias);\n return (\n origin === \"package\" ||\n (origin === \"builtin\" && Arr.isReadonlyArrayEmpty(type.getAliasTypeArguments()))\n );\n }),\n );\n\nconst isNamed = (type: Type): boolean =>\n type.isClassOrInterface() || (type.isTypeReference() && type.getTarget().isClassOrInterface());\n\nconst declaredOutside = (project: Project, type: Type): Option.Option<Found> =>\n pipe(\n Option.fromNullishOr(type.getSymbol()),\n Option.flatMap((symbol): Option.Option<Found> => {\n const origin = originOf(project)(symbol);\n if (origin === \"package\") {\n return Option.some(Option.none());\n }\n if (origin === \"own\" || !isNamed(type)) {\n return Option.none();\n }\n return Option.some(formOf(project)(symbol.name));\n }),\n );\n\nconst isOutside = (project: Project, type: Type): boolean =>\n isOpaqueAlias(project, type) ||\n (type.isObjectType() && Option.exists(declaredOutside(project, type), Option.isNone));\n\nconst sourceOf = (type: Type): Option.Option<Type> => {\n if (!type.isMappedType()) {\n return Option.none();\n }\n const template = type.getTemplateType();\n if (!template.isIndexedAccessType()) {\n return Option.none();\n }\n return Option.some(template.getObjectType());\n};\n\nconst takenFromOutside =\n (project: Project) =>\n (type: Type): readonly string[] => {\n if (isOutside(project, type)) {\n return pipe(\n type.getProperties(),\n Arr.map((property) => property.name),\n );\n }\n if (type.isUnionType() || type.isIntersectionType()) {\n return pipe(type.getTypes(), Arr.flatMap(takenFromOutside(project)));\n }\n return pipe(\n sourceOf(type),\n Option.map(takenFromOutside(project)),\n Option.getOrElse((): readonly string[] => []),\n );\n };\n\nconst elementsPart = (search: Search, type: Type): Found => {\n if (!type.isTypeReference()) {\n return Option.none();\n }\n return pipe(\n firstPart(search, search.project.checker.getTypeArguments(type)),\n Option.map(under(ELEMENT)),\n );\n};\n\nconst arrayPart = (search: Search, type: Type): Found => {\n const mutable = pipe(\n Option.fromNullishOr(type.getSymbol()),\n Option.exists((symbol) => symbol.name === MUTABLE_ARRAY),\n );\n if (mutable) {\n return here({ kind: \"array\" });\n }\n return elementsPart(search, type);\n};\n\nconst tuplePart = (search: Search, type: Type): Found => {\n if (type.isTupleType() && !type.getTarget().readonly) {\n return here({ kind: \"tuple\" });\n }\n return elementsPart(search, type);\n};\n\nconst named =\n (prefix: string) =>\n (property: TypeSymbol): boolean =>\n pipe(String(property.escapedName), Str.startsWith(prefix));\n\nconst isWritable =\n (checker: Checker) =>\n (property: TypeSymbol): boolean =>\n !checker.isReadonlySymbol(property) && !named(PRIVATE_NAME)(property);\n\nconst isStringNamed = (property: TypeSymbol): boolean =>\n !named(PRIVATE_NAME)(property) && !named(SYMBOL_NAME)(property);\n\nconst declaredIn =\n (project: Project, origin: Origin) =>\n (property: TypeSymbol): boolean =>\n originOf(project)(property) === origin;\n\nconst inheritedForm =\n (project: Project) =>\n (property: TypeSymbol): Found =>\n pipe(\n Option.fromNullishOr(property.getParent()),\n Option.flatMap((owner) => formOf(project)(owner.name)),\n );\n\nconst propertyTypesPart = (search: Search, properties: readonly TypeSymbol[]): Found => {\n const judged = pipe(properties, Arr.filter(isStringNamed));\n return pipe(\n Arr.zip(judged, search.project.checker.getTypeOfSymbol(judged)),\n Arr.findFirst(([property, type]) =>\n pipe(search.partOf(type), Option.map(under(property.name))),\n ),\n );\n};\n\nconst indexPart = (search: Search, type: Type): Found =>\n pipe(\n type.getIndexInfos(),\n Arr.findFirst((info) => {\n if (!info.isReadonly) {\n return here({ kind: \"index\" });\n }\n return pipe(search.partOf(info.valueType), Option.map(under(ELEMENT)));\n }),\n );\n\nconst membersPart = (search: Search, type: Type): Found => {\n const { project } = search;\n const properties = type.getProperties();\n const taken = pipe(\n sourceOf(type),\n Option.map(takenFromOutside(project)),\n Option.getOrElse((): readonly string[] => []),\n );\n const own = pipe(\n properties,\n Arr.filter(\n (property) => declaredIn(project, \"own\")(property) && !Arr.contains(taken, property.name),\n ),\n );\n return pipe(\n own,\n Arr.findFirst(isWritable(project.checker)),\n Option.map((property): WritablePart => ({\n path: [property.name],\n mutability: { kind: \"property\" },\n })),\n Option.orElse(() =>\n pipe(\n properties,\n Arr.filter(declaredIn(project, \"builtin\")),\n Arr.findFirst(inheritedForm(project)),\n ),\n ),\n Option.orElse(() => propertyTypesPart(search, own)),\n Option.orElse(() => indexPart(search, type)),\n );\n};\n\nconst isFunction = (type: Type): boolean =>\n Arr.isReadonlyArrayNonEmpty(type.getCallSignatures()) &&\n Arr.isReadonlyArrayEmpty(type.getProperties());\n\nconst objectPart = (search: Search, type: Type): Found => {\n if (isFunction(type)) {\n return Option.none();\n }\n if (search.project.checker.isArrayType(type)) {\n return arrayPart(search, type);\n }\n if (type.isTupleType()) {\n return tuplePart(search, type);\n }\n return pipe(\n declaredOutside(search.project, type),\n Option.getOrElse(() => membersPart(search, type)),\n );\n};\n\nconst typePart = (search: Search, type: Type): Found => {\n if (isOpaqueAlias(search.project, type)) {\n return Option.none();\n }\n if (type.isUnionType() || type.isIntersectionType()) {\n return firstPart(search, type.getTypes());\n }\n if (type.isConditionalType()) {\n return firstPart(search, [type.getTrueType(), type.getFalseType()]);\n }\n if (!type.isObjectType()) {\n return Option.none();\n }\n return objectPart(search, type);\n};\n\nexport const writablePartOf =\n (project: Project) =>\n (type: Type): Option.Option<WritablePart> => {\n const seen = new Set<Type>();\n const partOf = (inner: Type): Found => {\n if (seen.has(inner)) {\n return Option.none();\n }\n seen.add(inner);\n return typePart({ project, partOf }, inner);\n };\n return partOf(type);\n };\n","import type { ParserServices, TypedContext } from \"@r_masseater/oxlint-typed-rules\";\nimport { Array as Arr, Match, Option, String as Str, pipe } from \"effect\";\nimport type { Node } from \"typescript/ast\";\nimport { isTypeNode } from \"typescript/ast/is\";\nimport type { Type } from \"typescript/sync\";\nimport type { ESTree, Rule, Visitor } from \"vite-plus/lint/plugins\";\n\nimport { typedRuleOf } from \"./typed-rule.ts\";\nimport { ELEMENT, writablePartOf } from \"./writable-part.ts\";\nimport type { Mutability, WritablePart } from \"./writable-part.ts\";\n\nconst MESSAGE =\n \"A function must not be able to change its arguments, but {{part}}. Declare the parameter with a read-only type. Types declared by a package or by the language are exempt unless the language has a read-only form of them.\";\nconst MESSAGE_ID = \"shouldBeReadonly\";\nconst WHOLE = \"the type\";\nconst SEPARATOR = \".\";\nconst TAGGABLE: readonly string[] = [\"string\", \"number\", \"bigint\"];\n\ntype Annotated = ESTree.FormalParameter | ESTree.FormalParameterRest;\n\ntype FunctionLike =\n | ESTree.ArrowFunctionExpression\n | ESTree.Function\n | ESTree.TSCallSignatureDeclaration\n | ESTree.TSConstructSignatureDeclaration\n | ESTree.TSFunctionType\n | ESTree.TSMethodSignature;\n\nconst isBrandObject = (type: Type): boolean =>\n type.isObjectType() &&\n Arr.isReadonlyArrayEmpty(type.getCallSignatures()) &&\n Arr.isReadonlyArrayEmpty(type.getConstructSignatures());\n\nconst isTaggable = (type: Type): boolean =>\n type.isLiteralType() ||\n type.isTemplateLiteralType() ||\n (type.isIntrinsicType() && Arr.contains(TAGGABLE, type.intrinsicName));\n\nconst isBrandedLiteral = (type: Type): boolean => {\n if (!type.isIntersectionType()) {\n return false;\n }\n const parts = type.getTypes();\n const objects = pipe(parts, Arr.filter(isBrandObject));\n const primitives = pipe(parts, Arr.filter(isTaggable));\n return (\n Arr.isReadonlyArrayNonEmpty(objects) &&\n Arr.isReadonlyArrayNonEmpty(primitives) &&\n objects.length + primitives.length === parts.length\n );\n};\n\nconst isBrandedLiteralLike = (type: Type): boolean => {\n if (type.isUnionType()) {\n return pipe(type.getTypes(), Arr.every(isBrandedLiteral));\n }\n return isBrandedLiteral(type);\n};\n\nconst outermost = (node: Node): Node =>\n pipe(\n Option.fromNullishOr(node.parent),\n Option.filter((parent) => parent.getStart() === node.getStart() && parent.end === node.end),\n Option.match({ onNone: () => node, onSome: outermost }),\n );\n\nconst unwrapped = (parameter: ESTree.ParamPattern): Annotated => {\n if (parameter.type === \"TSParameterProperty\") {\n return parameter.parameter;\n }\n return parameter;\n};\n\nconst annotationOf = (parameter: Annotated): Option.Option<ESTree.TSTypeAnnotation> => {\n if (parameter.type === \"AssignmentPattern\") {\n return Option.fromNullishOr(parameter.left.typeAnnotation);\n }\n return Option.fromNullishOr(parameter.typeAnnotation);\n};\n\nconst annotatedType = (services: ParserServices, parameter: Annotated): Option.Option<Type> =>\n pipe(\n annotationOf(parameter),\n Option.map((annotation) =>\n outermost(services.esTreeNodeToTSNodeMap.get(annotation.typeAnnotation)),\n ),\n Option.filter(isTypeNode),\n Option.map((node) => services.program.native.checker.getTypeFromTypeNode(node)),\n );\n\nconst subjectOf = (path: readonly string[]): string => {\n if (Arr.isReadonlyArrayEmpty(path)) {\n return WHOLE;\n }\n return `\\`${pipe(Arr.join(path, SEPARATOR), Str.replaceAll(`${SEPARATOR}${ELEMENT}`, ELEMENT))}\\``;\n};\n\nconst predicateOf = Match.type<Mutability>().pipe(\n Match.discriminatorsExhaustive(\"kind\")({\n array: () => \"is a mutable array\",\n tuple: () => \"is a mutable tuple\",\n property: () => \"is writable\",\n index: () => \"has a writable index signature\",\n form: ({ name, readonlyName }) =>\n `is a \\`${name}\\`, which has the read-only form \\`${readonlyName}\\``,\n }),\n);\n\nconst describe = ({ path, mutability }: WritablePart): string =>\n `${subjectOf(path)} ${predicateOf(mutability)}`;\n\nconst visitorOf = (context: TypedContext, services: ParserServices): Visitor => {\n const partOf = writablePartOf(services.program.native);\n const check = ({ params }: FunctionLike): void => {\n for (const parameter of pipe(params, Arr.map(unwrapped))) {\n const part = pipe(\n annotatedType(services, parameter),\n Option.filter((type) => !isBrandedLiteralLike(type)),\n Option.flatMap(partOf),\n );\n if (Option.isSome(part)) {\n context.report({\n node: parameter,\n messageId: MESSAGE_ID,\n data: { part: describe(part.value) },\n });\n }\n }\n };\n return {\n ArrowFunctionExpression: check,\n FunctionDeclaration: check,\n FunctionExpression: check,\n TSCallSignatureDeclaration: check,\n TSConstructSignatureDeclaration: check,\n TSDeclareFunction: check,\n TSEmptyBodyFunctionExpression: check,\n TSFunctionType: check,\n TSMethodSignature: check,\n };\n};\n\nexport const readonlyParameters: Rule = typedRuleOf({\n meta: { type: \"suggestion\", messages: { [MESSAGE_ID]: MESSAGE } },\n visitorOf,\n});\n","import type { Rule } from \"vite-plus/lint/plugins\";\n\nimport { arrayFromAsync } from \"./array-from-async.ts\";\nimport { ecosystemReaders } from \"./ecosystem-readers.ts\";\nimport { explicitImportPath } from \"./explicit-import-path.ts\";\nimport { getOrInsert } from \"./get-or-insert.ts\";\nimport { inlineExports } from \"./inline-exports.ts\";\nimport { mcpToolLayer } from \"./mcp-tool-layer.ts\";\nimport { readonlyParameters } from \"./readonly-parameters.ts\";\n\nexport const CODED_RULES: Readonly<Record<string, Rule>> = {\n \"array-from-async\": arrayFromAsync,\n \"ecosystem-readers\": ecosystemReaders,\n \"explicit-import-path\": explicitImportPath,\n \"get-or-insert\": getOrInsert,\n \"inline-exports\": inlineExports,\n \"mcp-tool-layer\": mcpToolLayer,\n \"readonly-parameters\": readonlyParameters,\n};\n","import { Array as Arr, Option, pipe } from \"effect\";\nimport type { Context, ESTree, Rule } from \"vite-plus/lint/plugins\";\n\nconst NAMESPACE = \"*\";\nconst DEFAULT = \"default\";\n\nexport interface ImportBan {\n readonly module: string;\n readonly names: Option.Option<readonly string[]>;\n readonly typesAllowed: boolean;\n}\n\nexport interface MemberBan {\n readonly object: string;\n readonly properties: readonly string[];\n}\n\nexport interface Intent {\n readonly message: string;\n readonly imports: readonly ImportBan[];\n readonly members: readonly MemberBan[];\n}\n\nconst importedName = (specifier: ESTree.ImportDeclarationSpecifier): string => {\n if (specifier.type === \"ImportDefaultSpecifier\") {\n return DEFAULT;\n }\n if (specifier.type === \"ImportNamespaceSpecifier\") {\n return NAMESPACE;\n }\n if (specifier.imported.type === \"Identifier\") {\n return specifier.imported.name;\n }\n return specifier.imported.value;\n};\n\nconst isTypeOnly = (\n node: ESTree.ImportDeclaration,\n specifier: ESTree.ImportDeclarationSpecifier,\n): boolean =>\n node.importKind === \"type\" ||\n (specifier.type === \"ImportSpecifier\" && specifier.importKind === \"type\");\n\nconst isBannedSpecifier =\n (node: ESTree.ImportDeclaration, ban: ImportBan, names: readonly string[]) =>\n (specifier: ESTree.ImportDeclarationSpecifier): boolean =>\n !(ban.typesAllowed && isTypeOnly(node, specifier)) &&\n Arr.contains([NAMESPACE, ...names], importedName(specifier));\n\nconst wholeImport = (node: ESTree.ImportDeclaration, ban: ImportBan): readonly ESTree.Node[] => {\n if (ban.typesAllowed && node.importKind === \"type\") {\n return [];\n }\n return [node];\n};\n\nconst bannedIn =\n (node: ESTree.ImportDeclaration) =>\n (ban: ImportBan): readonly ESTree.Node[] => {\n if (node.source.value !== ban.module) {\n return [];\n }\n return Option.match(ban.names, {\n onNone: () => wholeImport(node, ban),\n onSome: (names): readonly ESTree.Node[] =>\n pipe(node.specifiers, Arr.filter(isBannedSpecifier(node, ban, names))),\n });\n };\n\nconst propertyOf = (node: ESTree.MemberExpression): Option.Option<string> => {\n if (!node.computed && node.property.type === \"Identifier\") {\n return Option.some(node.property.name);\n }\n if (node.property.type === \"Literal\" && typeof node.property.value === \"string\") {\n return Option.some(node.property.value);\n }\n return Option.none();\n};\n\nconst isBannedMember =\n (node: ESTree.MemberExpression) =>\n (ban: MemberBan): boolean =>\n node.object.type === \"Identifier\" &&\n node.object.name === ban.object &&\n pipe(\n propertyOf(node),\n Option.exists((property) => Arr.contains(ban.properties, property)),\n );\n\nconst reportImports = (context: Context, intent: Intent, node: ESTree.ImportDeclaration): void => {\n const banned = pipe(intent.imports, Arr.flatMap(bannedIn(node)));\n for (const found of banned) {\n context.report({ node: found, message: intent.message });\n }\n};\n\nexport const ruleOf = (intent: Intent): Rule => ({\n meta: { type: \"problem\" },\n create: (context) => ({\n ImportDeclaration: (node): void => {\n reportImports(context, intent, node);\n },\n MemberExpression: (node): void => {\n if (pipe(intent.members, Arr.some(isBannedMember(node)))) {\n context.report({ node, message: intent.message });\n }\n },\n }),\n});\n","import { Option } from \"effect\";\n\nimport type { Intent } from \"./intent-rule.ts\";\n\nconst RUN_MESSAGE =\n \"Run Effects with run or runner from @r_masseater/workers-tracing/effect, so their spans reach the Workers trace.\";\n\nconst RUN_FUNCTIONS: readonly string[] = [\n \"runPromise\",\n \"runPromiseExit\",\n \"runFork\",\n \"runCallback\",\n \"runSync\",\n \"runSyncExit\",\n \"runPromiseWith\",\n \"runPromiseExitWith\",\n \"runForkWith\",\n \"runCallbackWith\",\n \"runSyncWith\",\n \"runSyncExitWith\",\n];\n\nconst HAND_WRITTEN_SQL =\n \"Build queries with the Drizzle query builder, so that their columns and types come from the schema. Do not write SQL by hand with sql.\";\n\nexport const INTENTS: Readonly<Record<string, Intent>> = {\n \"ui-state-in-atoms\": {\n message:\n \"Keep UI state in effect-atom (Atom.make, useAtom, useAtomValue), so that state has one home outside the component tree. Do not use React state hooks or context.\",\n imports: [\n {\n module: \"react\",\n names: Option.some([\"useState\", \"useReducer\", \"createContext\", \"useContext\"]),\n typesAllowed: false,\n },\n ],\n members: [],\n },\n \"no-hand-written-sql\": {\n message: HAND_WRITTEN_SQL,\n imports: [\n { module: \"drizzle-orm\", names: Option.some([\"sql\"]), typesAllowed: false },\n { module: \"drizzle-orm/sql\", names: Option.none(), typesAllowed: false },\n ],\n members: [],\n },\n \"traced-elysia\": {\n message:\n \"Import Elysia from @r_masseater/workers-tracing/elysia, so every handle call is a span.\",\n imports: [{ module: \"elysia\", names: Option.some([\"Elysia\", \"default\"]), typesAllowed: true }],\n members: [],\n },\n \"traced-effect-run\": {\n message: RUN_MESSAGE,\n imports: [\n { module: \"effect/Effect\", names: Option.some(RUN_FUNCTIONS), typesAllowed: false },\n { module: \"effect/ManagedRuntime\", names: Option.some([\"make\"]), typesAllowed: false },\n ],\n members: [\n { object: \"Effect\", properties: RUN_FUNCTIONS },\n { object: \"ManagedRuntime\", properties: [\"make\"] },\n ],\n },\n \"platform-node-by-module\": {\n message:\n 'Import names from a module path, such as import { layer } from \"@effect/platform-node/NodeServices\". The package root loads every module, the Redis client included, and adds about 250 ms to each start.',\n imports: [{ module: \"@effect/platform-node\", names: Option.none(), typesAllowed: true }],\n members: [],\n },\n \"main-through-node-main\": {\n message:\n 'Start a Node.js program with runMain from \"@r_masseater/node-main\", so that it is traced and a failure prints one line instead of a stack trace.',\n imports: [\n {\n module: \"@effect/platform-node/NodeRuntime\",\n names: Option.some([\"runMain\"]),\n typesAllowed: false,\n },\n {\n module: \"@effect/platform-node-shared/NodeRuntime\",\n names: Option.some([\"runMain\"]),\n typesAllowed: false,\n },\n ],\n members: [{ object: \"NodeRuntime\", properties: [\"runMain\"] }],\n },\n \"typed-calls-not-reflect\": {\n message:\n \"Read properties and call functions through typed access, or decode untyped values with Schema at the boundary. Do not go around the types with Reflect.\",\n imports: [],\n members: [{ object: \"Reflect\", properties: [\"get\", \"apply\"] }],\n },\n \"db-writes-in-writers\": {\n message:\n \"Write tables only from a *-writer.server.ts module, so that a table update and its revision go into the same batch. Call the writer here instead of writing through db.\",\n imports: [],\n members: [{ object: \"db\", properties: [\"insert\", \"update\", \"delete\", \"batch\", \"run\"] }],\n },\n};\n","import { Record as Rec, pipe } from \"effect\";\nimport type { Plugin } from \"vite-plus/lint/plugins\";\n\nimport { CODED_RULES } from \"./coded-rules.ts\";\nimport { ruleOf } from \"./intent-rule.ts\";\nimport { INTENTS } from \"./intents.ts\";\n\nexport const mschLintPlugin: Plugin & { readonly meta: { readonly name: string } } = {\n meta: { name: \"msch-lint\"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,MAAa,iBAAwE;CACnF,MAAM,EAAE,MAAM,YAAY;CAC1B,OAAO;EACL,GAAG;EACH,GAAG,KAAK,SAASC,OAAI,IAAI,MAAM,CAAC;CAClC;AACF"}
|
package/dist/lint.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as allRulesOf, a as textlintPresets, b as generated, c as tracedRules, d as alchemyOverride, f as cloudflareResourceSyntax, g as lint, h as removalPolicySyntax, i as textlintFilters, l as INSTRUMENTATION, m as removalPolicyOverride, n as markdownOf, o as structureOf, p as commandsOverride, r as _default, s as remotionRules, t as MarkdownOptions, u as requiredStack, v as decisionRules, y as decisionTestRules } from "./index-
|
|
1
|
+
import { _ as allRulesOf, a as textlintPresets, b as generated, c as tracedRules, d as alchemyOverride, f as cloudflareResourceSyntax, g as lint, h as removalPolicySyntax, i as textlintFilters, l as INSTRUMENTATION, m as removalPolicyOverride, n as markdownOf, o as structureOf, p as commandsOverride, r as _default, s as remotionRules, t as MarkdownOptions, u as requiredStack, v as decisionRules, y as decisionTestRules } from "./index-DEuWKkok.mjs";
|
|
2
2
|
export { INSTRUMENTATION, type MarkdownOptions, alchemyOverride, allRulesOf, cloudflareResourceSyntax, commandsOverride, _default as decisionPlugin, decisionRules, decisionTestRules, generated, lint, markdownOf, remotionRules, removalPolicyOverride, removalPolicySyntax, requiredStack, structureOf, textlintFilters, textlintPresets, tracedRules };
|
package/dist/lint.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { s as INSTRUMENTATION, h as alchemyOverride, u as allRulesOf, g as cloudflareResourceSyntax, _ as commandsOverride, m as decisionPlugin, d as decisionRules, f as decisionTestRules, p as generated, l as lint, t as markdownOf, a as remotionRules, v as removalPolicyOverride, y as removalPolicySyntax, c as requiredStack, i as structureOf, n as textlintFilters, r as textlintPresets, o as tracedRules } from "./define-lint-preset-
|
|
1
|
+
export { s as INSTRUMENTATION, h as alchemyOverride, u as allRulesOf, g as cloudflareResourceSyntax, _ as commandsOverride, m as decisionPlugin, d as decisionRules, f as decisionTestRules, p as generated, l as lint, t as markdownOf, a as remotionRules, v as removalPolicyOverride, y as removalPolicySyntax, c as requiredStack, i as structureOf, n as textlintFilters, r as textlintPresets, o as tracedRules } from "./define-lint-preset-Bawe3IU5.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as JSON_FLAG } from "./cli-contract-D7btWrEu.mjs";
|
|
2
2
|
import { n as RepositoryFiles } from "./repository-files-C2gVviac.mjs";
|
|
3
|
-
import { n as
|
|
3
|
+
import { n as writeStdout, t as ProblemsFound } from "./output-DrM4OsOJ.mjs";
|
|
4
4
|
import { Array, Effect, Order, Schema, Stdio, pipe } from "effect";
|
|
5
5
|
// src/app/lookup-report.ts
|
|
6
6
|
const NONE_FOUND = 0;
|
|
@@ -26,4 +26,4 @@ const lookupReport = ({ row, rows, describe }) => Effect.gen(function* report()
|
|
|
26
26
|
});
|
|
27
27
|
export { lookupReport as t };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=lookup-report-
|
|
29
|
+
//# sourceMappingURL=lookup-report-Dp36RBaW.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lookup-report-
|
|
1
|
+
{"version":3,"file":"lookup-report-Dp36RBaW.mjs","names":["Arr"],"sources":["../src/app/lookup-report.ts"],"sourcesContent":["import { Array as Arr, Effect, Order, Schema, Stdio, pipe } from \"effect\";\n\nimport { JSON_FLAG } from \"#/shared/lib/cli-contract.ts\";\nimport { RepositoryFiles } from \"#/shared/lib/repository-files.ts\";\n\nimport { ProblemsFound, writeStdout } from \"./output.ts\";\n\nconst NONE_FOUND = 0;\nconst LINE_BREAK = \"\\n\";\n\nconst byPlace = Order.Struct({ file: Order.String, line: Order.Number });\n\n/** @internal */\nexport interface Place {\n readonly file: string;\n readonly line: number;\n}\n\n/** @internal */\nexport interface LookupReport<Row extends Place, Failure, Requirements> {\n readonly row: Schema.Codec<Row>;\n readonly rows: (root: string) => Effect.Effect<readonly Row[], Failure, Requirements>;\n readonly describe: (row: Row) => string;\n}\n\nconst textOf =\n <Row extends Place>(row: Schema.Codec<Row>, describe: (row: Row) => string) =>\n (json: boolean, rows: readonly Row[]): Effect.Effect<string, Schema.SchemaError> => {\n if (json) {\n return Schema.encodeEffect(row.pipe(Schema.Array, Schema.fromJsonString))(rows);\n }\n return Effect.succeed(\n pipe(\n rows,\n Arr.map((found) => `${describe(found)}${LINE_BREAK}`),\n Arr.join(\"\"),\n ),\n );\n };\n\n/** @internal */\nexport const lookupReport = <Row extends Place, Failure, Requirements>({\n row,\n rows,\n describe,\n}: LookupReport<Row, Failure, Requirements>): Effect.Effect<\n number,\n Failure | Schema.SchemaError | ProblemsFound,\n Requirements | RepositoryFiles | Stdio.Stdio\n> =>\n Effect.gen(function* report() {\n const stdio = yield* Stdio.Stdio;\n const files = yield* RepositoryFiles;\n const args = yield* stdio.args;\n const found = yield* rows(files.resolve(\".\"));\n const text = yield* textOf(row, describe)(\n Arr.contains(args, JSON_FLAG),\n Arr.sort(found, byPlace),\n );\n yield* writeStdout(text);\n if (found.length > NONE_FOUND) {\n return yield* ProblemsFound.make({ count: found.length });\n }\n return NONE_FOUND;\n });\n"],"mappings":";;;;;AAOA,MAAM,aAAa;AACnB,MAAM,aAAa;AAEnB,MAAM,UAAU,MAAM,OAAO;CAAE,MAAM,MAAM;CAAQ,MAAM,MAAM;AAAO,CAAC;AAevE,MAAM,UACgB,KAAwB,cAC3C,MAAe,SAAoE;CAClF,IAAI,MACF,OAAO,OAAO,aAAa,IAAI,KAAK,OAAO,OAAO,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI;CAEhF,OAAO,OAAO,QACZ,KACE,MACAA,MAAI,KAAK,UAAU,GAAG,SAAS,KAAK,IAAI,YAAY,GACpDA,MAAI,KAAK,EAAE,CACb,CACF;AACF;;AAGF,MAAa,gBAA0D,EACrE,KACA,MACA,eAMA,OAAO,IAAI,UAAU,SAAS;CAC5B,MAAM,QAAQ,OAAO,MAAM;CAC3B,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,OAAO,MAAM;CAC1B,MAAM,QAAQ,OAAO,KAAK,MAAM,QAAQ,GAAG,CAAC;CAC5C,MAAM,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CACvCA,MAAI,SAAS,MAAM,SAAS,GAC5BA,MAAI,KAAK,OAAO,OAAO,CACzB;CACA,OAAO,YAAY,IAAI;CACvB,IAAI,MAAM,SAAS,YACjB,OAAO,OAAO,cAAc,KAAK,EAAE,OAAO,MAAM,OAAO,CAAC;CAE1D,OAAO;AACT,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Effect, Runtime, Schema, Stdio, Stream } from "effect";
|
|
2
|
+
// src/app/output.ts
|
|
3
|
+
const taggedError = Schema.TaggedError;
|
|
4
|
+
var ProblemsFound = class extends taggedError()("ProblemsFound", { count: Schema.Finite }) {
|
|
5
|
+
[Runtime.errorReported] = false;
|
|
6
|
+
};
|
|
7
|
+
/** @internal */
|
|
8
|
+
const writeStdout = Effect.fn("writeStdout")(function* writeStdout(text) {
|
|
9
|
+
const stdio = yield* Stdio.Stdio;
|
|
10
|
+
yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);
|
|
11
|
+
});
|
|
12
|
+
export { writeStdout as n, ProblemsFound as t };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=output-DrM4OsOJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-DrM4OsOJ.mjs","names":[],"sources":["../src/app/output.ts"],"sourcesContent":["import { Effect, Runtime, Schema, Stdio, Stream } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class ProblemsFound extends taggedError<ProblemsFound, { readonly brand: unique symbol }>()(\n \"ProblemsFound\",\n {\n count: Schema.Finite,\n },\n) {\n public override readonly [Runtime.errorReported] = false;\n}\n\n/** @internal */\nexport const writeStdout = Effect.fn(\"writeStdout\")(function* writeStdout(text: string) {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n});\n"],"mappings":";;AAEA,MAAM,cAAc,OAAO;AAE3B,IAAa,gBAAb,cAAmC,YAA8D,CAAC,CAChG,iBACA,EACE,OAAO,OAAO,OAChB,CACF,CAAC,CAAC;CACA,CAA0B,QAAQ,iBAAiB;AACrD;;AAGA,MAAa,cAAc,OAAO,GAAG,aAAa,CAAC,CAAC,UAAU,YAAY,MAAc;CACtF,MAAM,QAAQ,OAAO,MAAM;CAC3B,OAAO,OAAO,KAAK,IAAI,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC,GAAG,OAAO,KAAK;AACxE,CAAC"}
|
package/dist/publish.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as runCli } from "./runtime-
|
|
2
|
+
import { t as runCli } from "./runtime-Q9CzisOt.mjs";
|
|
3
3
|
import { n as importSpecifierOf, t as exportEntriesOf } from "./export-subpaths-D6ZLYZGy.mjs";
|
|
4
4
|
import { i as writeOutputs, n as actionsOidcToken, r as mask, t as BROKER } from "./credential-broker-9FMyTp1H.mjs";
|
|
5
5
|
import { Array, Config, Console, Duration, Effect, FileSystem, Option, Order, Path, Predicate, Record, Schedule, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
@@ -151,15 +151,24 @@ const withoutViteOfVitePlus = (peers) => {
|
|
|
151
151
|
const viteAliasOf = (vitePlusManifest) => pipe(Schema.decodeOption(VitePlusManifestJson)(vitePlusManifest), Option.flatMapNullishOr(({ dependencies }) => dependencies), Option.flatMap(Record.get(VITE)), Option.map((spec) => `${VITE}@${spec}`));
|
|
152
152
|
const casesOf = (manifest, floor) => {
|
|
153
153
|
const declared = withoutViteOfVitePlus(manifest.peerDependencies ?? {});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
154
|
+
const latest = `^${String(semver.major(floor))}`;
|
|
155
|
+
return [
|
|
156
|
+
{
|
|
157
|
+
label: "floor",
|
|
158
|
+
node: floorOf(floor),
|
|
159
|
+
peers: floorPeers(declared)
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
label: "latest",
|
|
163
|
+
node: latest,
|
|
164
|
+
peers: declared
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
label: "npx",
|
|
168
|
+
node: latest,
|
|
169
|
+
peers: {}
|
|
170
|
+
}
|
|
171
|
+
];
|
|
163
172
|
};
|
|
164
173
|
/** @internal */
|
|
165
174
|
const compatCasesOf = (manifest) => pipe(nodeFloorOf(manifest), Option.match({
|
|
@@ -410,9 +419,11 @@ const workspaceTarballs = Effect.fn("compat.local")(function* workspaceTarballs(
|
|
|
410
419
|
// src/features/publish-workspace/model/compat.ts
|
|
411
420
|
const MANIFEST_FILE$2 = "package.json";
|
|
412
421
|
const INSTALL_FLAGS = ["--no-audit", "--no-fund"];
|
|
413
|
-
|
|
422
|
+
/** @internal */
|
|
423
|
+
const CRASH = String.raw`/ERR_(MODULE_NOT_FOUND|PACKAGE_|INVALID_PACKAGE|UNKNOWN_FILE|UNSUPPORTED_DIR|REQUIRE_ESM)|SyntaxError|\n\s+at\s.+:\d+:\d+/u`;
|
|
424
|
+
const BIN_ARGUMENTS = [["--help"], ["--compat-unknown-flag"]];
|
|
414
425
|
const IMPORT_ONLY = "await import(process.argv[1])";
|
|
415
|
-
const SPAWN_CHECKED = `import { spawnSync } from "node:child_process"; const { stderr } = spawnSync(process.execPath, process.argv.slice(1), { encoding: "utf8", stdio: ["ignore", "ignore", "pipe"], timeout: 60000 }); if (${
|
|
426
|
+
const SPAWN_CHECKED = `import { spawnSync } from "node:child_process"; const { stderr } = spawnSync(process.execPath, process.argv.slice(1), { encoding: "utf8", stdio: ["ignore", "ignore", "pipe"], timeout: 60000 }); if (${CRASH}.test(stderr)) { process.stderr.write(stderr); process.exit(1); }`;
|
|
416
427
|
const Versions$1 = Schema.String.pipe(Schema.Array, Schema.fromJsonString);
|
|
417
428
|
const ConsumerJson = Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown));
|
|
418
429
|
const installedNode = Effect.fn("compat.node")(function* installedNode(directory, range) {
|
|
@@ -504,15 +515,19 @@ const loadsCleanly = ({ runtime, consumer, args }) => mustSucceed({
|
|
|
504
515
|
],
|
|
505
516
|
cwd: consumer
|
|
506
517
|
});
|
|
507
|
-
const
|
|
518
|
+
const importsOf = (manifest, compat) => {
|
|
519
|
+
if (compat.label === "npx") return [];
|
|
520
|
+
return smokeTargetsOf(manifest).imports;
|
|
521
|
+
};
|
|
522
|
+
const smoke = Effect.fn("compat.smoke")(function* smoke({ manifest, compat, runtime, consumer }) {
|
|
508
523
|
const path = yield* Path.Path;
|
|
509
|
-
const { imports, bins } = smokeTargetsOf(manifest);
|
|
510
524
|
const importer = [
|
|
511
525
|
"--input-type=module",
|
|
512
526
|
"-e",
|
|
513
527
|
IMPORT_ONLY
|
|
514
528
|
];
|
|
515
|
-
|
|
529
|
+
const runs = pipe(smokeTargetsOf(manifest).bins, Array.flatMap((file) => pipe(BIN_ARGUMENTS, Array.map((args) => [path.join(consumer, "node_modules", manifest.name, file), ...args]))));
|
|
530
|
+
yield* Effect.forEach(importsOf(manifest, compat), (specifier) => loadsCleanly({
|
|
516
531
|
runtime,
|
|
517
532
|
consumer,
|
|
518
533
|
args: [...importer, specifier]
|
|
@@ -520,10 +535,10 @@ const smoke = Effect.fn("compat.smoke")(function* smoke(manifest, runtime, consu
|
|
|
520
535
|
concurrency: 1,
|
|
521
536
|
discard: true
|
|
522
537
|
});
|
|
523
|
-
yield* Effect.forEach(
|
|
538
|
+
yield* Effect.forEach(runs, (args) => loadsCleanly({
|
|
524
539
|
runtime,
|
|
525
540
|
consumer,
|
|
526
|
-
args
|
|
541
|
+
args
|
|
527
542
|
}), {
|
|
528
543
|
concurrency: 1,
|
|
529
544
|
discard: true
|
|
@@ -540,7 +555,12 @@ const runCase = Effect.fn("compat.case")(function* runCase({ manifest, tarballs,
|
|
|
540
555
|
});
|
|
541
556
|
const peers = pipe(Record.toEntries(compat.peers), Array.map(([name, range]) => `${name}@${range}`), Array.join(", "));
|
|
542
557
|
yield* Console.log(`${manifest.name} ${compat.label}: Node.js ${runtime.version}, peers ${peers}`);
|
|
543
|
-
yield* smoke(
|
|
558
|
+
yield* smoke({
|
|
559
|
+
manifest,
|
|
560
|
+
compat,
|
|
561
|
+
runtime: runtime.binary,
|
|
562
|
+
consumer
|
|
563
|
+
});
|
|
544
564
|
}, Effect.scoped);
|
|
545
565
|
/** @internal */
|
|
546
566
|
const checkCompat = Effect.fn("publish.compat")(function* checkCompat(directory) {
|
|
@@ -1239,7 +1259,7 @@ const publish = Effect.gen(function* publish() {
|
|
|
1239
1259
|
const [step, directory] = yield* Schema.decodeUnknownEffect(Arguments)(args).pipe(Effect.mapError(() => UsageError.make({ message: USAGE })));
|
|
1240
1260
|
return yield* steps[step](directory);
|
|
1241
1261
|
});
|
|
1242
|
-
runCli(publish);
|
|
1262
|
+
runCli("msch-publish")(publish);
|
|
1243
1263
|
export {};
|
|
1244
1264
|
|
|
1245
1265
|
//# sourceMappingURL=publish.mjs.map
|