@cerios/sparta-lint-rules 0.0.2 → 0.0.3

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules-5VZcw4ds.cjs","names":["FUNCTION_VALUES","memberName","isRecord","path","normalize","isFile","statSync","readFileSync","path","require","createRequire","path","existsSync","statSync","rule","rule","rule","rule","rule","path","BLANK_LINE","BLANK_LINES","rule","SKIPPED_KEYS","isNode","rule","memberName","rule","rule","rule","isFunction","statSync","parseSync","readFileSync","path","rule","rule","rule","architectureBoundaries","classMatchesFilename","directorComposesBuilders","expectFromSupport","fileNaming","linesBetweenClassMembers","memberOrdering","noDirectConstructionInTests","noExpectInTests","noHardWaits","noNestedPolling","paddingLines","stepPlaceholders","stepRequired"],"sources":["../src/utils/ast.ts","../src/utils/class-members.ts","../src/utils/docs.ts","../src/utils/conventions.ts","../src/utils/tsconfig.ts","../src/utils/sparta-paths.ts","../src/utils/settings.ts","../src/rules/architecture-boundaries.ts","../src/rules/class-matches-filename.ts","../src/rules/director-composes-builders.ts","../src/rules/expect-from-support.ts","../src/rules/file-naming.ts","../src/rules/lines-between-class-members.ts","../src/rules/member-ordering.ts","../src/rules/no-direct-construction-in-tests.ts","../src/rules/no-expect-in-tests.ts","../src/rules/no-hard-waits.ts","../src/utils/polling.ts","../src/utils/project-index.ts","../src/rules/no-nested-polling.ts","../src/rules/padding-lines.ts","../src/rules/step-placeholders.ts","../src/rules/step-required.ts","../src/rules/index.ts"],"sourcesContent":["import type { AstNode, NodeOfType } from \"./types\";\n\nexport const isIdentifier = (node: AstNode | null | undefined, name: string): boolean =>\n\tnode?.type === \"Identifier\" && node.name === name;\n\n/** The value of a string literal node, or `undefined` for any other node. */\nexport const stringValue = (node: AstNode | null | undefined): string | undefined =>\n\tnode?.type === \"Literal\" && typeof node.value === \"string\" ? node.value : undefined;\n\n/** The value of a string literal or a template literal without expressions (`\\`./x\\``), or `undefined`. */\nexport const staticString = (node: AstNode | null | undefined): string | undefined =>\n\tnode?.type === \"TemplateLiteral\" && node.expressions.length === 0\n\t\t? (node.quasis[0]?.value.cooked ?? undefined)\n\t\t: stringValue(node);\n\n/** True for `@step` and `@step(\"...\")` decorators, or any of the given decorator `names`. */\nexport const isStepDecorator = (decorator: NodeOfType<\"Decorator\">, names: ReadonlySet<string>): boolean => {\n\tconst { expression } = decorator;\n\tconst callee = expression.type === \"CallExpression\" ? expression.callee : expression;\n\n\treturn callee.type === \"Identifier\" && names.has(callee.name);\n};\n","import type { AstNode, NodeOfType } from \"./types\";\n\nexport type ClassMember = NodeOfType<\"ClassBody\">[\"body\"][number];\n\nexport type Method = Extract<ClassMember, { type: \"MethodDefinition\" | \"TSAbstractMethodDefinition\" }>;\n\nexport const isMethod = (member: ClassMember): member is Method =>\n\tmember.type === \"MethodDefinition\" || member.type === \"TSAbstractMethodDefinition\";\n\nconst FUNCTION_VALUES = new Set([\"ArrowFunctionExpression\", \"FunctionExpression\", \"ClassExpression\"]);\n\n/**\n * A plain property declaration (`static readonly PATTERN = /.../;`, `private readonly date: Date;`, …).\n * A property holding a function or class is not plain: it is treated like a method.\n */\nexport const isPlainProperty = (member: ClassMember): boolean => {\n\tif (member.type === \"TSIndexSignature\") return true;\n\tif (\n\t\tmember.type !== \"PropertyDefinition\" &&\n\t\tmember.type !== \"TSAbstractPropertyDefinition\" &&\n\t\tmember.type !== \"AccessorProperty\"\n\t) {\n\t\treturn false;\n\t}\n\n\treturn member.value === null || !FUNCTION_VALUES.has(member.value.type);\n};\n\n/** `private` or an ECMAScript `#private` name. */\nexport const isPrivate = (member: ClassMember): boolean =>\n\t(\"accessibility\" in member && member.accessibility === \"private\") ||\n\t(\"key\" in member && member.key.type === \"PrivateIdentifier\");\n\nexport const memberName = (member: ClassMember): string => {\n\tconst key: AstNode | undefined = \"key\" in member ? member.key : undefined;\n\n\tif (key && \"name\" in key && typeof key.name === \"string\") return key.name;\n\tif (key && \"value\" in key && typeof key.value === \"string\") return key.value;\n\n\treturn \"<computed>\";\n};\n\ntype ClassNode = Extract<AstNode, { type: \"ClassDeclaration\" | \"ClassExpression\" }>;\n\n/** A member that belongs to the class itself: `static` members, static blocks and a `private constructor`. */\nconst isStaticMember = (member: ClassMember): boolean =>\n\tmember.type === \"StaticBlock\" ||\n\t(\"static\" in member && member.static) ||\n\t(member.type === \"MethodDefinition\" && member.kind === \"constructor\" && member.accessibility === \"private\");\n\n/** A static abstract class: `abstract`, with only static members, so it is used without ever being instantiated. */\nexport const isStaticClass = (node: ClassNode): boolean =>\n\tnode.abstract === true && node.body.body.every(isStaticMember);\n\n/** The classes declared at the top level of a program, including exported ones. */\nexport function topLevelClasses(program: NodeOfType<\"Program\">): ClassNode[] {\n\tconst classes: ClassNode[] = [];\n\n\tfor (const statement of program.body) {\n\t\tconst declaration: AstNode | null =\n\t\t\tstatement.type === \"ExportNamedDeclaration\" || statement.type === \"ExportDefaultDeclaration\"\n\t\t\t\t? statement.declaration\n\t\t\t\t: statement;\n\n\t\tif (declaration?.type === \"ClassDeclaration\") classes.push(declaration);\n\t}\n\n\treturn classes;\n}\n","const REPOSITORY = \"https://github.com/CeriosTesting/sparta-lint-rules\";\n\nexport const docsUrl = (ruleName: string): string => `${REPOSITORY}/blob/main/docs/rules/${ruleName}.md`;\n","import path from \"node:path\";\n\n/**\n * The names a SPARTA project uses, and how `settings.sparta` extends them.\n *\n * Settings describe a project; they never relax the rules. A setting either maps a project's own name onto an\n * existing SPARTA concept (so it gets all of that concept's checks) or adds names to detect (which only makes the\n * rules stricter). Switching checks off is left to the linter config, where it stays visible.\n */\n\nexport type Area = \"api\" | \"database\" | \"desktop\" | \"mobile\" | \"ui\";\n\n/** A top-level SPARTA folder that aliases can point to. */\nexport type TopFolder = \"sparta\" | \"tests\";\n\n/** The standard layer folders, with the layer the architecture rules know them as and their file name suffix. */\nexport const LAYER_FOLDERS = {\n\tasserters: { layer: \"asserter\", suffix: \"asserter\" },\n\tbuilders: { layer: \"builder\", suffix: \"builder\" },\n\tclients: { layer: \"client\", suffix: \"client\" },\n\tcomponents: { layer: \"component\", suffix: \"component\" },\n\tcontainers: { layer: \"container\" },\n\tdatabases: { layer: \"database\" },\n\tdirectors: { layer: \"director\", suffix: \"director\" },\n\tfactories: { suffix: \"factory\" },\n\tpages: { layer: \"page\", suffix: \"page\" },\n\trepositories: { layer: \"repository\", suffix: \"repository\" },\n\tscenarios: { layer: \"scenario\", suffix: \"scenario\" },\n\tscreens: { layer: \"screen\", suffix: \"screen\" },\n\tservices: { layer: \"service\", suffix: \"service\" },\n\tsteppers: { layer: \"stepper\", suffix: \"stepper\" },\n\twindows: { layer: \"window\", suffix: \"window\" },\n} as const satisfies Record<string, { layer?: string; suffix?: string }>;\n\nexport type LayerFolder = keyof typeof LAYER_FOLDERS;\n\n/**\n * Layer folders that may also live outside a group: directly in an area (`sparta/<area>/builders/`), shared by its\n * groups, and in `sparta/common/`, shared by everything. In a group or an area's `common/` they are ordinary layer\n * folders.\n */\nexport const AREA_LAYER_FOLDERS: ReadonlySet<LayerFolder> = new Set([\"builders\", \"directors\"]);\n\nexport const AREAS: readonly Area[] = [\"api\", \"database\", \"desktop\", \"mobile\", \"ui\"];\n\n/** Folders directly below the sparta folder that are not areas. */\nconst TOP_LEVEL_FOLDERS = [\"common\", \"fixtures\", \"scenarios\", \"support\"];\n\nconst POLLING_METHODS = [\"toPass\", \"toPassAndReturn\", \"poll\", \"pollAndReturn\"];\n\n/** Settings accepted under `settings.sparta`. Every key is optional; the defaults are the SPARTA standard. */\nexport type SpartaSettings = {\n\t/** Project root that the aliases resolve against. Default: the nearest folder with a `package.json`. */\n\troot?: string;\n\t/** Names of the top-level folders. Default: `{ sparta: \"sparta\", tests: \"tests\" }`. */\n\tfolders?: { sparta?: string; tests?: string };\n\t/** Extra area folders, mapped to the standard area they follow, e.g. `{ web: \"ui\" }`. */\n\tareas?: Record<string, Area>;\n\t/** Extra layer folders, mapped to the standard layer folder they follow, e.g. `{ \"page-objects\": \"pages\" }`. */\n\tlayers?: Record<string, LayerFolder>;\n\t/** Extra path aliases, mapped to the top-level folder they point to, e.g. `{ \"@app/*\": \"sparta\" }`. */\n\taliases?: Record<string, TopFolder>;\n\t/** The module `expect` must be imported from inside the sparta folder. Default: `@sparta/support`. */\n\tsupportModule?: string;\n\t/** Extra retrying methods, added to `toPass`, `toPassAndReturn`, `poll` and `pollAndReturn`. */\n\tpollingMethods?: string[];\n\t/** Extra step decorators, added to `step`. */\n\tstepDecorators?: string[];\n\t/** Extra assertion functions that tests must not call, added to `expect` and `expectly…`. */\n\texpectNames?: string[];\n};\n\n/** Resolved, validated settings, with the patterns the rules match file paths against. */\nexport interface Conventions {\n\t/** Identifies these conventions, for caches. */\n\tkey: string;\n\t/** Explicit project root (`settings.sparta.root`), or `undefined` to detect it per file. */\n\troot?: string;\n\tspartaFolder: string;\n\ttestsFolder: string;\n\tareas: ReadonlyMap<string, Area>;\n\tlayerFolders: ReadonlyMap<string, LayerFolder>;\n\t/** Alias prefixes (ending in `/`), longest first. */\n\taliases: readonly (readonly [prefix: string, target: TopFolder])[];\n\tsupportModule: string;\n\tpollingMethods: ReadonlySet<string>;\n\tstepDecorators: ReadonlySet<string>;\n\texpectNames: ReadonlySet<string>;\n\tpatterns: {\n\t\t/** `/<sparta>/<area>[/<group>[/<folder>]]`. */\n\t\tarea: RegExp;\n\t\t/** `/<sparta>/<area>/<group>/<folder>/`, capturing the folder. */\n\t\tlayer: RegExp;\n\t\t/** `/<sparta>/<common|fixtures|scenarios|support>/`. */\n\t\ttop: RegExp;\n\t\t/** `/<sparta>/common/<folder>`, capturing the folder. */\n\t\tcommon: RegExp;\n\t\t/** `/<sparta>/` or `/<tests>/`. */\n\t\tchecked: RegExp;\n\t\tsparta: RegExp;\n\t\ttests: RegExp;\n\t\tframework: RegExp;\n\t};\n}\n\nconst PREFIX = \"[@cerios/sparta-lint-rules]\";\n\nclass SettingsError extends Error {\n\tconstructor(where: string, problem: string) {\n\t\tsuper(`${PREFIX} settings.sparta${where}: ${problem}`);\n\t\tthis.name = \"SettingsError\";\n\t}\n}\n\nconst escape = (value: string): string => value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\nconst distance = (a: string, b: string): number => {\n\tlet previous = Array.from({ length: b.length + 1 }, (_, index) => index);\n\n\tfor (let i = 1; i <= a.length; i++) {\n\t\tconst current = [i];\n\n\t\tfor (let j = 1; j <= b.length; j++) {\n\t\t\tcurrent[j] = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));\n\t\t}\n\n\t\tprevious = current;\n\t}\n\n\treturn previous[b.length];\n};\n\n/** `; did you mean \"x\"?` for the closest candidate, if it is close enough to be a typo. */\nconst suggest = (value: string, candidates: readonly string[]): string => {\n\tconst [best] = candidates\n\t\t.map(candidate => ({ candidate, score: distance(value.toLowerCase(), candidate.toLowerCase()) }))\n\t\t.toSorted((a, b) => a.score - b.score);\n\n\treturn best && best.score <= Math.max(2, Math.floor(best.candidate.length / 3))\n\t\t? `; did you mean ${JSON.stringify(best.candidate)}?`\n\t\t: \"\";\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === \"object\" && value !== null && !Array.isArray(value);\n\nfunction record(value: unknown, where: string): Record<string, unknown> {\n\tif (!isRecord(value)) throw new SettingsError(where, `must be an object, got ${JSON.stringify(value)}.`);\n\n\treturn value;\n}\n\nfunction checkKeys(value: Record<string, unknown>, allowed: readonly string[], where: string): void {\n\tfor (const key of Object.keys(value)) {\n\t\tif (!allowed.includes(key)) {\n\t\t\tthrow new SettingsError(where, `unknown setting ${JSON.stringify(key)}${suggest(key, allowed)}`);\n\t\t}\n\t}\n}\n\nfunction nonEmptyString(value: unknown, where: string): string {\n\tif (typeof value !== \"string\" || value.trim() === \"\") {\n\t\tthrow new SettingsError(where, `must be a non-empty string, got ${JSON.stringify(value)}.`);\n\t}\n\n\treturn value;\n}\n\nfunction folderName(value: unknown, where: string): string {\n\tconst name = nonEmptyString(value, where);\n\n\tif (/[/\\\\]/.test(name) || name === \".\" || name === \"..\") {\n\t\tthrow new SettingsError(where, `must be a single folder name, got ${JSON.stringify(name)}.`);\n\t}\n\n\treturn name;\n}\n\nfunction identifiers(value: unknown, where: string): string[] {\n\tif (!Array.isArray(value)) throw new SettingsError(where, `must be an array of names, got ${JSON.stringify(value)}.`);\n\n\treturn value.map((item, index) => {\n\t\tconst name = nonEmptyString(item, `${where}[${index}]`);\n\n\t\tif (!/^[A-Za-z_$][\\w$]*$/.test(name)) {\n\t\t\tthrow new SettingsError(`${where}[${index}]`, `must be an identifier, got ${JSON.stringify(name)}.`);\n\t\t}\n\n\t\treturn name;\n\t});\n}\n\n/**\n * Maps the project's own names onto standard ones. A name that is already standard may only map onto itself,\n * and `reserved` names may not be used at all, so a setting can never turn one concept into another.\n */\nfunction mapping<T extends string>(\n\tvalue: unknown,\n\twhere: string,\n\ttargets: readonly T[],\n\tdescribe: string,\n\treserved: readonly string[] = []\n): Map<string, T> {\n\tconst result = new Map<string, T>();\n\n\tfor (const [name, target] of Object.entries(record(value, where))) {\n\t\tconst at = `${where}.${name}`;\n\n\t\tfolderName(name, at);\n\n\t\tif (typeof target !== \"string\" || !(targets as readonly string[]).includes(target)) {\n\t\t\tthrow new SettingsError(\n\t\t\t\tat,\n\t\t\t\t`unknown ${describe} ${JSON.stringify(target)}${typeof target === \"string\" ? suggest(target, targets) : \"\"}. Use one of: ${targets.join(\", \")}.`\n\t\t\t);\n\t\t}\n\n\t\tif ((targets as readonly string[]).includes(name) && name !== target) {\n\t\t\tthrow new SettingsError(\n\t\t\t\tat,\n\t\t\t\t`${JSON.stringify(name)} is already the standard ${describe} ${JSON.stringify(name)}.`\n\t\t\t);\n\t\t}\n\n\t\tif (reserved.includes(name)) {\n\t\t\tthrow new SettingsError(at, `${JSON.stringify(name)} is a reserved SPARTA folder.`);\n\t\t}\n\n\t\tresult.set(name, target as T);\n\t}\n\n\treturn result;\n}\n\n/** `@app/*`, `@app/` and `@app` all become the prefix `@app/`. */\nfunction aliasPrefix(alias: string, where: string): string {\n\tconst prefix = `${alias.replace(/\\/?\\*?$/, \"\")}/`;\n\n\tif (prefix === \"/\" || alias.startsWith(\".\") || alias.startsWith(\"/\")) {\n\t\tthrow new SettingsError(where, `must be an alias such as \"@app/*\", got ${JSON.stringify(alias)}.`);\n\t}\n\n\treturn prefix;\n}\n\nconst SETTINGS_KEYS: readonly (keyof SpartaSettings)[] = [\n\t\"root\",\n\t\"folders\",\n\t\"areas\",\n\t\"layers\",\n\t\"aliases\",\n\t\"supportModule\",\n\t\"pollingMethods\",\n\t\"stepDecorators\",\n\t\"expectNames\",\n];\n\nfunction parseFolders(value: unknown): { spartaFolder: string; testsFolder: string } {\n\tconst folders = value === undefined ? {} : record(value, \".folders\");\n\n\tcheckKeys(folders, [\"sparta\", \"tests\"], \".folders\");\n\n\tconst spartaFolder = folders.sparta === undefined ? \"sparta\" : folderName(folders.sparta, \".folders.sparta\");\n\tconst testsFolder = folders.tests === undefined ? \"tests\" : folderName(folders.tests, \".folders.tests\");\n\n\tif (spartaFolder === testsFolder) {\n\t\tthrow new SettingsError(\n\t\t\t\".folders\",\n\t\t\t`sparta and tests must be different folders, both are ${JSON.stringify(spartaFolder)}.`\n\t\t);\n\t}\n\n\treturn { spartaFolder, testsFolder };\n}\n\n/** The standard names, each mapped onto itself, plus the project's own names. */\nfunction withStandard<T extends string>(standard: readonly T[], custom: Map<string, T> | undefined): Map<string, T> {\n\treturn new Map<string, T>([...standard.map(name => [name, name] as const), ...(custom ?? [])]);\n}\n\nfunction parseAliases(value: unknown): Map<string, TopFolder> {\n\tconst aliases = new Map<string, TopFolder>([\n\t\t[\"@sparta/\", \"sparta\"],\n\t\t[\"@tests/\", \"tests\"],\n\t]);\n\n\tif (value === undefined) return aliases;\n\n\tfor (const [alias, target] of Object.entries(record(value, \".aliases\"))) {\n\t\tconst at = `.aliases.${alias}`;\n\t\tconst prefix = aliasPrefix(alias, at);\n\n\t\tif (target !== \"sparta\" && target !== \"tests\") {\n\t\t\tthrow new SettingsError(at, `must point to \"sparta\" or \"tests\", got ${JSON.stringify(target)}.`);\n\t\t}\n\n\t\tif (aliases.has(prefix) && aliases.get(prefix) !== target) {\n\t\t\tthrow new SettingsError(at, `${JSON.stringify(alias)} already points to ${JSON.stringify(aliases.get(prefix))}.`);\n\t\t}\n\n\t\taliases.set(prefix, target);\n\t}\n\n\treturn aliases;\n}\n\n/** The default names plus the configured extra ones. */\nconst withExtra = (defaults: readonly string[], value: unknown, where: string): Set<string> =>\n\tnew Set([...defaults, ...(value === undefined ? [] : identifiers(value, where))]);\n\nfunction buildPatterns(\n\tspartaFolder: string,\n\ttestsFolder: string,\n\tareas: ReadonlyMap<string, Area>\n): Conventions[\"patterns\"] {\n\tconst sparta = escape(spartaFolder);\n\tconst tests = escape(testsFolder);\n\tconst areaNames = [...areas.keys()].map(escape).join(\"|\");\n\n\t// Folder names end at a `/` or at the end of the path, so an import of a folder itself (`@sparta/fixtures`,\n\t// `@sparta/ui`, `../../tests`) is classified like the files in it.\n\tconst end = \"(?=/|$)\";\n\n\treturn {\n\t\tarea: new RegExp(`/${sparta}/(${areaNames})${end}(?:/([^/]+))?(?:/([^/]+))?`),\n\t\tlayer: new RegExp(`/${sparta}/(?:${areaNames})/[^/]+/([^/]+)/`),\n\t\ttop: new RegExp(`/${sparta}/(${TOP_LEVEL_FOLDERS.join(\"|\")})${end}`),\n\t\tcommon: new RegExp(`/${sparta}/common/([^/]+)${end}`),\n\t\tchecked: new RegExp(`/(?:${sparta}|${tests})/`),\n\t\tsparta: new RegExp(`/${sparta}/`),\n\t\ttests: new RegExp(`/${tests}${end}`),\n\t\tframework: new RegExp(`/${tests}/framework${end}`),\n\t};\n}\n\nconst STANDARD_LAYER_FOLDERS = Object.keys(LAYER_FOLDERS) as LayerFolder[];\n\n/**\n * Validates `settings.sparta` and resolves it against the defaults. Throws a descriptive error for anything it\n * does not understand, so a typo cannot silently weaken the checks. A relative `root` resolves against `cwd`.\n */\nexport function parseSettings(raw: unknown, cwd: string): Conventions {\n\tconst settings = raw === undefined || raw === null ? {} : record(raw, \"\");\n\n\tcheckKeys(settings, SETTINGS_KEYS, \"\");\n\n\tconst root =\n\t\tsettings.root === undefined\n\t\t\t? undefined\n\t\t\t: path.resolve(cwd, nonEmptyString(settings.root, \".root\")).split(\"\\\\\").join(\"/\");\n\tconst { spartaFolder, testsFolder } = parseFolders(settings.folders);\n\tconst areas = withStandard(\n\t\tAREAS,\n\t\tsettings.areas === undefined ? undefined : mapping(settings.areas, \".areas\", AREAS, \"area\", TOP_LEVEL_FOLDERS)\n\t);\n\tconst layerFolders = withStandard(\n\t\tSTANDARD_LAYER_FOLDERS,\n\t\tsettings.layers === undefined\n\t\t\t? undefined\n\t\t\t: mapping(settings.layers, \".layers\", STANDARD_LAYER_FOLDERS, \"layer folder\", [\"common\"])\n\t);\n\n\treturn {\n\t\tkey: JSON.stringify(raw ?? null) + (root ?? \"\"),\n\t\troot,\n\t\tspartaFolder,\n\t\ttestsFolder,\n\t\tareas,\n\t\tlayerFolders,\n\t\taliases: [...parseAliases(settings.aliases)].toSorted(([a], [b]) => b.length - a.length),\n\t\tsupportModule:\n\t\t\tsettings.supportModule === undefined\n\t\t\t\t? \"@sparta/support\"\n\t\t\t\t: nonEmptyString(settings.supportModule, \".supportModule\"),\n\t\tpollingMethods: withExtra(POLLING_METHODS, settings.pollingMethods, \".pollingMethods\"),\n\t\tstepDecorators: withExtra([\"step\"], settings.stepDecorators, \".stepDecorators\"),\n\t\texpectNames: withExtra([], settings.expectNames, \".expectNames\"),\n\t\tpatterns: buildPatterns(spartaFolder, testsFolder, areas),\n\t};\n}\n\n/** The SPARTA standard, for code that runs without a linter context. */\nexport const DEFAULT_CONVENTIONS: Conventions = parseSettings(undefined, process.cwd());\n","import { readFileSync, statSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\n\n/**\n * The module resolution settings of the nearest `tsconfig.json` (`compilerOptions.paths` and `baseUrl`), following\n * `extends` as TypeScript does. Only what import resolution needs is read; everything else in the config is ignored.\n */\n\n/** One `compilerOptions.paths` entry, with its targets as absolute paths that may still contain the `*`. */\nexport interface PathMapping {\n\t/** The pattern as written, such as `@pages/*`. */\n\tpattern: string;\n\t/** The part before the `*`, or the whole pattern when it has none. */\n\tprefix: string;\n\t/** The part after the `*`; empty when the pattern has none. */\n\tsuffix: string;\n\twildcard: boolean;\n\ttargets: string[];\n}\n\nexport interface TsconfigPaths {\n\t/** The config file these settings were read from. */\n\tfile: string;\n\t/** Absolute `baseUrl`, when one is set. */\n\tbaseUrl?: string;\n\tpaths: PathMapping[];\n}\n\nconst normalize = (value: string): string => value.split(\"\\\\\").join(\"/\");\n\nconst CONFIG_DIR = \"${configDir}\";\n\n/** Where the string or comment that starts at `index` ends (exclusive), or `undefined` when none starts there. */\nfunction skippedEnd(text: string, index: number): number | undefined {\n\tconst start = text.slice(index, index + 2);\n\n\tif (text[index] === '\"') {\n\t\tlet end = index + 1;\n\n\t\twhile (end < text.length && text[end] !== '\"') end += text[end] === \"\\\\\" ? 2 : 1;\n\n\t\treturn end + 1;\n\t}\n\n\tif (start === \"//\") {\n\t\tconst end = text.indexOf(\"\\n\", index);\n\n\t\treturn end === -1 ? text.length : end;\n\t}\n\n\tif (start === \"/*\") {\n\t\tconst end = text.indexOf(\"*/\", index + 2);\n\n\t\treturn end === -1 ? text.length : end + 2;\n\t}\n\n\treturn undefined;\n}\n\n/**\n * Parses JSON with comments and trailing commas, as `tsconfig.json` allows. Comments are only recognised outside\n * strings, so `\"https://...\"` stays intact.\n */\nexport function parseJsonc(text: string): unknown {\n\tlet out = \"\";\n\t/** Position in `out` of a comma that may still turn out to be a trailing one. */\n\tlet pendingComma = -1;\n\tlet index = text.charCodeAt(0) === 0xfeff ? 1 : 0;\n\n\twhile (index < text.length) {\n\t\tconst char = text[index];\n\t\tconst end = skippedEnd(text, index);\n\n\t\tif (end !== undefined) {\n\t\t\t// Strings are kept, comments dropped.\n\t\t\tif (char === '\"') {\n\t\t\t\tout += text.slice(index, end);\n\t\t\t\tpendingComma = -1;\n\t\t\t}\n\n\t\t\tindex = end;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (char === \",\") {\n\t\t\tpendingComma = out.length;\n\t\t} else if ((char === \"}\" || char === \"]\") && pendingComma !== -1) {\n\t\t\tout = `${out.slice(0, pendingComma)} ${out.slice(pendingComma + 1)}`;\n\t\t\tpendingComma = -1;\n\t\t} else if (!/\\s/.test(char)) {\n\t\t\tpendingComma = -1;\n\t\t}\n\n\t\tout += char;\n\t\tindex++;\n\t}\n\n\treturn JSON.parse(out) as unknown;\n}\n\nconst isFile = (file: string): boolean => statSync(file, { throwIfNoEntry: false })?.isFile() ?? false;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === \"object\" && value !== null && !Array.isArray(value);\n\nclass TsconfigError extends Error {\n\tconstructor(file: string, message: string) {\n\t\tsuper(`sparta-lint-rules: cannot read ${normalize(file)}: ${message}`);\n\t\tthis.name = \"TsconfigError\";\n\t}\n}\n\nfunction readConfig(file: string): Record<string, unknown> {\n\tlet config: unknown;\n\n\ttry {\n\t\tconfig = parseJsonc(readFileSync(file, \"utf8\"));\n\t} catch (error) {\n\t\tthrow new TsconfigError(file, error instanceof Error ? error.message : String(error));\n\t}\n\n\tif (!isRecord(config)) throw new TsconfigError(file, \"the config must be a JSON object.\");\n\n\treturn config;\n}\n\n/** The file an `extends` entry points to: a path relative to the config, or a package such as `@tsconfig/node22`. */\nfunction resolveExtends(specifier: string, from: string): string {\n\tif (specifier.startsWith(\".\") || path.isAbsolute(specifier)) {\n\t\tconst file = path.resolve(path.dirname(from), specifier);\n\n\t\tif (isFile(file)) return file;\n\t\tif (!file.endsWith(\".json\") && isFile(`${file}.json`)) return `${file}.json`;\n\t} else {\n\t\tconst require = createRequire(from);\n\t\tconst candidates = specifier.endsWith(\".json\") ? [specifier] : [`${specifier}/tsconfig.json`, specifier];\n\n\t\tfor (const candidate of candidates) {\n\t\t\ttry {\n\t\t\t\treturn require.resolve(candidate);\n\t\t\t} catch {\n\t\t\t\t// Try the next way of naming the config.\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new TsconfigError(from, `extends ${JSON.stringify(specifier)}, which cannot be found.`);\n}\n\n/** What one config (with everything it extends) sets, with paths resolved against the config that set them. */\ninterface Options {\n\tbaseUrl?: string;\n\tpaths?: { mapping: Record<string, unknown>; base: string };\n}\n\nconst substitute = (value: string, configDir: string): string => value.split(CONFIG_DIR).join(configDir);\n\nfunction loadOptions(file: string, configDir: string, chain: string[], read: string[]): Options {\n\tif (chain.includes(file)) {\n\t\tthrow new TsconfigError(chain[0], `circular extends: ${[...chain, file].map(normalize).join(\" -> \")}.`);\n\t}\n\n\tconst config = readConfig(file);\n\tconst dir = path.dirname(file);\n\tconst parents = typeof config.extends === \"string\" ? [config.extends] : config.extends;\n\tlet options: Options = {};\n\n\tread.push(file);\n\n\tif (Array.isArray(parents)) {\n\t\tfor (const parent of parents) {\n\t\t\tif (typeof parent !== \"string\") continue;\n\n\t\t\tconst inherited = loadOptions(resolveExtends(parent, file), configDir, [...chain, file], read);\n\n\t\t\toptions = { ...options, ...inherited };\n\t\t}\n\t}\n\n\tconst compilerOptions = isRecord(config.compilerOptions) ? config.compilerOptions : {};\n\n\tif (typeof compilerOptions.baseUrl === \"string\") {\n\t\toptions.baseUrl = path.resolve(dir, substitute(compilerOptions.baseUrl, configDir));\n\t}\n\n\tif (isRecord(compilerOptions.paths)) options.paths = { mapping: compilerOptions.paths, base: dir };\n\n\treturn options;\n}\n\nfunction toMappings(options: Options, configDir: string): PathMapping[] {\n\tif (!options.paths) return [];\n\n\tconst base = options.baseUrl ?? options.paths.base;\n\n\treturn Object.entries(options.paths.mapping).flatMap(([pattern, value]) => {\n\t\tconst targets = Array.isArray(value) ? value.filter((target): target is string => typeof target === \"string\") : [];\n\t\tconst star = pattern.indexOf(\"*\");\n\n\t\tif (targets.length === 0) return [];\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tpattern,\n\t\t\t\tprefix: star === -1 ? pattern : pattern.slice(0, star),\n\t\t\t\tsuffix: star === -1 ? \"\" : pattern.slice(star + 1),\n\t\t\t\twildcard: star !== -1,\n\t\t\t\ttargets: targets.map(target => normalize(path.resolve(base, substitute(target, configDir)))),\n\t\t\t},\n\t\t];\n\t});\n}\n\n/** Parsed configs per file, kept for the lifetime of the linter process and refreshed when any file in the chain changes. */\nconst configCache = new Map<string, { read: { file: string; mtimeMs: number }[]; value: TsconfigPaths }>();\n\nconst mtime = (file: string): number | undefined => statSync(file, { throwIfNoEntry: false })?.mtimeMs;\n\n/** The `paths` and `baseUrl` of a config file, including what it extends. Throws for unreadable or invalid configs. */\nexport function loadTsconfig(file: string): TsconfigPaths {\n\tconst cached = configCache.get(file);\n\n\tif (cached?.read.every(entry => mtime(entry.file) === entry.mtimeMs)) return cached.value;\n\n\tconst configDir = path.dirname(file);\n\tconst read: string[] = [];\n\tconst options = loadOptions(file, configDir, [], read);\n\tconst value: TsconfigPaths = {\n\t\tfile: normalize(file),\n\t\tbaseUrl: options.baseUrl === undefined ? undefined : normalize(options.baseUrl),\n\t\tpaths: toMappings(options, configDir),\n\t};\n\n\tconfigCache.set(file, { read: read.map(entry => ({ file: entry, mtimeMs: mtime(entry) ?? -1 })), value });\n\n\treturn value;\n}\n\n/** Nearest `tsconfig.json` per directory (`null` for none), kept for the lifetime of the linter process. */\nconst lookupCache = new Map<string, string | null>();\n\n/** The nearest `tsconfig.json`, from the file's folder upwards, or `undefined` when there is none. */\nexport function findTsconfig(filename: string): string | undefined {\n\tconst visited: string[] = [];\n\tlet found: string | null | undefined;\n\n\tfor (let dir = path.dirname(path.resolve(filename)); ;) {\n\t\tfound = lookupCache.get(dir);\n\t\tif (found !== undefined) break;\n\n\t\tvisited.push(dir);\n\n\t\tconst candidate = path.join(dir, \"tsconfig.json\");\n\n\t\tif (isFile(candidate)) {\n\t\t\tfound = candidate;\n\t\t\tbreak;\n\t\t}\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir) {\n\t\t\tfound = null;\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\tfor (const dir of visited) lookupCache.set(dir, found);\n\n\treturn found ?? undefined;\n}\n\n/** The `paths` and `baseUrl` that apply to a file, from its nearest `tsconfig.json`. */\nexport function tsconfigFor(filename: string): TsconfigPaths | undefined {\n\tconst file = findTsconfig(filename);\n\n\treturn file === undefined ? undefined : loadTsconfig(file);\n}\n\n/**\n * The candidate paths a `paths` entry maps a request to, as TypeScript picks them: an exact pattern first,\n * otherwise the wildcard pattern with the longest prefix. `undefined` when no pattern matches.\n */\nexport function matchPaths(request: string, mappings: readonly PathMapping[]): string[] | undefined {\n\tconst exact = mappings.find(mapping => !mapping.wildcard && mapping.pattern === request);\n\n\tif (exact) return exact.targets;\n\n\tlet best: PathMapping | undefined;\n\n\tfor (const mapping of mappings) {\n\t\tif (\n\t\t\tmapping.wildcard &&\n\t\t\trequest.length >= mapping.prefix.length + mapping.suffix.length &&\n\t\t\trequest.startsWith(mapping.prefix) &&\n\t\t\trequest.endsWith(mapping.suffix) &&\n\t\t\t(best === undefined || mapping.prefix.length > best.prefix.length)\n\t\t) {\n\t\t\tbest = mapping;\n\t\t}\n\t}\n\n\tif (best === undefined) return undefined;\n\n\tconst matched = request.slice(best.prefix.length, request.length - best.suffix.length);\n\n\treturn best.targets.map(target => target.replace(\"*\", matched));\n}\n","import { existsSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { AREA_LAYER_FOLDERS, LAYER_FOLDERS } from \"./conventions\";\nimport type { Area, Conventions, LayerFolder } from \"./conventions\";\nimport { matchPaths, tsconfigFor } from \"./tsconfig\";\n\nexport type { Area } from \"./conventions\";\n\n/**\n * File classification for the SPARTA folder conventions (names shown with their defaults; see `conventions.ts`):\n *\n * - `sparta/{api,database,desktop,mobile,ui}/<group>/<layer folder>/` holds the layers of one group.\n * - `sparta/{api,database,desktop,mobile,ui}/common/` is shared within an area.\n * - Builders (`builders/`) and directors (`directors/`) live in a group or an area's `common/` like any layer\n * folder, directly in an area (`sparta/<area>/builders/`, shared by its groups), or in `sparta/common/` (shared\n * by everything, classified as `shared` with a layer).\n * - `mobile` and `desktop` are structured like `ui`, with `screens/` and `windows/` in place of `pages/`.\n * - `sparta/scenarios/`, `sparta/fixtures/`, `sparta/common/` and `sparta/support/` are top level.\n * - `tests/` holds the tests, except `tests/framework/`, which is never checked.\n * - `@sparta/*` and `@tests/*` are path aliases for `<root>/sparta/` and `<root>/tests/`, where the root is the\n * nearest folder with a `package.json`, or `settings.sparta.root` when that is set.\n * - Imports also resolve through `compilerOptions.paths` and `baseUrl` of the nearest `tsconfig.json`.\n */\n\nexport type Kind = \"group\" | \"area-common\" | \"area-layer\" | \"top-scenario\" | \"fixture\" | \"shared\" | \"test\";\n\nexport interface FileInfo {\n\tkind: Kind;\n\t/** The standard area the file's area follows, which decides the layer rules. */\n\tarea?: Area;\n\t/** The area folder as it appears in the project, which decides isolation. */\n\tareaFolder?: string;\n\tgroup?: string;\n\tlayer?: string;\n}\n\nexport const normalize = (value: string): string => value.split(\"\\\\\").join(\"/\");\n\nconst TOP_LEVEL_KINDS: Record<string, Kind> = { fixtures: \"fixture\", scenarios: \"top-scenario\" };\n\n/** The standard layer folder that a project's folder name follows, if any. */\nconst standardFolder = (conventions: Conventions, folder: string | undefined): LayerFolder | undefined =>\n\tfolder === undefined ? undefined : conventions.layerFolders.get(folder);\n\n/** The layer of a standard layer folder (`stepper` for `steppers`), if it has one. */\nconst layerOf = (standard: LayerFolder | undefined): string | undefined =>\n\tstandard === undefined ? undefined : (LAYER_FOLDERS[standard] as { layer?: string }).layer;\n\nexport interface LayerFolderInfo {\n\t/** The folder name as it appears in the project. */\n\tname: string;\n\t/** The standard layer folder it follows, or `undefined` for folders SPARTA does not know. */\n\tstandard?: LayerFolder;\n}\n\n/** `name` as a builders or directors folder (`AREA_LAYER_FOLDERS`), if it is one. */\nconst builderFolder = (conventions: Conventions, name: string | undefined): LayerFolderInfo | undefined => {\n\tconst standard = standardFolder(conventions, name);\n\n\treturn name !== undefined && standard !== undefined && AREA_LAYER_FOLDERS.has(standard)\n\t\t? { name, standard }\n\t\t: undefined;\n};\n\n/** The area-level layer folder (`builders/`, `directors/` directly below an area) a project path is in, if any. */\nconst areaLayerFolder = (file: string, conventions: Conventions): LayerFolderInfo | undefined =>\n\tbuilderFolder(conventions, file.match(conventions.patterns.area)?.[2]);\n\n/** The `builders/` or `directors/` folder directly below `sparta/common/` a project path is in, if any. */\nconst commonLayerFolder = (file: string, conventions: Conventions): LayerFolderInfo | undefined =>\n\tbuilderFolder(conventions, file.match(conventions.patterns.common)?.[1]);\n\nconst caseInsensitivePaths = process.platform === \"win32\";\n\n/**\n * The part of `filename` below the project `root`, with a leading `/` (`/sparta/ui/...`), or `undefined` for files\n * outside the root. Only this part is matched against the SPARTA folder names, so folders above the project (such\n * as a checkout inside a folder named `tests`) never change how a file is classified.\n */\nexport function projectPath(filename: string, root: string): string | undefined {\n\tconst file = normalize(filename);\n\tconst base = normalize(root).replace(/\\/$/, \"\");\n\tconst prefix = file.slice(0, base.length);\n\tconst inRoot = caseInsensitivePaths ? prefix.toLowerCase() === base.toLowerCase() : prefix === base;\n\n\treturn inRoot && file[base.length] === \"/\" ? file.slice(base.length) : undefined;\n}\n\n/** What a file is in the SPARTA architecture, judged by its path below `root`. */\nexport function classify(filename: string, conventions: Conventions, root: string): FileInfo | undefined {\n\tconst file = projectPath(filename, root);\n\tconst { patterns } = conventions;\n\n\tif (file === undefined || patterns.framework.test(file)) return undefined;\n\tif (patterns.tests.test(file)) return { kind: \"test\" };\n\n\tconst area = file.match(patterns.area);\n\n\tif (area) {\n\t\tconst [, areaName, group, folder] = area;\n\t\tconst areaLayer = areaLayerFolder(file, conventions);\n\n\t\tif (areaLayer) {\n\t\t\treturn {\n\t\t\t\tkind: \"area-layer\",\n\t\t\t\tarea: conventions.areas.get(areaName),\n\t\t\t\tareaFolder: areaName,\n\t\t\t\tlayer: layerOf(areaLayer.standard),\n\t\t\t};\n\t\t}\n\n\t\tconst base = file.match(/-base-(client|repository|service)(?:\\.[cm]?[jt]s)?$/)?.[1];\n\t\tconst layer = base ? `base-${base}` : layerOf(standardFolder(conventions, folder));\n\n\t\treturn {\n\t\t\tkind: group === \"common\" ? \"area-common\" : \"group\",\n\t\t\tarea: conventions.areas.get(areaName),\n\t\t\tareaFolder: areaName,\n\t\t\tgroup,\n\t\t\tlayer,\n\t\t};\n\t}\n\n\tconst top = file.match(patterns.top)?.[1];\n\n\tif (top === undefined) return undefined;\n\n\tconst commonLayer = top === \"common\" ? commonLayerFolder(file, conventions) : undefined;\n\n\treturn commonLayer\n\t\t? { kind: \"shared\", layer: layerOf(commonLayer.standard) }\n\t\t: { kind: TOP_LEVEL_KINDS[top] ?? \"shared\" };\n}\n\n/** Project root per directory, kept for the lifetime of the linter process. */\nconst rootCache = new Map<string, string>();\n\n/**\n * The project root of a file: the nearest directory, from the file upwards, that contains a `package.json`.\n * Falls back to the working directory when there is none.\n */\nexport function projectRoot(filename: string): string {\n\tconst visited: string[] = [];\n\tlet root: string | undefined;\n\n\tfor (let dir = path.dirname(path.resolve(filename)); ;) {\n\t\troot = rootCache.get(dir);\n\t\tif (root !== undefined) break;\n\n\t\tvisited.push(dir);\n\n\t\tif (existsSync(path.join(dir, \"package.json\"))) {\n\t\t\troot = normalize(dir);\n\t\t\tbreak;\n\t\t}\n\n\t\tconst parent = path.dirname(dir);\n\n\t\tif (parent === dir) {\n\t\t\troot = normalize(process.cwd());\n\t\t\tbreak;\n\t\t}\n\n\t\tdir = parent;\n\t}\n\n\tfor (const dir of visited) rootCache.set(dir, root);\n\n\treturn root;\n}\n\n/** The extensions tried, in order, to find the file behind an extension-less import. */\nconst MODULE_EXTENSIONS = [\"\", \".ts\", \".tsx\", \".mts\", \".cts\", \"/index.ts\"];\n\nconst isFile = (file: string): boolean => statSync(file, { throwIfNoEntry: false })?.isFile() ?? false;\n\n/** The TypeScript file an import path points to (`./x` -> `./x.ts`, `./x.js` -> `./x.ts`), if it exists. */\nexport function moduleFile(base: string): string | undefined {\n\tconst stripped = base.replace(/\\.(?:m|c)?js$/, \"\");\n\n\tfor (const candidate of [base, ...MODULE_EXTENSIONS.map(extension => `${stripped}${extension}`)]) {\n\t\tif (isFile(candidate)) return normalize(candidate);\n\t}\n\n\treturn undefined;\n}\n\n/** True when an import path points to an existing file or folder. */\nconst moduleExists = (base: string): boolean =>\n\t(statSync(base, { throwIfNoEntry: false })?.isDirectory() ?? false) || moduleFile(base) !== undefined;\n\n/**\n * Resolves an import to an absolute, normalized path, the way TypeScript would:\n *\n * 1. relative imports, against the importing file;\n * 2. `compilerOptions.paths` of the nearest `tsconfig.json`, taking the first target that exists;\n * 3. the `@sparta/*` and `@tests/*` aliases and `settings.sparta.aliases`, against `root`;\n * 4. the first `paths` target when none exists (yet);\n * 5. `compilerOptions.baseUrl`, only when the file exists, so package imports are not mistaken for project files.\n *\n * Other imports (packages) resolve to `undefined`.\n */\nexport function resolveImport(\n\tfilename: string,\n\trequest: string,\n\troot: string,\n\tconventions: Conventions\n): string | undefined {\n\tif (request.startsWith(\".\")) return normalize(path.resolve(path.dirname(filename), request));\n\n\tconst tsconfig = tsconfigFor(filename);\n\tconst mapped = tsconfig === undefined ? undefined : matchPaths(request, tsconfig.paths);\n\tconst existing = mapped?.find(moduleExists);\n\n\tif (existing !== undefined) return existing;\n\n\tfor (const [prefix, target] of conventions.aliases) {\n\t\tif (request.startsWith(prefix)) {\n\t\t\tconst folder = target === \"sparta\" ? conventions.spartaFolder : conventions.testsFolder;\n\n\t\t\treturn `${root}/${folder}/${request.slice(prefix.length)}`;\n\t\t}\n\t}\n\n\tif (mapped !== undefined && mapped.length > 0) return mapped[0];\n\n\tconst fromBaseUrl = tsconfig?.baseUrl === undefined ? undefined : `${tsconfig.baseUrl}/${request}`;\n\n\treturn fromBaseUrl !== undefined && moduleExists(fromBaseUrl) ? fromBaseUrl : undefined;\n}\n\n/**\n * The layer folder a file lives in (`steppers`, `pages`, ...), with `sparta/scenarios/` counting as `scenarios`\n * and `sparta/<area>/builders/` and `directors/` as themselves.\n */\nexport const layerFolder = (filename: string, conventions: Conventions, root: string): LayerFolderInfo | undefined => {\n\tconst file = projectPath(filename, root);\n\n\tif (file === undefined) return undefined;\n\n\tconst top = file.match(conventions.patterns.top)?.[1];\n\n\tif (top === \"scenarios\") return { name: \"scenarios\", standard: \"scenarios\" };\n\tif (top === \"common\") return commonLayerFolder(file, conventions);\n\n\tconst areaLayer = areaLayerFolder(file, conventions);\n\n\tif (areaLayer) return areaLayer;\n\n\tconst folder = file.match(conventions.patterns.layer)?.[1];\n\n\treturn folder === undefined ? undefined : { name: folder, standard: standardFolder(conventions, folder) };\n};\n\n/** The file name suffix the files in a layer folder must use (`stepper` for `steppers/`), if it has one. */\nexport const layerSuffix = (folder: LayerFolderInfo | undefined): string | undefined =>\n\tfolder?.standard === undefined ? undefined : (LAYER_FOLDERS[folder.standard] as { suffix?: string }).suffix;\n\n/** The file name without its TypeScript extension: `orders-stepper` for `orders-stepper.ts` or `.mts`. */\nexport const moduleName = (filename: string): string => path.basename(filename).replace(/\\.[cm]?tsx?$/, \"\");\n\n/** `.d.ts`, `.d.mts` and `.d.cts` files, which only declare types. */\nexport const isDeclarationFile = (filename: string): boolean => /\\.d\\.[cm]?ts$/.test(filename);\n\n/** True for files that follow the layer naming convention (layer folders and fixtures). */\nexport const isLayerFile = (filename: string, conventions: Conventions, root: string): boolean =>\n\tlayerSuffix(layerFolder(filename, conventions, root)) !== undefined ||\n\tprojectPath(filename, root)?.match(conventions.patterns.top)?.[1] === \"fixtures\";\n","import { parseSettings } from \"./conventions\";\nimport type { Conventions } from \"./conventions\";\nimport { projectRoot } from \"./sparta-paths\";\nimport type { Rule } from \"./types\";\n\ntype Context = Parameters<Rule[\"create\"]>[0];\n\n/** Parsed settings per raw settings and working directory, kept for the lifetime of the linter process. */\nconst cache = new Map<string, Conventions>();\n\n/** The validated `settings.sparta` for this file. Throws a descriptive error for invalid settings. */\nexport function conventionsFor(context: Context): Conventions {\n\tconst raw: unknown = (context.settings as Record<string, unknown> | undefined)?.sparta;\n\tconst key = `${context.cwd}\\0${JSON.stringify(raw ?? null)}`;\n\tlet conventions = cache.get(key);\n\n\tif (conventions === undefined) {\n\t\tconventions = parseSettings(raw, context.cwd);\n\t\tcache.set(key, conventions);\n\t}\n\n\treturn conventions;\n}\n\n/**\n * The project root the aliases resolve against: `settings.sparta.root` when set (relative paths resolve against\n * the linter's working directory), otherwise the nearest folder with a `package.json`.\n */\nexport const rootFor = (context: Context, conventions = conventionsFor(context)): string =>\n\tconventions.root ?? projectRoot(context.filename);\n","import { staticString, stringValue } from \"../utils/ast\";\nimport { isStaticClass, topLevelClasses } from \"../utils/class-members\";\nimport type { Conventions } from \"../utils/conventions\";\nimport { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { classify, moduleName, resolveImport } from \"../utils/sparta-paths\";\nimport type { Area, FileInfo, Kind } from \"../utils/sparta-paths\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\ntype OrchestrationKind = Extract<Kind, \"top-scenario\" | \"test\">;\n\nconst DATABASE_LAYERS = [\n\t\"asserter\",\n\t\"base-repository\",\n\t\"base-service\",\n\t\"container\",\n\t\"database\",\n\t\"repository\",\n\t\"scenario\",\n\t\"service\",\n\t\"stepper\",\n];\n\n/** The UI layers; `view` is the area's name for a page (`page` for web, `screen` for mobile, `window` for desktop). */\nconst uiLayers = (view: \"page\" | \"screen\" | \"window\"): Record<string, Set<string>> => ({\n\tcomponent: new Set([view, \"stepper\", \"asserter\", \"scenario\"]),\n\t[view]: new Set([\"stepper\", \"asserter\", \"scenario\"]),\n\tstepper: new Set([\"asserter\", \"scenario\"]),\n\tasserter: new Set([\"stepper\", \"asserter\", \"scenario\"]),\n\tscenario: new Set([view, \"component\"]),\n});\n\n/** Forbidden target layers inside the same area (API -> API, UI -> UI, database -> database, and so on). */\nconst FORBIDDEN_LAYERS: Record<Area, Record<string, Set<string>>> = {\n\tapi: {\n\t\tclient: new Set([\"client\", \"service\", \"base-service\", \"stepper\", \"asserter\", \"scenario\"]),\n\t\t\"base-client\": new Set([\"client\", \"base-client\", \"service\", \"base-service\", \"stepper\", \"asserter\", \"scenario\"]),\n\t\tservice: new Set([\"service\", \"stepper\", \"asserter\", \"scenario\"]),\n\t\t\"base-service\": new Set([\"service\", \"base-service\", \"stepper\", \"asserter\", \"scenario\"]),\n\t\tstepper: new Set([\"client\", \"base-client\", \"asserter\", \"scenario\"]),\n\t\tasserter: new Set([\"stepper\", \"asserter\", \"scenario\"]),\n\t\tscenario: new Set([\"service\", \"base-service\", \"client\", \"base-client\"]),\n\t},\n\tdatabase: {\n\t\trepository: new Set([\"service\", \"base-service\", \"stepper\", \"asserter\", \"scenario\"]),\n\t\t\"base-repository\": new Set([\n\t\t\t\"repository\",\n\t\t\t\"base-repository\",\n\t\t\t\"service\",\n\t\t\t\"base-service\",\n\t\t\t\"stepper\",\n\t\t\t\"asserter\",\n\t\t\t\"scenario\",\n\t\t]),\n\t\tservice: new Set([\"service\", \"stepper\", \"asserter\", \"scenario\"]),\n\t\t\"base-service\": new Set([\"service\", \"base-service\", \"stepper\", \"asserter\", \"scenario\"]),\n\t\tdatabase: new Set(DATABASE_LAYERS),\n\t\tcontainer: new Set(DATABASE_LAYERS.filter(layer => layer !== \"database\")),\n\t\tstepper: new Set([\"repository\", \"base-repository\", \"asserter\", \"scenario\"]),\n\t\tasserter: new Set([\"repository\", \"base-repository\", \"stepper\", \"asserter\", \"scenario\"]),\n\t\tscenario: new Set([\"service\", \"base-service\", \"repository\", \"base-repository\"]),\n\t},\n\tdesktop: uiLayers(\"window\"),\n\tmobile: uiLayers(\"screen\"),\n\tui: uiLayers(\"page\"),\n};\n\n/** The layers of the `builders/` and `directors/` folders, wherever they live. */\nconst BUILDER_LAYERS = new Set([\"builder\", \"director\"]);\n\n/** The only layers, besides directors, that may use builders and directors. */\nconst BUILDER_USERS = new Set([\"scenario\", \"stepper\", \"asserter\", \"service\"]);\n\n/** Whether a file is a builder or director: in a group, an area's `common/`, an area, or `sparta/common/`. */\nconst isBuilderLayer = (info: FileInfo): boolean => info.layer !== undefined && BUILDER_LAYERS.has(info.layer);\n\nconst DATABASE_ACCESS = [\"repository\", \"base-repository\", \"service\", \"base-service\", \"container\", \"database\"];\n\n/** Layers that code orchestrating flows (top-level scenarios, tests) must not touch directly. */\nconst FORBIDDEN_FOR_ORCHESTRATION: Record<OrchestrationKind, Record<Area, Set<string>>> = {\n\t\"top-scenario\": {\n\t\tapi: new Set([\"client\", \"base-client\", \"service\", \"base-service\"]),\n\t\tdatabase: new Set(DATABASE_ACCESS),\n\t\tdesktop: new Set([\"window\", \"component\"]),\n\t\tmobile: new Set([\"screen\", \"component\"]),\n\t\tui: new Set([\"page\", \"component\"]),\n\t},\n\ttest: {\n\t\tapi: new Set([\"client\", \"base-client\", \"service\", \"base-service\", \"stepper\", \"asserter\"]),\n\t\tdatabase: new Set([...DATABASE_ACCESS, \"stepper\", \"asserter\"]),\n\t\tdesktop: new Set([\"window\", \"component\", \"stepper\", \"asserter\"]),\n\t\tmobile: new Set([\"screen\", \"component\", \"stepper\", \"asserter\"]),\n\t\tui: new Set([\"page\", \"component\", \"stepper\", \"asserter\"]),\n\t},\n};\n\nconst REEXPORT_LAYERS = new Set([\n\t\"asserter\",\n\t\"builder\",\n\t\"client\",\n\t\"base-client\",\n\t\"base-repository\",\n\t\"component\",\n\t\"director\",\n\t\"page\",\n\t\"repository\",\n\t\"scenario\",\n\t\"screen\",\n\t\"service\",\n\t\"base-service\",\n\t\"stepper\",\n\t\"window\",\n]);\n\nconst describe = (info: FileInfo, { spartaFolder, testsFolder }: Conventions): string =>\n\t({\n\t\tgroup: `${info.areaFolder}${info.group === undefined ? \"\" : `/${info.group}`}${info.layer ? ` ${info.layer}` : \"\"}`,\n\t\t\"area-common\": `${info.areaFolder}/common`,\n\t\t\"area-layer\": `${info.areaFolder} ${info.layer}`,\n\t\t\"top-scenario\": `${spartaFolder}/scenarios`,\n\t\tfixture: `${spartaFolder}/fixtures`,\n\t\tshared: info.layer ? `${spartaFolder}/common ${info.layer}` : `${spartaFolder}/common|support`,\n\t\ttest: testsFolder,\n\t})[info.kind];\n\n/** Whether code in an area folder (a group, or the area's builders and directors) may not depend on `target`. */\nfunction areaIsolationViolation(source: FileInfo, target: FileInfo): boolean {\n\tif ([\"fixture\", \"top-scenario\"].includes(target.kind)) return true;\n\tif (target.areaFolder === undefined) return false;\n\tif (target.areaFolder !== source.areaFolder) return true;\n\tif (target.kind !== \"group\") return false;\n\n\t// Builders and directors are shared by the area's groups, so the only group code they may use is a service.\n\treturn source.kind === \"area-layer\" ? target.layer !== \"service\" : target.group !== source.group;\n}\n\n/** Isolation compares area folders, not area types: `web/` and `ui/` are separate areas even when both follow `ui`. */\nfunction isolationViolation(source: FileInfo, target: FileInfo): boolean {\n\tif (target.kind === \"test\") return source.kind !== \"test\";\n\n\tif (source.kind === \"shared\") {\n\t\treturn [\"group\", \"area-common\", \"area-layer\", \"fixture\", \"top-scenario\"].includes(target.kind);\n\t}\n\n\tif (source.kind === \"area-common\") {\n\t\tif ([\"fixture\", \"top-scenario\", \"group\", \"area-layer\"].includes(target.kind)) return true;\n\n\t\treturn target.kind === \"area-common\" && target.areaFolder !== source.areaFolder;\n\t}\n\n\treturn source.kind === \"group\" || source.kind === \"area-layer\" ? areaIsolationViolation(source, target) : false;\n}\n\n/**\n * Whether `source` may not use the builder or director `target`: builders use no builders or directors, directors\n * only use builders, and otherwise only scenarios, steppers, asserters and services may use them. Fixtures,\n * top-level scenarios and tests are left to the other checks. Which builders a file can see is up to isolation.\n */\nfunction builderViolation(source: FileInfo, target: FileInfo): boolean | undefined {\n\tif (isBuilderLayer(source)) return source.layer === \"builder\" || target.layer === \"director\";\n\tif ([\"group\", \"area-common\", \"shared\"].includes(source.kind)) {\n\t\treturn source.layer === undefined || !BUILDER_USERS.has(source.layer);\n\t}\n\n\treturn undefined;\n}\n\nfunction layerViolation(source: FileInfo, target: FileInfo): boolean {\n\tif (!target.layer) return false;\n\n\tconst builder = BUILDER_LAYERS.has(target.layer) ? builderViolation(source, target) : undefined;\n\n\tif (builder !== undefined) return builder;\n\n\t// Builders and directors may use services, and code outside the layer folders (models), but no other layer.\n\tif (isBuilderLayer(source)) return target.layer !== \"service\";\n\n\tif (!target.area) return false;\n\n\tif (source.kind === \"group\" || source.kind === \"area-common\") {\n\t\tif (!source.area || !source.layer) return false;\n\n\t\treturn (\n\t\t\tsource.areaFolder === target.areaFolder && Boolean(FORBIDDEN_LAYERS[source.area][source.layer]?.has(target.layer))\n\t\t);\n\t}\n\n\tif (source.kind === \"top-scenario\" || source.kind === \"test\") {\n\t\treturn FORBIDDEN_FOR_ORCHESTRATION[source.kind][target.area].has(target.layer);\n\t}\n\n\treturn false;\n}\n\nconst isForbiddenReexport = (source: FileInfo, target: FileInfo): boolean =>\n\ttarget.layer !== undefined &&\n\tREEXPORT_LAYERS.has(target.layer) &&\n\ttarget.layer !== source.layer &&\n\t![\"fixture\", \"test\"].includes(source.kind);\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription: \"Enforce the SPARTA layer and isolation boundaries between imports.\",\n\t\t\turl: docsUrl(\"architecture-boundaries\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tisolation:\n\t\t\t\t\"{{source}} must not depend on {{target}} ({{request}}). Move shared code to the area's common/ folder or the top-level common/ folder.\",\n\t\t\tlayer: \"{{source}} must not depend on {{target}} ({{request}}).\",\n\t\t\treexport: \"Do not re-export {{target}} outside its layer; this bypasses the architecture boundaries.\",\n\t\t\tstaticService:\n\t\t\t\t\"{{source}} is a static abstract class and must not depend on {{target}} ({{request}}); only a normal class may use services.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst filename = context.filename;\n\t\tconst conventions = conventionsFor(context);\n\t\tconst root = rootFor(context, conventions);\n\t\tconst source = classify(filename, conventions, root);\n\n\t\tif (!source) return {};\n\n\t\t/** Whether the file declares a normal (instantiable) class. Set on `Program`, before any import is visited. */\n\t\tlet isNormalClass = false;\n\n\t\t/** An `index.ts` barrel in `builders/` or `directors/` may import and re-export its own layer. */\n\t\tconst isOwnBarrel = (target: FileInfo): boolean =>\n\t\t\tisBuilderLayer(source) &&\n\t\t\tmoduleName(filename) === \"index\" &&\n\t\t\ttarget.kind === source.kind &&\n\t\t\ttarget.areaFolder === source.areaFolder &&\n\t\t\ttarget.group === source.group &&\n\t\t\ttarget.layer === source.layer;\n\n\t\tconst check = (node: AstNode, request: string | undefined, reexport = false): void => {\n\t\t\tif (request === undefined) return;\n\n\t\t\tconst resolved = resolveImport(filename, request, root, conventions);\n\t\t\tconst target = resolved ? classify(resolved, conventions, root) : undefined;\n\n\t\t\tif (!target || isOwnBarrel(target)) return;\n\n\t\t\tconst data = { source: describe(source, conventions), target: describe(target, conventions), request };\n\n\t\t\tif (isolationViolation(source, target)) {\n\t\t\t\tcontext.report({ node, messageId: \"isolation\", data });\n\t\t\t} else if (layerViolation(source, target)) {\n\t\t\t\tcontext.report({ node, messageId: \"layer\", data });\n\t\t\t} else if (isBuilderLayer(source) && target.layer === \"service\" && !isNormalClass) {\n\t\t\t\tcontext.report({ node, messageId: \"staticService\", data });\n\t\t\t} else if (reexport && isForbiddenReexport(source, target)) {\n\t\t\t\tcontext.report({ node, messageId: \"reexport\", data });\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tProgram(node): void {\n\t\t\t\tisNormalClass = topLevelClasses(node).some(declaration => !isStaticClass(declaration));\n\t\t\t},\n\n\t\t\tImportDeclaration: node => check(node, stringValue(node.source)),\n\n\t\t\tExportNamedDeclaration: node => check(node, stringValue(node.source), true),\n\n\t\t\tExportAllDeclaration: node => check(node, stringValue(node.source), true),\n\n\t\t\tImportExpression: node => check(node, staticString(node.source)),\n\n\t\t\tTSImportType: node => check(node, stringValue(node.source)),\n\n\t\t\tTSImportEqualsDeclaration(node): void {\n\t\t\t\tif (node.moduleReference.type === \"TSExternalModuleReference\") {\n\t\t\t\t\tcheck(node, stringValue(node.moduleReference.expression));\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tCallExpression(node): void {\n\t\t\t\tif (node.callee.type === \"Identifier\" && node.callee.name === \"require\") {\n\t\t\t\t\tcheck(node, staticString(node.arguments[0]));\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { isDeclarationFile, isLayerFile, layerFolder, layerSuffix, moduleName } from \"../utils/sparta-paths\";\nimport type { AstNode, NodeOfType, Rule } from \"../utils/types\";\n\ntype Statement = NodeOfType<\"Program\">[\"body\"][number];\n\ntype ClassDeclaration = Extract<AstNode, { type: \"ClassDeclaration\" | \"ClassExpression\" }>;\n\nconst toPascalCase = (name: string): string =>\n\tname\n\t\t.split(\"-\")\n\t\t.map(part => part.charAt(0).toUpperCase() + part.slice(1))\n\t\t.join(\"\");\n\nconst classOf = (statement: Statement): ClassDeclaration | undefined => {\n\tconst node: AstNode =\n\t\t(statement.type === \"ExportNamedDeclaration\" || statement.type === \"ExportDefaultDeclaration\") &&\n\t\tstatement.declaration\n\t\t\t? statement.declaration\n\t\t\t: statement;\n\n\treturn node.type === \"ClassDeclaration\" ? node : undefined;\n};\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription: \"Require a layer file to contain exactly one class, named after the file in PascalCase.\",\n\t\t\turl: docsUrl(\"class-matches-filename\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tname: \"Class '{{found}}' must be named '{{expected}}' to match the file name.\",\n\t\t\tsingle: \"A layer file contains exactly one class; move '{{found}}' to its own file.\",\n\t\t\tmissing: \"A layer file contains exactly one class; expected a class named '{{expected}}'.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst conventions = conventionsFor(context);\n\t\tconst root = rootFor(context, conventions);\n\t\tconst { filename } = context;\n\n\t\tif (isDeclarationFile(filename) || !isLayerFile(filename, conventions, root)) return {};\n\n\t\tconst module = moduleName(filename);\n\t\tconst expected = toPascalCase(module);\n\t\t// Files in a layer folder must hold their class; fixtures and barrels (`index.ts`) may hold none.\n\t\tconst requiresClass = module !== \"index\" && layerSuffix(layerFolder(filename, conventions, root)) !== undefined;\n\n\t\treturn {\n\t\t\tProgram(program): void {\n\t\t\t\tconst classes = program.body.map(classOf).filter((node): node is ClassDeclaration => node !== undefined);\n\n\t\t\t\tif (classes.length === 0 && requiresClass) {\n\t\t\t\t\tcontext.report({ node: program, messageId: \"missing\", data: { expected } });\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tclasses.forEach((node, index) => {\n\t\t\t\t\tconst found = node.id?.name ?? \"(anonymous)\";\n\n\t\t\t\t\tif (index > 0) {\n\t\t\t\t\t\tcontext.report({ node: node.id ?? node, messageId: \"single\", data: { found } });\n\t\t\t\t\t} else if (found !== expected) {\n\t\t\t\t\t\tcontext.report({ node: node.id ?? node, messageId: \"name\", data: { found, expected } });\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { staticString } from \"../utils/ast\";\nimport { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { classify, moduleName, resolveImport } from \"../utils/sparta-paths\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Require a director to compose several builders; a director using a single builder belongs on that builder.\",\n\t\t\turl: docsUrl(\"director-composes-builders\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tsingleBuilder:\n\t\t\t\t\"This director only uses '{{builder}}'; make it a custom method on '{{builder}}'. A director composes several builders.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst filename = context.filename;\n\t\tconst conventions = conventionsFor(context);\n\t\tconst root = rootFor(context, conventions);\n\t\tconst source = classify(filename, conventions, root);\n\n\t\tif (source?.layer !== \"director\" || moduleName(filename) === \"index\") return {};\n\n\t\tconst isBuilder = (request: string | undefined): boolean => {\n\t\t\tif (request === undefined) return false;\n\n\t\t\tconst resolved = resolveImport(filename, request, root, conventions);\n\n\t\t\treturn resolved !== undefined && classify(resolved, conventions, root)?.layer === \"builder\";\n\t\t};\n\n\t\t/** The builders the director uses, by imported name, with the import to report. */\n\t\tconst builders = new Map<string, { local: string; node: AstNode }>();\n\n\t\t/** Set when a builder is imported in a way that does not tell how many builders are used. */\n\t\tlet unknown = false;\n\n\t\treturn {\n\t\t\tImportDeclaration(node): void {\n\t\t\t\tif (node.importKind === \"type\" || typeof node.source.value !== \"string\" || !isBuilder(node.source.value)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfor (const specifier of node.specifiers) {\n\t\t\t\t\tif (specifier.type === \"ImportNamespaceSpecifier\") {\n\t\t\t\t\t\tunknown = true;\n\t\t\t\t\t} else if (specifier.type === \"ImportDefaultSpecifier\") {\n\t\t\t\t\t\tbuilders.set(specifier.local.name, { local: specifier.local.name, node });\n\t\t\t\t\t} else if (specifier.importKind !== \"type\") {\n\t\t\t\t\t\tconst imported =\n\t\t\t\t\t\t\tspecifier.imported.type === \"Identifier\" ? specifier.imported.name : String(specifier.imported.value);\n\n\t\t\t\t\t\tbuilders.set(imported, { local: specifier.local.name, node });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tImportExpression(node): void {\n\t\t\t\tif (isBuilder(staticString(node.source))) unknown = true;\n\t\t\t},\n\n\t\t\tCallExpression(node): void {\n\t\t\t\tif (node.callee.type === \"Identifier\" && node.callee.name === \"require\") {\n\t\t\t\t\tif (isBuilder(staticString(node.arguments[0]))) unknown = true;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t\"Program:exit\"(): void {\n\t\t\t\tconst [only] = builders.values();\n\n\t\t\t\tif (unknown || builders.size !== 1 || only === undefined) return;\n\n\t\t\t\tcontext.report({ node: only.node, messageId: \"singleBuilder\", data: { builder: only.local } });\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { Conventions } from \"../utils/conventions\";\nimport { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { projectPath, resolveImport } from \"../utils/sparta-paths\";\nimport type { Rule } from \"../utils/types\";\n\n/** Files inside the sparta folder, except its support folder (where `expect` itself is defined). */\nconst appliesTo = (filename: string, { patterns }: Conventions, root: string): boolean => {\n\tconst file = projectPath(filename, root);\n\n\treturn file !== undefined && patterns.sparta.test(file) && file.match(patterns.top)?.[1] !== \"support\";\n};\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription: \"Require `expect` to be imported from the support module (`@sparta/support`) inside sparta/.\",\n\t\t\turl: docsUrl(\"expect-from-support\"),\n\t\t},\n\t\tfixable: \"code\",\n\t\tschema: [],\n\t\tmessages: {\n\t\t\texpectFromSupport: \"Import expect from '{{module}}' instead of '{{source}}'.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst conventions = conventionsFor(context);\n\t\tconst { supportModule } = conventions;\n\t\tconst root = rootFor(context, conventions);\n\n\t\tif (!appliesTo(context.filename, conventions, root)) return {};\n\n\t\t/**\n\t\t * The support module, a subpath of it, or a relative import into the support folder. Other aliases for that\n\t\t * folder are reported, so the configured module name stays the one that is used.\n\t\t */\n\t\tconst isSupport = (source: string): boolean => {\n\t\t\tif (source === supportModule || source.startsWith(`${supportModule}/`)) return true;\n\t\t\tif (!source.startsWith(\".\")) return false;\n\n\t\t\tconst resolved = resolveImport(context.filename, source, root, conventions);\n\t\t\tconst file = resolved === undefined ? undefined : projectPath(resolved, root);\n\n\t\t\treturn file?.match(conventions.patterns.top)?.[1] === \"support\";\n\t\t};\n\n\t\treturn {\n\t\t\tImportDeclaration(node): void {\n\t\t\t\tconst source = node.source.value;\n\n\t\t\t\tif (isSupport(String(source))) return;\n\n\t\t\t\tconst specifier = node.specifiers.find(\n\t\t\t\t\titem =>\n\t\t\t\t\t\titem.type === \"ImportSpecifier\" && item.imported.type === \"Identifier\" && item.imported.name === \"expect\"\n\t\t\t\t);\n\n\t\t\t\tif (specifier === undefined) return;\n\n\t\t\t\tconst data = { source: String(source), module: supportModule };\n\n\t\t\t\tif (node.specifiers.length !== 1) {\n\t\t\t\t\tcontext.report({ node: specifier, messageId: \"expectFromSupport\", data });\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: specifier,\n\t\t\t\t\tmessageId: \"expectFromSupport\",\n\t\t\t\t\tdata,\n\n\t\t\t\t\tfix: fixer => fixer.replaceText(node.source, JSON.stringify(supportModule)),\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import path from \"node:path\";\n\nimport { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { isDeclarationFile, layerFolder, layerSuffix, moduleName } from \"../utils/sparta-paths\";\nimport type { Rule } from \"../utils/types\";\n\n/** Lowercase words of letters and digits, joined by single hyphens: `orders-v2-stepper`. */\nconst KEBAB_CASE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;\n\n/** `myOrders`, `My_APIOrders` and `checkout--flow` become `my-orders`, `my-api-orders` and `checkout-flow`. */\nconst toKebabCase = (name: string): string =>\n\tname\n\t\t.replace(/([A-Z]+)([A-Z][a-z])/g, \"$1-$2\")\n\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n\t\t.replace(/[^A-Za-z0-9]+/g, \"-\")\n\t\t.replace(/^-|-$/g, \"\")\n\t\t.toLowerCase();\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Require files in a layer folder to be kebab-case and end with the layer suffix (e.g. `orders-stepper.ts`).\",\n\t\t\turl: docsUrl(\"file-naming\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tsuffix: \"Files in '{{folder}}/' must be named '*-{{suffix}}.ts' (found '{{name}}').\",\n\t\t\tkebabCase: \"File name '{{name}}' must be kebab-case: '{{expected}}'.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst conventions = conventionsFor(context);\n\t\tconst folder = layerFolder(context.filename, conventions, rootFor(context, conventions));\n\t\tconst suffix = layerSuffix(folder);\n\t\tconst name = path.basename(context.filename);\n\t\tconst module = moduleName(context.filename);\n\n\t\t// `index.ts` is a barrel that re-exports the folder's own files, which architecture-boundaries allows.\n\t\t// Declaration files only describe types, so they are not layer files.\n\t\tif (folder === undefined || suffix === undefined || isDeclarationFile(name) || module === \"index\") return {};\n\n\t\tconst hasSuffix = module.endsWith(`-${suffix}`);\n\t\tconst isKebabCase = KEBAB_CASE.test(module);\n\n\t\tif (hasSuffix && isKebabCase) return {};\n\n\t\treturn {\n\t\t\tProgram(node): void {\n\t\t\t\tif (!hasSuffix) {\n\t\t\t\t\tcontext.report({ node, messageId: \"suffix\", data: { folder: folder.name, suffix, name } });\n\t\t\t\t}\n\n\t\t\t\tif (!isKebabCase) {\n\t\t\t\t\tconst expected = `${toKebabCase(module)}${name.slice(module.length)}`;\n\n\t\t\t\t\tcontext.report({ node, messageId: \"kebabCase\", data: { name, expected } });\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { type ClassMember, isMethod, isPlainProperty, type Method } from \"../utils/class-members\";\nimport { docsUrl } from \"../utils/docs\";\nimport type { Rule } from \"../utils/types\";\n\nconst BLANK_LINE = /\\r?\\n[\\t ]*\\r?\\n/;\nconst BLANK_LINES = /(\\r?\\n)(?:[\\t ]*\\r?\\n)+/g;\n\n/** An overload signature (or abstract method): a method without a body. */\nconst isSignature = (member: ClassMember): member is Method => isMethod(member) && member.value.body === null;\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"layout\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Require a blank line after every multi-line method-like class member, and disallow blank lines between method overloads.\",\n\t\t\turl: docsUrl(\"lines-between-class-members\"),\n\t\t},\n\t\tfixable: \"whitespace\",\n\t\tschema: [],\n\t\tmessages: {\n\t\t\texpectedBlankLine: \"Expected a blank line between class members.\",\n\t\t\tunexpectedBlankLine: \"Unexpected blank line between overloads of the same method.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst { sourceCode } = context;\n\t\tconst { text } = sourceCode;\n\n\t\tconst keyOf = (method: Method): string =>\n\t\t\t`${method.static ? \"static \" : \"\"}${method.computed ? \"[]\" : \"\"}${sourceCode.getText(method.key)}`;\n\n\t\t/** `current` continues the overload group that `previous` (a bodyless signature) belongs to. */\n\t\tconst isOverloadOf = (previous: ClassMember, current: ClassMember): boolean =>\n\t\t\tisSignature(previous) &&\n\t\t\tisMethod(current) &&\n\t\t\tcurrent.kind === previous.kind &&\n\t\t\tkeyOf(current) === keyOf(previous);\n\n\t\treturn {\n\t\t\tClassBody(node): void {\n\t\t\t\tfor (let index = 1; index < node.body.length; index++) {\n\t\t\t\t\tconst previous = node.body[index - 1];\n\t\t\t\t\tconst current = node.body[index];\n\t\t\t\t\tconst textBetween = text.slice(previous.range[1], current.range[0]);\n\n\t\t\t\t\tif (isOverloadOf(previous, current)) {\n\t\t\t\t\t\tif (!BLANK_LINE.test(textBetween)) continue;\n\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode: current,\n\t\t\t\t\t\t\tmessageId: \"unexpectedBlankLine\",\n\t\t\t\t\t\t\tfix: fixer =>\n\t\t\t\t\t\t\t\tfixer.replaceTextRange([previous.range[1], current.range[0]], textBetween.replace(BLANK_LINES, \"$1\")),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (previous.loc.start.line === previous.loc.end.line) continue;\n\t\t\t\t\tif (isPlainProperty(previous)) continue;\n\t\t\t\t\tif (BLANK_LINE.test(textBetween)) continue;\n\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: current,\n\t\t\t\t\t\tmessageId: \"expectedBlankLine\",\n\n\t\t\t\t\t\tfix: fixer => {\n\t\t\t\t\t\t\tconst lineBreak = textBetween.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n\t\t\t\t\t\t\tconst replacement = textBetween.includes(lineBreak)\n\t\t\t\t\t\t\t\t? textBetween.replace(lineBreak, `${lineBreak}${lineBreak}`)\n\t\t\t\t\t\t\t\t: `${lineBreak}${lineBreak}${textBetween}`;\n\n\t\t\t\t\t\t\treturn fixer.replaceTextRange([previous.range[1], current.range[0]], replacement);\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { type ClassMember, isMethod, isPlainProperty, isPrivate, memberName } from \"../utils/class-members\";\nimport { docsUrl } from \"../utils/docs\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\ntype Kind = \"property\" | \"constructor\" | \"method\";\ntype Access = \"public\" | \"protected\" | \"private\";\n\nconst KINDS: readonly Kind[] = [\"property\", \"constructor\", \"method\"];\nconst ACCESSES: readonly Access[] = [\"public\", \"protected\", \"private\"];\n\ninterface Group {\n\trank: number;\n\tlabel: string;\n}\n\n/** Properties (incl. index signatures) and methods; a property holding a function or class counts as a method. */\nconst kindOf = (member: ClassMember): Kind | undefined => {\n\tif (isMethod(member)) return member.kind === \"constructor\" ? \"constructor\" : \"method\";\n\tif (member.type === \"StaticBlock\") return undefined;\n\n\treturn isPlainProperty(member) ? \"property\" : \"method\";\n};\n\nconst accessOf = (member: ClassMember): Access => {\n\tif (isPrivate(member)) return \"private\";\n\tif (\"accessibility\" in member && member.accessibility === \"protected\") return \"protected\";\n\n\treturn \"public\";\n};\n\n/**\n * The required order: static properties, instance properties, constructor, static methods, instance methods,\n * each from public to protected to private.\n */\nconst groupOf = (member: ClassMember): Group | undefined => {\n\tconst kind = kindOf(member);\n\n\tif (kind === undefined) return undefined;\n\tif (kind === \"constructor\") return { rank: KINDS.indexOf(kind) * 6, label: \"constructor\" };\n\n\tconst isStatic = \"static\" in member && member.static;\n\tconst access = accessOf(member);\n\n\treturn {\n\t\trank: KINDS.indexOf(kind) * 6 + (isStatic ? 0 : 3) + ACCESSES.indexOf(access),\n\t\tlabel: `${isStatic ? \"static \" : \"\"}${access} ${kind}`,\n\t};\n};\n\nconst SKIPPED_KEYS = new Set([\"parent\", \"loc\", \"range\", \"start\", \"end\", \"typeAnnotation\"]);\n\nconst isNode = (value: unknown): value is AstNode =>\n\ttypeof value === \"object\" && value !== null && typeof (value as { type?: unknown }).type === \"string\";\n\nconst FUNCTIONS = new Set([\"ArrowFunctionExpression\", \"FunctionExpression\", \"ClassExpression\"]);\n\n/** `x` for `this.x`, `this.#x` and `ClassName.x`. */\nconst ownPropertyRead = (node: AstNode, className: string | undefined): string | undefined => {\n\tif (node.type !== \"MemberExpression\" || node.computed) return undefined;\n\n\tconst { object, property } = node;\n\tconst isOwn =\n\t\tobject.type === \"ThisExpression\" ||\n\t\t(className !== undefined && object.type === \"Identifier\" && object.name === className);\n\n\treturn isOwn && (property.type === \"Identifier\" || property.type === \"PrivateIdentifier\") ? property.name : undefined;\n};\n\n/**\n * The property names an initializer reads while it runs, as `this.x`, `this.#x` or `ClassName.x`. Code inside\n * functions is left out: it runs later, when every property is initialized.\n */\nfunction readsDuringInit(value: AstNode, className: string | undefined): Set<string> {\n\tconst names = new Set<string>();\n\n\tconst visit = (node: AstNode): void => {\n\t\tif (FUNCTIONS.has(node.type)) return;\n\n\t\tconst read = ownPropertyRead(node, className);\n\n\t\tif (read !== undefined) names.add(read);\n\n\t\tfor (const [key, child] of Object.entries(node)) {\n\t\t\tif (SKIPPED_KEYS.has(key)) continue;\n\n\t\t\tif (Array.isArray(child)) {\n\t\t\t\tfor (const item of child) if (isNode(item)) visit(item);\n\t\t\t} else if (isNode(child)) {\n\t\t\t\tvisit(child);\n\t\t\t}\n\t\t}\n\t};\n\n\tvisit(value);\n\n\treturn names;\n}\n\n/**\n * Initializers run in source order, so a property that reads a property declared before it must stay below it,\n * even when the order of the groups says otherwise.\n */\nconst dependsOnEarlier = (\n\tmember: ClassMember,\n\tearlier: ReadonlySet<string>,\n\tclassName: string | undefined\n): boolean => {\n\tif (member.type !== \"PropertyDefinition\" && member.type !== \"AccessorProperty\") return false;\n\tif (!member.value) return false;\n\n\treturn [...readsDuringInit(member.value, className)].some(name => earlier.has(name));\n};\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Require class members in a fixed order: properties, constructor, methods; static before instance; public before protected before private.\",\n\t\t\turl: docsUrl(\"member-ordering\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tmemberOrdering: \"'{{name}}' ({{group}}) must come before '{{otherName}}' ({{otherGroup}}).\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\treturn {\n\t\t\tClassBody(node): void {\n\t\t\t\tlet highest: { member: ClassMember; group: Group } | undefined;\n\t\t\t\tconst { parent } = node;\n\t\t\t\tconst className =\n\t\t\t\t\t(parent.type === \"ClassDeclaration\" || parent.type === \"ClassExpression\") && parent.id\n\t\t\t\t\t\t? parent.id.name\n\t\t\t\t\t\t: undefined;\n\t\t\t\t/** Names of the properties declared so far. */\n\t\t\t\tconst earlier = new Set<string>();\n\n\t\t\t\tfor (const member of node.body) {\n\t\t\t\t\tconst group = groupOf(member);\n\t\t\t\t\tconst dependent = dependsOnEarlier(member, earlier, className);\n\n\t\t\t\t\tif (isPlainProperty(member) && member.type !== \"TSIndexSignature\") earlier.add(memberName(member));\n\t\t\t\t\tif (group === undefined) continue;\n\n\t\t\t\t\tif (highest === undefined || group.rank >= highest.group.rank) {\n\t\t\t\t\t\thighest = { member, group };\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (dependent) continue;\n\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: member,\n\t\t\t\t\t\tmessageId: \"memberOrdering\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: memberName(member),\n\t\t\t\t\t\t\tgroup: group.label,\n\t\t\t\t\t\t\totherName: memberName(highest.member),\n\t\t\t\t\t\t\totherGroup: highest.group.label,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { classify, layerFolder, layerSuffix, resolveImport } from \"../utils/sparta-paths\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\n/** Names of SPARTA layer classes, for classes whose import does not tell their layer. */\nconst LAYER_CLASS =\n\t/(Stepper|Asserter|Scenario|Service|Client|Repository|Page|Screen|Window|Component|Builder|Director|Factory|Provider|Container|Database)$/;\n\n/** The class a `new` expression constructs: `X` for `new X()`, `ns` and `X` for `new ns.X()`. */\nconst constructed = (callee: AstNode): { binding: string; name: string } | undefined => {\n\tif (callee.type === \"Identifier\") return { binding: callee.name, name: callee.name };\n\n\tif (\n\t\tcallee.type === \"MemberExpression\" &&\n\t\t!callee.computed &&\n\t\tcallee.object.type === \"Identifier\" &&\n\t\tcallee.property.type === \"Identifier\"\n\t) {\n\t\treturn { binding: callee.object.name, name: callee.property.name };\n\t}\n\n\treturn undefined;\n};\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription: \"Disallow constructing SPARTA layer classes in tests; use the fixtures instead.\",\n\t\t\turl: docsUrl(\"no-direct-construction-in-tests\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tuseFixture: \"Do not construct '{{name}}' in a test; use it via the SPARTA fixtures.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst conventions = conventionsFor(context);\n\t\tconst root = rootFor(context, conventions);\n\n\t\tif (classify(context.filename, conventions, root)?.kind !== \"test\") return {};\n\n\t\t/** Local names of imports (named, default and namespace) to their module. */\n\t\tconst imports = new Map<string, string>();\n\n\t\t/**\n\t\t * Whether constructing `name` (bound to the local `binding`) creates a SPARTA layer object. An import decides by\n\t\t * where it points: never for packages, always for layer folders. Otherwise the class name decides.\n\t\t */\n\t\tconst isLayerClass = (binding: string, name: string): boolean => {\n\t\t\tconst source = imports.get(binding);\n\n\t\t\tif (source === undefined) return LAYER_CLASS.test(name);\n\n\t\t\tconst resolved = resolveImport(context.filename, source, root, conventions);\n\n\t\t\tif (resolved === undefined) return false;\n\n\t\t\tconst target = classify(resolved, conventions, root);\n\n\t\t\treturn (\n\t\t\t\ttarget?.layer !== undefined ||\n\t\t\t\ttarget?.kind === \"top-scenario\" ||\n\t\t\t\tlayerSuffix(layerFolder(resolved, conventions, root)) !== undefined ||\n\t\t\t\tLAYER_CLASS.test(name)\n\t\t\t);\n\t\t};\n\n\t\treturn {\n\t\t\tImportDeclaration(node): void {\n\t\t\t\tif (typeof node.source.value !== \"string\") return;\n\n\t\t\t\tfor (const specifier of node.specifiers) imports.set(specifier.local.name, node.source.value);\n\t\t\t},\n\n\t\t\tNewExpression(node): void {\n\t\t\t\tconst found = constructed(node.callee);\n\n\t\t\t\tif (found && isLayerClass(found.binding, found.name)) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: \"useFixture\",\n\t\t\t\t\t\tdata: { name: context.sourceCode.getText(node.callee) },\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { classify } from \"../utils/sparta-paths\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\n/**\n * Names of `expect` and its extensions: `expect`, `expectly`, `expectlyLocator`, `expectApi`, `expect_soft`.\n * `expected`, `expecting` and the like are left alone. `settings.sparta.expectNames` adds exact names.\n */\nconst EXPECT_NAME = /^expect(?:ly)?(?:[A-Z_$\\d]|$)/;\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription: \"Disallow `expect` in test files; checks belong in steppers and asserters.\",\n\t\t\turl: docsUrl(\"no-expect-in-tests\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tnoExpect:\n\t\t\t\t\"Do not use expect in a test file. Put checkpoints in a stepper and technical or functional checks in an asserter.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst conventions = conventionsFor(context);\n\n\t\tif (classify(context.filename, conventions, rootFor(context, conventions))?.kind !== \"test\") return {};\n\n\t\tconst isExpectName = (name: string): boolean => EXPECT_NAME.test(name) || conventions.expectNames.has(name);\n\n\t\t/** Local names bound to an expect through a renamed import, such as `import { expect as check }`. */\n\t\tconst aliases = new Set<string>();\n\n\t\tconst isExpect = (node: AstNode): boolean =>\n\t\t\tnode.type === \"Identifier\" && (isExpectName(node.name) || aliases.has(node.name));\n\n\t\treturn {\n\t\t\tImportSpecifier(node): void {\n\t\t\t\tconst { imported, local } = node;\n\t\t\t\tconst importedName = imported.type === \"Identifier\" ? imported.name : String(imported.value);\n\n\t\t\t\tif (!isExpectName(importedName) && !isExpectName(local.name)) return;\n\n\t\t\t\taliases.add(local.name);\n\t\t\t\tcontext.report({ node, messageId: \"noExpect\" });\n\t\t\t},\n\n\t\t\tCallExpression(node): void {\n\t\t\t\tlet callee: AstNode = node.callee;\n\n\t\t\t\t// `expect.soft(...)`, `expect.poll(...)`, `expectly.locator.x(...)`: check the root of the member chain.\n\t\t\t\twhile (callee.type === \"MemberExpression\") callee = callee.object;\n\n\t\t\t\tif (isExpect(callee)) context.report({ node: node.callee, messageId: \"noExpect\" });\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { isIdentifier, staticString, stringValue } from \"../utils/ast\";\nimport { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { projectPath } from \"../utils/sparta-paths\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\nconst TIMER_MODULES = new Set([\"timers/promises\", \"node:timers/promises\"]);\n\nconst isSetTimeout = (callee: AstNode): boolean =>\n\tisIdentifier(callee, \"setTimeout\") ||\n\t(callee.type === \"MemberExpression\" &&\n\t\t(isIdentifier(callee.object, \"globalThis\") || isIdentifier(callee.object, \"window\")) &&\n\t\tisIdentifier(callee.property, \"setTimeout\"));\n\n/** The `resolve` parameter of the nearest enclosing `new Promise(resolve => ...)` executor. */\nconst promiseResolveName = (node: AstNode): string | undefined => {\n\tfor (let current: AstNode | null = node.parent; current; current = current.parent) {\n\t\tif (current.type !== \"ArrowFunctionExpression\" && current.type !== \"FunctionExpression\") continue;\n\n\t\tconst { parent } = current;\n\n\t\tif (parent.type === \"NewExpression\" && isIdentifier(parent.callee, \"Promise\") && parent.arguments[0] === current) {\n\t\t\tconst [resolve] = current.params;\n\n\t\t\treturn resolve?.type === \"Identifier\" ? resolve.name : undefined;\n\t\t}\n\t}\n\n\treturn undefined;\n};\n\n/** True when the timer callback only resolves the promise, i.e. the timer is a plain sleep. */\nconst resolvesPromise = (callback: AstNode | undefined, resolve: string): boolean => {\n\tif (!callback) return false;\n\tif (isIdentifier(callback, resolve)) return true;\n\tif (callback.type !== \"ArrowFunctionExpression\" && callback.type !== \"FunctionExpression\") return false;\n\n\tconst { body } = callback;\n\n\tif (!body) return false;\n\n\tconst call =\n\t\tbody.type === \"CallExpression\"\n\t\t\t? body\n\t\t\t: body.type === \"BlockStatement\" && body.body.length === 1 && body.body[0].type === \"ExpressionStatement\"\n\t\t\t\t? body.body[0].expression\n\t\t\t\t: undefined;\n\n\treturn call?.type === \"CallExpression\" && isIdentifier(call.callee, resolve);\n};\n\n/** The name of an import specifier or object pattern key (`setTimeout`, `\"setTimeout\"`). */\nconst propertyName = (node: AstNode): string | undefined =>\n\tnode.type === \"Identifier\" ? node.name : stringValue(node);\n\n/** `require(\"timers/promises\")` or `require(\"node:timers/promises\")`. */\nconst isTimersRequire = (node: AstNode | null | undefined): boolean => {\n\tif (node?.type !== \"CallExpression\" || !isIdentifier(node.callee, \"require\")) return false;\n\n\tconst source = staticString(node.arguments[0]);\n\n\treturn source !== undefined && TIMER_MODULES.has(source);\n};\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription: \"Disallow fixed-time waits such as `waitForTimeout` and `setTimeout` sleeps.\",\n\t\t\turl: docsUrl(\"no-hard-waits\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\thardWait:\n\t\t\t\t\"Do not wait a fixed amount of time; wait for a state with web-first assertions or polling in a stepper or asserter.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst conventions = conventionsFor(context);\n\t\tconst { patterns } = conventions;\n\t\tconst file = projectPath(context.filename, rootFor(context, conventions));\n\n\t\tif (file === undefined || !patterns.checked.test(file) || patterns.framework.test(file)) return {};\n\n\t\t/** Local names bound to the `timers/promises` module (`timers`) and to its `scheduler` (`schedulers`). */\n\t\tconst timers = new Set<string>();\n\t\tconst schedulers = new Set<string>();\n\n\t\t/** Records a named binding from `timers/promises`; `setTimeout` itself is reported where it is bound. */\n\t\tconst bindNamed = (imported: string, local: AstNode | undefined, node: AstNode): void => {\n\t\t\tif (imported === \"setTimeout\") context.report({ node, messageId: \"hardWait\" });\n\t\t\tif (imported === \"scheduler\" && local?.type === \"Identifier\") schedulers.add(local.name);\n\t\t};\n\n\t\t/** `timers.setTimeout(...)`, `scheduler.wait(...)` and `timers.scheduler.wait(...)`. */\n\t\tconst isTimersSleep = (callee: AstNode): boolean => {\n\t\t\tif (callee.type !== \"MemberExpression\") return false;\n\n\t\t\tconst { object, property } = callee;\n\n\t\t\tif (isIdentifier(property, \"setTimeout\")) return object.type === \"Identifier\" && timers.has(object.name);\n\t\t\tif (!isIdentifier(property, \"wait\")) return false;\n\t\t\tif (object.type === \"Identifier\") return schedulers.has(object.name);\n\n\t\t\treturn (\n\t\t\t\tobject.type === \"MemberExpression\" &&\n\t\t\t\tobject.object.type === \"Identifier\" &&\n\t\t\t\ttimers.has(object.object.name) &&\n\t\t\t\tisIdentifier(object.property, \"scheduler\")\n\t\t\t);\n\t\t};\n\n\t\treturn {\n\t\t\tImportDeclaration(node): void {\n\t\t\t\tif (typeof node.source.value !== \"string\" || !TIMER_MODULES.has(node.source.value)) return;\n\n\t\t\t\tfor (const specifier of node.specifiers) {\n\t\t\t\t\tif (specifier.type === \"ImportSpecifier\") {\n\t\t\t\t\t\tbindNamed(propertyName(specifier.imported) ?? \"\", specifier.local, specifier);\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttimers.add(specifier.local.name);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tVariableDeclarator(node): void {\n\t\t\t\tif (!isTimersRequire(node.init)) return;\n\n\t\t\t\tif (node.id.type === \"Identifier\") {\n\t\t\t\t\ttimers.add(node.id.name);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.id.type !== \"ObjectPattern\") return;\n\n\t\t\t\tfor (const property of node.id.properties) {\n\t\t\t\t\tif (property.type !== \"Property\" || property.computed) continue;\n\n\t\t\t\t\tbindNamed(propertyName(property.key) ?? \"\", property.value, property);\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tCallExpression(node): void {\n\t\t\t\tconst { callee } = node;\n\n\t\t\t\tif (\n\t\t\t\t\t(callee.type === \"MemberExpression\" && isIdentifier(callee.property, \"waitForTimeout\")) ||\n\t\t\t\t\tisTimersSleep(callee)\n\t\t\t\t) {\n\t\t\t\t\tcontext.report({ node, messageId: \"hardWait\" });\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!isSetTimeout(callee)) return;\n\n\t\t\t\tconst resolve = promiseResolveName(node);\n\n\t\t\t\tif (resolve !== undefined && resolvesPromise(node.arguments[0], resolve)) {\n\t\t\t\t\tcontext.report({ node, messageId: \"hardWait\" });\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { CallExpression, Node } from \"oxc-parser\";\n\n/**\n * Retrying assertions are recognised by method name only, so `expect`, `expect.soft`, `expectly` and wrappers all\n * match. The names come from the conventions: `toPass`, `toPassAndReturn`, `poll`, `pollAndReturn`, plus\n * `settings.sparta.pollingMethods`.\n */\n\n/** Methods that take the callback they retry as their own first argument (`expect.poll(cb)`). */\nconst CALLBACK_ARGUMENT_METHODS = new Set([\"poll\", \"pollAndReturn\"]);\n\n/** Methods that retry the callback given to the start of their chain (`expect(cb).toPass()`). */\nconst CALLBACK_SUBJECT_METHODS = new Set([\"toPass\", \"toPassAndReturn\"]);\n\n/** The static name of a member access (`a.b`, `a[\"b\"]`), or `undefined` for computed or private access. */\nexport const memberName = (node: Node): string | undefined => {\n\tif (node.type !== \"MemberExpression\") return undefined;\n\n\tconst { property } = node;\n\n\tif (!node.computed && property.type === \"Identifier\") return property.name;\n\tif (node.computed && property.type === \"Literal\" && typeof property.value === \"string\") return property.value;\n\n\treturn undefined;\n};\n\n/** The polling method a call invokes (`toPass` for `expect(cb).toPass()`), or `undefined` for any other node. */\nexport const pollingMethod = (node: Node, methods: ReadonlySet<string>): string | undefined => {\n\tif (node.type !== \"CallExpression\") return undefined;\n\n\tconst name = memberName(node.callee);\n\n\treturn name !== undefined && methods.has(name) ? name : undefined;\n};\n\nconst isFunction = (node: Node | undefined): boolean =>\n\tnode?.type === \"ArrowFunctionExpression\" || node?.type === \"FunctionExpression\";\n\nconst firstArgument = (call: CallExpression): Node | undefined => {\n\tconst [argument] = call.arguments;\n\n\treturn argument?.type === \"SpreadElement\" ? undefined : argument;\n};\n\n/** `X(cb).method()`: the first argument of the call the chain starts from, also through `.soft(cb)` and `.not`. */\nconst subjectCallback = (call: CallExpression): Node | undefined => {\n\tif (call.callee.type !== \"MemberExpression\") return undefined;\n\n\tlet object: Node = call.callee.object;\n\n\twhile (object.type === \"MemberExpression\") object = object.object;\n\n\treturn object.type === \"CallExpression\" ? firstArgument(object) : undefined;\n};\n\n/**\n * The callback that a polling call retries:\n * - `X.poll(cb)` and `X.pollAndReturn(cb)`: the first argument.\n * - `X(cb).toPass()` and `X(cb).toPassAndReturn()`: the first argument of the call the chain starts from,\n * also through `.soft(cb)` and `.not`.\n * - other configured methods: the first argument when it is a function, otherwise the start of the chain.\n */\nexport const pollCallback = (call: CallExpression, methods: ReadonlySet<string>): Node | undefined => {\n\tconst method = pollingMethod(call, methods);\n\n\tif (method === undefined || call.callee.type !== \"MemberExpression\") return undefined;\n\tif (CALLBACK_ARGUMENT_METHODS.has(method)) return firstArgument(call);\n\tif (CALLBACK_SUBJECT_METHODS.has(method)) return subjectCallback(call);\n\n\tconst argument = firstArgument(call);\n\n\treturn isFunction(argument) ? argument : subjectCallback(call);\n};\n","import { readFileSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { parseSync } from \"oxc-parser\";\nimport type {\n\tArrowFunctionExpression,\n\tCallExpression,\n\tClass,\n\tFunction as FunctionNode,\n\tMethodDefinition,\n\tNode,\n\tProgram,\n\tPropertyDefinition,\n\tTSTypeAnnotation,\n} from \"oxc-parser\";\n\nimport type { Conventions } from \"./conventions\";\nimport { memberName, pollingMethod } from \"./polling\";\nimport { moduleFile, resolveImport } from \"./sparta-paths\";\n\n/**\n * Follows calls across files without type information, using the conventions SPARTA projects follow:\n * dependencies are typed constructor parameter properties, typed fields or fields created with `new`,\n * and every type comes from a named import (relative or an alias such as `@sparta/*`). Classes are always\n * resolved through the import they came from, never by name, because class names repeat across folders.\n * Anything that cannot be resolved this way is ignored.\n */\n\ntype FunctionLike = FunctionNode | ArrowFunctionExpression;\n\ninterface ImportRef {\n\t/** Resolved file, or `undefined` for package imports, which are never followed. */\n\tmodule: string | undefined;\n\timported: string;\n}\n\ninterface ClassInfo {\n\tname: string;\n\tnode: Class;\n\t/** Local name of the base class in this file. */\n\tsuperClass?: string;\n\tmethods: Map<string, FunctionLike>;\n\t/** Field name to the local name of its type in this file. */\n\tfields: Map<string, string>;\n}\n\nexport interface FileSummary {\n\tfile: string;\n\t/** Project root the aliases resolve against. */\n\troot: string;\n\tconventions: Conventions;\n\timports: Map<string, ImportRef>;\n\tclasses: Map<string, ClassInfo>;\n\tfunctions: Map<string, FunctionLike>;\n\t/** Exported name to local name, for `export class X`, `export { X as Y }` and `export default`. */\n\texports: Map<string, string>;\n\treexports: Map<string, ImportRef>;\n\tstarExports: string[];\n}\n\nexport interface ClassRef {\n\tfile: string;\n\tinfo: ClassInfo;\n}\n\nexport type Target =\n\t| { kind: \"method\"; file: string; cls: ClassRef; name: string; fn: FunctionLike }\n\t| { kind: \"function\"; file: string; name: string; fn: FunctionLike };\n\nexport interface Scope {\n\tfile: string;\n\tcls?: ClassRef;\n\t/** Local variable name to the local name of its type, from `const x = new X()` or `const x: X = ...`. */\n\tlocals: Map<string, string>;\n}\n\n/** A call inside a poll callback that polls: either a polling call itself, or a call that leads to one. */\nexport type Hit = { node: CallExpression; method: string } | { node: CallExpression; path: string[] };\n\nconst MAX_DEPTH = 10;\n\nconst SKIPPED_KEYS = new Set([\"parent\", \"loc\", \"range\", \"start\", \"end\", \"typeAnnotation\", \"returnType\", \"decorators\"]);\n\nconst isNode = (value: unknown): value is Node =>\n\ttypeof value === \"object\" && value !== null && typeof (value as { type?: unknown }).type === \"string\";\n\n/** Visits `node` and its descendants depth-first. Returning `false` from `visit` skips the node's children. */\nexport function walk(node: Node, visit: (node: Node) => boolean | void): void {\n\tif (visit(node) === false) return;\n\n\tfor (const [key, value] of Object.entries(node)) {\n\t\tif (SKIPPED_KEYS.has(key)) continue;\n\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (const item of value) if (isNode(item)) walk(item, visit);\n\t\t} else if (isNode(value)) {\n\t\t\twalk(value, visit);\n\t\t}\n\t}\n}\n\nconst isFunctionLike = (node: Node | null | undefined): node is FunctionLike =>\n\tnode?.type === \"ArrowFunctionExpression\" ||\n\tnode?.type === \"FunctionExpression\" ||\n\tnode?.type === \"FunctionDeclaration\";\n\n/** `X` for a `: X` or `: X<T>` annotation. */\nconst typeName = (annotation: TSTypeAnnotation | null | undefined): string | undefined => {\n\tconst type = annotation?.typeAnnotation;\n\n\treturn type?.type === \"TSTypeReference\" && type.typeName.type === \"Identifier\" ? type.typeName.name : undefined;\n};\n\n/** `X` for `new X(...)`. */\nconst newName = (node: Node | null | undefined): string | undefined =>\n\tnode?.type === \"NewExpression\" && node.callee.type === \"Identifier\" ? node.callee.name : undefined;\n\nconst keyName = (key: Node): string | undefined =>\n\tkey.type === \"Identifier\"\n\t\t? key.name\n\t\t: key.type === \"Literal\" && typeof key.value === \"string\"\n\t\t\t? key.value\n\t\t\t: undefined;\n\nfunction summarizeClass(name: string, node: Class): ClassInfo {\n\tconst info: ClassInfo = {\n\t\tname,\n\t\tnode,\n\t\tsuperClass: node.superClass?.type === \"Identifier\" ? node.superClass.name : undefined,\n\t\tmethods: new Map(),\n\t\tfields: new Map(),\n\t};\n\n\tfor (const member of node.body.body) {\n\t\tif (member.type === \"PropertyDefinition\") summarizeField(info, member);\n\t\tif (member.type === \"MethodDefinition\") summarizeMethod(info, member);\n\t}\n\n\treturn info;\n}\n\n/** A typed field (`x: X`), a field created with `new X()`, or a function-valued field, which acts as a method. */\nfunction summarizeField(info: ClassInfo, member: PropertyDefinition): void {\n\tconst field = member.computed ? undefined : keyName(member.key);\n\n\tif (field === undefined) return;\n\n\tif (isFunctionLike(member.value)) {\n\t\tinfo.methods.set(field, member.value);\n\n\t\treturn;\n\t}\n\n\tconst type = typeName(member.typeAnnotation) ?? newName(member.value);\n\n\tif (type !== undefined) info.fields.set(field, type);\n}\n\n/** Methods, getters (whose return type acts as a field type) and the constructor. */\nfunction summarizeMethod(info: ClassInfo, member: MethodDefinition): void {\n\tconst name = member.computed ? undefined : keyName(member.key);\n\tconst { value } = member;\n\n\tif (name === undefined || value.type !== \"FunctionExpression\" || !value.body) return;\n\n\tif (member.kind === \"constructor\") {\n\t\tsummarizeConstructor(info, value);\n\t} else if (member.kind === \"get\") {\n\t\tconst type = typeName(value.returnType);\n\n\t\tif (type !== undefined) info.fields.set(name, type);\n\t} else if (member.kind === \"method\") {\n\t\tinfo.methods.set(name, value);\n\t}\n}\n\n/** Fields from constructor parameter properties and from `this.x = new X()` assignments. */\nfunction summarizeConstructor(info: ClassInfo, constructor: FunctionNode): void {\n\tfor (const param of constructor.params) {\n\t\tif (param.type !== \"TSParameterProperty\") continue;\n\n\t\tconst binding = param.parameter.type === \"AssignmentPattern\" ? param.parameter.left : param.parameter;\n\t\tconst type = binding.type === \"Identifier\" ? typeName(binding.typeAnnotation) : undefined;\n\n\t\tif (binding.type === \"Identifier\" && type !== undefined) info.fields.set(binding.name, type);\n\t}\n\n\tif (!constructor.body) return;\n\n\twalk(constructor.body, node => {\n\t\tif (node.type !== \"AssignmentExpression\" || node.left.type !== \"MemberExpression\") return;\n\t\tif (node.left.object.type !== \"ThisExpression\") return;\n\n\t\tconst field = memberName(node.left);\n\t\tconst type = newName(node.right);\n\n\t\tif (field !== undefined && type !== undefined && !info.fields.has(field)) info.fields.set(field, type);\n\t});\n}\n\nconst importedName = (node: Node): string =>\n\tnode.type === \"Identifier\" ? node.name : node.type === \"Literal\" ? String(node.value) : \"\";\n\nfunction summarizeDeclaration(summary: FileSummary, node: Node, exported: string | undefined): void {\n\tif ((node.type === \"ClassDeclaration\" || node.type === \"ClassExpression\") && node.id) {\n\t\tsummary.classes.set(node.id.name, summarizeClass(node.id.name, node));\n\t\tif (exported !== undefined) summary.exports.set(exported === \"\" ? node.id.name : exported, node.id.name);\n\t} else if (node.type === \"FunctionDeclaration\" && node.id) {\n\t\tsummary.functions.set(node.id.name, node);\n\t\tif (exported !== undefined) summary.exports.set(exported === \"\" ? node.id.name : exported, node.id.name);\n\t} else if (node.type === \"VariableDeclaration\") {\n\t\tfor (const declarator of node.declarations) {\n\t\t\tif (declarator.id.type !== \"Identifier\" || !isFunctionLike(declarator.init)) continue;\n\n\t\t\tsummary.functions.set(declarator.id.name, declarator.init);\n\t\t\tif (exported !== undefined) summary.exports.set(declarator.id.name, declarator.id.name);\n\t\t}\n\t}\n}\n\n/** Collects the imports, exports, classes and functions of a module. */\nexport function summarize(file: string, program: Program, root: string, conventions: Conventions): FileSummary {\n\tconst summary: FileSummary = {\n\t\tfile,\n\t\troot,\n\t\tconventions,\n\t\timports: new Map(),\n\t\tclasses: new Map(),\n\t\tfunctions: new Map(),\n\t\texports: new Map(),\n\t\treexports: new Map(),\n\t\tstarExports: [],\n\t};\n\tfor (const statement of program.body) {\n\t\tif (statement.type === \"ImportDeclaration\") {\n\t\t\tsummarizeImport(summary, statement);\n\t\t} else if (statement.type === \"ExportNamedDeclaration\") {\n\t\t\tsummarizeNamedExport(summary, statement);\n\t\t} else if (statement.type === \"ExportDefaultDeclaration\") {\n\t\t\tconst { declaration } = statement;\n\n\t\t\tif (declaration.type === \"Identifier\") summary.exports.set(\"default\", declaration.name);\n\t\t\telse summarizeDeclaration(summary, declaration, \"default\");\n\t\t} else if (statement.type === \"ExportAllDeclaration\") {\n\t\t\tconst module = resolveModule(file, statement.source.value, root, conventions);\n\n\t\t\tif (!statement.exported && module !== undefined) summary.starExports.push(module);\n\t\t} else {\n\t\t\tsummarizeDeclaration(summary, statement, undefined);\n\t\t}\n\t}\n\n\treturn summary;\n}\n\ntype Statement = Program[\"body\"][number];\n\nfunction summarizeImport(summary: FileSummary, statement: Extract<Statement, { type: \"ImportDeclaration\" }>): void {\n\tconst module = resolveModule(summary.file, statement.source.value, summary.root, summary.conventions);\n\n\tfor (const specifier of statement.specifiers) {\n\t\tif (specifier.type === \"ImportSpecifier\") {\n\t\t\tsummary.imports.set(specifier.local.name, { module, imported: importedName(specifier.imported) });\n\t\t} else if (specifier.type === \"ImportDefaultSpecifier\") {\n\t\t\tsummary.imports.set(specifier.local.name, { module, imported: \"default\" });\n\t\t}\n\t}\n}\n\n/** `export class X`, `export { X as Y }` and `export { X } from \"...\"`. */\nfunction summarizeNamedExport(\n\tsummary: FileSummary,\n\tstatement: Extract<Statement, { type: \"ExportNamedDeclaration\" }>\n): void {\n\tif (statement.declaration) {\n\t\tsummarizeDeclaration(summary, statement.declaration, \"\");\n\n\t\treturn;\n\t}\n\n\tconst module = statement.source\n\t\t? resolveModule(summary.file, statement.source.value, summary.root, summary.conventions)\n\t\t: undefined;\n\n\tfor (const specifier of statement.specifiers) {\n\t\tconst exported = importedName(specifier.exported);\n\t\tconst local = importedName(specifier.local);\n\n\t\tif (statement.source) summary.reexports.set(exported, { module, imported: local });\n\t\telse summary.exports.set(exported, local);\n\t}\n}\n\n/** Resolves a relative, aliased or tsconfig-mapped import to a TypeScript file. Package imports resolve to `undefined`. */\nexport function resolveModule(\n\tfromFile: string,\n\trequest: string,\n\troot: string,\n\tconventions: Conventions\n): string | undefined {\n\tconst base = resolveImport(fromFile, request, root, conventions);\n\n\treturn base === undefined ? undefined : moduleFile(base);\n}\n\n/**\n * Summaries of files on disk per project root and conventions (imports resolve against them), kept for the lifetime of the\n * linter process and refreshed when a file changes.\n */\nconst diskCache = new Map<string, { mtimeMs: number; summary: FileSummary }>();\n\nfunction diskSummary(file: string, root: string, conventions: Conventions): FileSummary | undefined {\n\tconst stats = statSync(file, { throwIfNoEntry: false });\n\n\tif (!stats?.isFile()) return undefined;\n\n\tconst key = `${conventions.key}\\0${root}\\0${file}`;\n\tconst cached = diskCache.get(key);\n\n\tif (cached?.mtimeMs === stats.mtimeMs) return cached.summary;\n\n\tconst { program } = parseSync(file, readFileSync(file, \"utf8\"));\n\tconst summary = summarize(file, program, root, conventions);\n\n\tdiskCache.set(key, { mtimeMs: stats.mtimeMs, summary });\n\n\treturn summary;\n}\n\n/** Shows paths relative to the project root (`sparta/...`) instead of absolute ones. */\nconst display = (file: string, root: string): string =>\n\tfile.startsWith(`${root}/`) ? file.slice(root.length + 1) : path.basename(file);\n\n/**\n * Cross-file view for one linted file. The linted file uses the linter's in-memory AST (so unsaved\n * changes count); every other file is parsed from disk.\n */\nexport class ProjectIndex {\n\tprivate readonly memo = new Map<string, string[] | null>();\n\n\tprivate readonly inProgress = new Set<string>();\n\n\t/** Summaries looked up while linting this file, so every other file is checked on disk at most once. */\n\tprivate readonly summaries = new Map<string, FileSummary | undefined>();\n\n\t/**\n\t * Counts the lookups cut short by a call cycle or by `MAX_DEPTH`. A \"does not poll\" answer computed while this\n\t * changed is only true for that call chain, so it is not cached.\n\t */\n\tprivate truncations = 0;\n\n\tconstructor(readonly current: FileSummary) {}\n\n\t/** Finds the polling calls, and the calls that lead to polling, inside `root`. Stops descending at a polling call. */\n\tcollectHits(root: Node, scope: Scope, depth = 0, firstOnly = false): Hit[] {\n\t\tconst hits: Hit[] = [];\n\n\t\twalk(root, node => {\n\t\t\tif (firstOnly && hits.length > 0) return false;\n\t\t\tif (node.type !== \"CallExpression\") return;\n\n\t\t\tconst method = pollingMethod(node, this.current.conventions.pollingMethods);\n\n\t\t\tif (method !== undefined) {\n\t\t\t\thits.push({ node, method });\n\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst target = this.resolveCall(node, scope);\n\t\t\tconst path = target ? this.pollingPath(target, depth + 1) : undefined;\n\n\t\t\tif (path) hits.push({ node, path });\n\t\t});\n\n\t\treturn hits;\n\t}\n\n\t/** The chain from `target` to a polling call, e.g. `[\"Page.open\", \"Page.find\", \"poll (sparta/.../page.ts)\"]`. */\n\tpollingPath(target: Target, depth = 0): string[] | undefined {\n\t\tconst label = target.kind === \"method\" ? `${target.cls.info.name}.${target.name}` : target.name;\n\t\tconst key = `${target.file}#${label}`;\n\t\tconst known = this.memo.get(key);\n\n\t\tif (known !== undefined) return known ?? undefined;\n\t\tif (!target.fn.body) return undefined;\n\n\t\tif (depth > MAX_DEPTH || this.inProgress.has(key)) {\n\t\t\tthis.truncations++;\n\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst truncationsBefore = this.truncations;\n\n\t\tthis.inProgress.add(key);\n\n\t\tconst scope: Scope = {\n\t\t\tfile: target.file,\n\t\t\tcls: target.kind === \"method\" ? target.cls : undefined,\n\t\t\tlocals: collectLocals(target.fn),\n\t\t};\n\t\tconst [hit] = this.collectHits(target.fn.body, scope, depth, true);\n\n\t\tthis.inProgress.delete(key);\n\n\t\tconst result = hit\n\t\t\t? \"method\" in hit\n\t\t\t\t? [label, `${hit.method} (${display(target.file, this.current.root)})`]\n\t\t\t\t: [label, ...hit.path]\n\t\t\t: undefined;\n\n\t\tif (result !== undefined) this.memo.set(key, result);\n\t\telse if (this.truncations === truncationsBefore) this.memo.set(key, null);\n\n\t\treturn result;\n\t}\n\n\t/** Resolves a call such as `fn()`, `this.method()`, `this.field.method()` or `local.method()`. */\n\tresolveCall(call: CallExpression, scope: Scope): Target | undefined {\n\t\treturn this.resolveReference(call.callee, scope);\n\t}\n\n\t/** Resolves a reference to a function or method, such as `fn` or `this.page.method`. */\n\tresolveReference(node: Node, scope: Scope): Target | undefined {\n\t\tif (node.type === \"Identifier\") {\n\t\t\tconst found = this.resolveLocal(scope.file, node.name);\n\t\t\tconst fn = found ? this.summary(found.file)?.functions.get(found.local) : undefined;\n\n\t\t\treturn found && fn ? { kind: \"function\", file: found.file, name: found.local, fn } : undefined;\n\t\t}\n\n\t\tconst method = memberName(node);\n\n\t\tif (method === undefined || node.type !== \"MemberExpression\") return undefined;\n\n\t\tconst receiver = this.receiverClass(node.object, scope);\n\n\t\treturn receiver ? this.findMethod(receiver, method) : undefined;\n\t}\n\n\t/** Builds the scope for code in the linted file, inside `classNode` and the function `fn` (whose locals count). */\n\tscopeFor(classNode: Node | undefined, fn: Node | undefined): Scope {\n\t\tconst cls = [...this.current.classes.values()].find(info => info.node === classNode);\n\n\t\treturn {\n\t\t\tfile: this.current.file,\n\t\t\tcls: cls ? { file: this.current.file, info: cls } : undefined,\n\t\t\tlocals: isFunctionLike(fn) ? collectLocals(fn) : new Map(),\n\t\t};\n\t}\n\n\tprivate summary(file: string): FileSummary | undefined {\n\t\tif (file === this.current.file) return this.current;\n\t\tif (this.summaries.has(file)) return this.summaries.get(file);\n\n\t\tconst summary = diskSummary(file, this.current.root, this.current.conventions);\n\n\t\tthis.summaries.set(file, summary);\n\n\t\treturn summary;\n\t}\n\n\tprivate receiverClass(node: Node, scope: Scope, depth = 0): ClassRef | undefined {\n\t\tif (depth > MAX_DEPTH) return undefined;\n\n\t\tswitch (node.type) {\n\t\t\tcase \"ThisExpression\":\n\t\t\t\treturn scope.cls;\n\t\t\tcase \"Identifier\": {\n\t\t\t\tconst type = scope.locals.get(node.name);\n\n\t\t\t\t// Without a known local, the name may be a class itself, as in a static call (`Waiter.until()`).\n\t\t\t\treturn this.resolveClass(scope.file, type ?? node.name);\n\t\t\t}\n\t\t\tcase \"NewExpression\":\n\t\t\t\treturn node.callee.type === \"Identifier\" ? this.resolveClass(scope.file, node.callee.name) : undefined;\n\t\t\tcase \"TSNonNullExpression\":\n\t\t\tcase \"ParenthesizedExpression\":\n\t\t\t\treturn this.receiverClass(node.expression, scope, depth + 1);\n\t\t\tcase \"MemberExpression\": {\n\t\t\t\tconst field = memberName(node);\n\t\t\t\tconst owner = field === undefined ? undefined : this.receiverClass(node.object, scope, depth + 1);\n\n\t\t\t\treturn owner && field !== undefined ? this.fieldClass(owner, field) : undefined;\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tprivate fieldClass(cls: ClassRef, field: string, depth = 0): ClassRef | undefined {\n\t\tif (depth > MAX_DEPTH) return undefined;\n\n\t\tconst type = cls.info.fields.get(field);\n\n\t\tif (type !== undefined) return this.resolveClass(cls.file, type);\n\n\t\tconst parent = this.superClass(cls);\n\n\t\treturn parent ? this.fieldClass(parent, field, depth + 1) : undefined;\n\t}\n\n\tprivate findMethod(cls: ClassRef, name: string, depth = 0): Target | undefined {\n\t\tif (depth > MAX_DEPTH) return undefined;\n\n\t\tconst fn = cls.info.methods.get(name);\n\n\t\tif (fn) return { kind: \"method\", file: cls.file, cls, name, fn };\n\n\t\tconst parent = this.superClass(cls);\n\n\t\treturn parent ? this.findMethod(parent, name, depth + 1) : undefined;\n\t}\n\n\tprivate superClass(cls: ClassRef): ClassRef | undefined {\n\t\treturn cls.info.superClass === undefined ? undefined : this.resolveClass(cls.file, cls.info.superClass);\n\t}\n\n\tprivate resolveClass(file: string, localName: string): ClassRef | undefined {\n\t\tconst found = this.resolveLocal(file, localName);\n\t\tconst info = found ? this.summary(found.file)?.classes.get(found.local) : undefined;\n\n\t\treturn found && info ? { file: found.file, info } : undefined;\n\t}\n\n\t/** Finds where a name used in `file` is declared, following imports and re-exports. */\n\tprivate resolveLocal(file: string, localName: string, depth = 0): { file: string; local: string } | undefined {\n\t\tconst summary = this.summary(file);\n\n\t\tif (!summary || depth > MAX_DEPTH) return undefined;\n\t\tif (summary.classes.has(localName) || summary.functions.has(localName)) return { file, local: localName };\n\n\t\tconst imported = summary.imports.get(localName);\n\n\t\treturn imported?.module === undefined\n\t\t\t? undefined\n\t\t\t: this.resolveExport(imported.module, imported.imported, depth + 1);\n\t}\n\n\tprivate resolveExport(file: string, exported: string, depth: number): { file: string; local: string } | undefined {\n\t\tconst summary = this.summary(file);\n\n\t\tif (!summary || depth > MAX_DEPTH) return undefined;\n\n\t\tconst local = summary.exports.get(exported);\n\n\t\tif (local !== undefined) return this.resolveLocal(file, local, depth + 1);\n\n\t\tconst reexport = summary.reexports.get(exported);\n\n\t\tif (reexport) {\n\t\t\treturn reexport.module === undefined\n\t\t\t\t? undefined\n\t\t\t\t: this.resolveExport(reexport.module, reexport.imported, depth + 1);\n\t\t}\n\n\t\tfor (const module of summary.starExports) {\n\t\t\tconst found = this.resolveExport(module, exported, depth + 1);\n\n\t\t\tif (found) return found;\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n\n/** `x` and `X` for a parameter `x: X` or `x = new X()`. Parameter properties are fields, not locals. */\nfunction typedParameter(param: Node): [name: string, type: string] | undefined {\n\tconst binding = param.type === \"AssignmentPattern\" ? param.left : param;\n\n\tif (binding.type !== \"Identifier\") return undefined;\n\n\tconst type =\n\t\ttypeName(binding.typeAnnotation) ?? (param.type === \"AssignmentPattern\" ? newName(param.right) : undefined);\n\n\treturn type === undefined ? undefined : [binding.name, type];\n}\n\n/**\n * Locals whose class is known: typed parameters of `fn` and the functions inside it, `const x = new X()` and\n * `const x: X = ...`.\n */\nfunction collectLocals(fn: FunctionLike): Map<string, string> {\n\tconst locals = new Map<string, string>();\n\n\tconst addParameters = (node: FunctionLike): void => {\n\t\tfor (const param of node.params) {\n\t\t\tconst found = typedParameter(param);\n\n\t\t\tif (found) locals.set(...found);\n\t\t}\n\t};\n\n\taddParameters(fn);\n\n\tif (!fn.body) return locals;\n\n\twalk(fn.body, node => {\n\t\tif (isFunctionLike(node)) addParameters(node);\n\t\tif (node.type !== \"VariableDeclarator\" || node.id.type !== \"Identifier\") return;\n\n\t\tconst type = typeName(node.id.typeAnnotation) ?? newName(node.init);\n\n\t\tif (type !== undefined) locals.set(node.id.name, type);\n\t});\n\n\treturn locals;\n}\n","import type { CallExpression, Node, Program } from \"oxc-parser\";\n\nimport { docsUrl } from \"../utils/docs\";\nimport { pollCallback, pollingMethod } from \"../utils/polling\";\nimport { ProjectIndex, summarize } from \"../utils/project-index\";\nimport type { Hit, Scope } from \"../utils/project-index\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { normalize } from \"../utils/sparta-paths\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\ntype FunctionNode = Extract<\n\tAstNode,\n\t{ type: \"ArrowFunctionExpression\" | \"FunctionExpression\" | \"FunctionDeclaration\" }\n>;\n\nconst isFunction = (node: AstNode): node is FunctionNode =>\n\tnode.type === \"ArrowFunctionExpression\" || node.type === \"FunctionExpression\" || node.type === \"FunctionDeclaration\";\n\n/** The class around `node`, and the outermost function inside that class (the method), for resolving `this` and locals. */\nfunction enclosing(node: AstNode): { classNode?: AstNode; fn?: FunctionNode } {\n\tlet fn: FunctionNode | undefined;\n\n\tfor (let current: AstNode | null = node.parent; current; current = current.parent) {\n\t\tif (current.type === \"ClassDeclaration\" || current.type === \"ClassExpression\") return { classNode: current, fn };\n\t\tif (isFunction(current)) fn = current;\n\t}\n\n\treturn { fn };\n}\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Disallow polling (`toPass`, `poll`, ...) inside the callback of another poll, also through calls into other files.\",\n\t\t\turl: docsUrl(\"no-nested-polling\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tnested:\n\t\t\t\t\"'{{inner}}' polls inside the callback of '{{outer}}'. Nested polling multiplies the timeouts; poll once, at the outermost level.\",\n\t\t\tnestedCall:\n\t\t\t\t\"'{{call}}' polls inside the callback of '{{outer}}' (via {{path}}). Nested polling multiplies the timeouts; poll once, at the outermost level.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst { sourceCode } = context;\n\t\tconst conventions = conventionsFor(context);\n\t\tconst { pollingMethods } = conventions;\n\n\t\tif (![...pollingMethods].some(method => sourceCode.text.includes(method))) return {};\n\n\t\tlet index: ProjectIndex | undefined;\n\n\t\tconst getIndex = (): ProjectIndex =>\n\t\t\t(index ??= new ProjectIndex(\n\t\t\t\tsummarize(\n\t\t\t\t\tnormalize(context.filename),\n\t\t\t\t\tsourceCode.ast as unknown as Program,\n\t\t\t\t\trootFor(context, conventions),\n\t\t\t\t\tconventions\n\t\t\t\t)\n\t\t\t));\n\n\t\tconst report = (hit: Hit, outer: string): void => {\n\t\t\tconst node = hit.node as unknown as AstNode;\n\n\t\t\tif (\"method\" in hit) {\n\t\t\t\tcontext.report({ node, messageId: \"nested\", data: { inner: hit.method, outer } });\n\t\t\t} else {\n\t\t\t\tconst callee = sourceCode.getText(hit.node.callee as unknown as AstNode);\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: \"nestedCall\",\n\t\t\t\t\tdata: { call: `${callee}()`, outer, path: hit.path.join(\" → \") },\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tCallExpression(node): void {\n\t\t\t\tconst call = node as unknown as CallExpression;\n\t\t\t\tconst outer = pollingMethod(call, pollingMethods);\n\t\t\t\tconst callback = outer === undefined ? undefined : pollCallback(call, pollingMethods);\n\n\t\t\t\tif (outer === undefined || callback === undefined) return;\n\n\t\t\t\tconst { classNode, fn } = enclosing(node);\n\t\t\t\tconst projectIndex = getIndex();\n\t\t\t\t// Locals come from the enclosing method, or from the callback itself for module-level polls.\n\t\t\t\tconst scope: Scope = projectIndex.scopeFor(\n\t\t\t\t\tclassNode as unknown as Node | undefined,\n\t\t\t\t\tfn ? (fn as unknown as Node) : callback\n\t\t\t\t);\n\n\t\t\t\tif (callback.type === \"ArrowFunctionExpression\" || callback.type === \"FunctionExpression\") {\n\t\t\t\t\tfor (const hit of projectIndex.collectHits(callback.body as Node, scope)) report(hit, outer);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// A reference such as `this.fetchStatus` or `fetchStatus`: the referenced function is the callback.\n\t\t\t\tconst target = projectIndex.resolveReference(callback, scope);\n\t\t\t\tconst path = target ? projectIndex.pollingPath(target) : undefined;\n\n\t\t\t\tif (path) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: callback as unknown as AstNode,\n\t\t\t\t\t\tmessageId: \"nestedCall\",\n\t\t\t\t\t\tdata: { call: sourceCode.getText(callback as unknown as AstNode), outer, path: path.join(\" → \") },\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { docsUrl } from \"../utils/docs\";\nimport type { AstNode, NodeOfType, Rule } from \"../utils/types\";\n\ntype Statement = NodeOfType<\"Program\">[\"body\"][number];\n\ntype ObjectMember = NodeOfType<\"ObjectExpression\">[\"properties\"][number];\n\ntype MessageId = \"afterImports\" | \"aroundFunctions\" | \"betweenObjectMethods\";\n\nconst BLANK_LINE = /\\r?\\n[\\t ]*\\r?\\n/;\nconst BLANK_LINES = /(\\r?\\n)(?:[\\t ]*\\r?\\n)+/g;\n\nconst unwrapExport = (node: Statement): AstNode =>\n\t(node.type === \"ExportNamedDeclaration\" || node.type === \"ExportDefaultDeclaration\") && node.declaration\n\t\t? node.declaration\n\t\t: node;\n\nconst isFunctionValue = (node: AstNode | null | undefined): boolean =>\n\tnode?.type === \"ArrowFunctionExpression\" ||\n\tnode?.type === \"FunctionExpression\" ||\n\tnode?.type === \"TSEmptyBodyFunctionExpression\";\n\nconst isImport = (node: Statement): boolean =>\n\tnode.type === \"ImportDeclaration\" ||\n\t(node.type === \"TSImportEqualsDeclaration\" && node.moduleReference.type === \"TSExternalModuleReference\");\n\nconst isFunctionStatement = (node: Statement): boolean => {\n\tconst statement = unwrapExport(node);\n\n\tif (\n\t\tstatement.type === \"FunctionDeclaration\" ||\n\t\tstatement.type === \"TSDeclareFunction\" ||\n\t\tisFunctionValue(statement)\n\t) {\n\t\treturn true;\n\t}\n\n\treturn statement.type === \"VariableDeclaration\" && statement.declarations.some(({ init }) => isFunctionValue(init));\n};\n\nconst functionStatementName = (node: Statement): string | undefined => {\n\tconst statement = unwrapExport(node);\n\n\treturn (statement.type === \"FunctionDeclaration\" || statement.type === \"TSDeclareFunction\") && statement.id\n\t\t? statement.id.name\n\t\t: undefined;\n};\n\nconst isOverloadPair = (previous: Statement, current: Statement): boolean => {\n\tconst name = functionStatementName(previous);\n\n\treturn (\n\t\tunwrapExport(previous).type === \"TSDeclareFunction\" && name !== undefined && name === functionStatementName(current)\n\t);\n};\n\n/**\n * A multi-line method, getter, setter or property holding a function. Single-line ones need no blank lines,\n * as in `lines-between-class-members`.\n */\nconst isMethodProperty = (property: ObjectMember): boolean =>\n\tproperty.type === \"Property\" &&\n\tproperty.loc.start.line !== property.loc.end.line &&\n\t(property.method || property.kind !== \"init\" || isFunctionValue(property.value));\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"layout\",\n\t\tdocs: {\n\t\t\tdescription:\n\t\t\t\t\"Require blank lines after imports, around top-level functions and around object methods, and disallow blank lines between function overloads.\",\n\t\t\turl: docsUrl(\"padding-lines\"),\n\t\t},\n\t\tfixable: \"whitespace\",\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tafterImports: \"Expected a blank line after the import declarations.\",\n\t\t\taroundFunctions: \"Expected a blank line between a function and the adjacent statement.\",\n\t\t\tbetweenObjectMethods: \"Expected a blank line around methods in an object literal.\",\n\t\t\tbetweenOverloads: \"Unexpected blank line between overloads of the same function.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst { text } = context.sourceCode;\n\t\tconst lineBreak = text.includes(\"\\r\\n\") ? \"\\r\\n\" : \"\\n\";\n\n\t\tconst requireBlankLine = (previous: AstNode, current: AstNode, messageId: MessageId): void => {\n\t\t\tconst textBetween = text.slice(previous.range[1], current.range[0]);\n\n\t\t\tif (BLANK_LINE.test(textBetween)) return;\n\n\t\t\tcontext.report({\n\t\t\t\tnode: current,\n\t\t\t\tmessageId,\n\n\t\t\t\tfix: fixer => {\n\t\t\t\t\tconst firstBreak = textBetween.search(/\\r?\\n/);\n\n\t\t\t\t\tif (firstBreak === -1) {\n\t\t\t\t\t\treturn fixer.insertTextAfterRange(previous.range, `${lineBreak}${lineBreak}`);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn fixer.insertTextAfterRange([0, previous.range[1] + firstBreak], lineBreak);\n\t\t\t\t},\n\t\t\t});\n\t\t};\n\n\t\t/** Overload signatures and the implementation form one group without blank lines; comments are kept. */\n\t\tconst forbidBlankLines = (previous: AstNode, current: AstNode): void => {\n\t\t\tconst textBetween = text.slice(previous.range[1], current.range[0]);\n\n\t\t\tif (!BLANK_LINE.test(textBetween)) return;\n\n\t\t\tcontext.report({\n\t\t\t\tnode: current,\n\t\t\t\tmessageId: \"betweenOverloads\",\n\t\t\t\tfix: fixer =>\n\t\t\t\t\tfixer.replaceTextRange([previous.range[1], current.range[0]], textBetween.replace(BLANK_LINES, \"$1\")),\n\t\t\t});\n\t\t};\n\n\t\tconst checkStatements = (statements: readonly Statement[]): void => {\n\t\t\tfor (let index = 1; index < statements.length; index++) {\n\t\t\t\tconst previous = statements[index - 1];\n\t\t\t\tconst current = statements[index];\n\n\t\t\t\tif (isImport(previous) && !isImport(current)) {\n\t\t\t\t\trequireBlankLine(previous, current, \"afterImports\");\n\t\t\t\t} else if (isOverloadPair(previous, current)) {\n\t\t\t\t\tforbidBlankLines(previous, current);\n\t\t\t\t} else if (isFunctionStatement(previous) || isFunctionStatement(current)) {\n\t\t\t\t\trequireBlankLine(previous, current, \"aroundFunctions\");\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tProgram: node => checkStatements(node.body),\n\n\t\t\tTSModuleBlock: node => checkStatements(node.body),\n\n\t\t\tObjectExpression(node): void {\n\t\t\t\tfor (let index = 1; index < node.properties.length; index++) {\n\t\t\t\t\tconst previous = node.properties[index - 1];\n\t\t\t\t\tconst current = node.properties[index];\n\n\t\t\t\t\tif (previous.loc.end.line === current.loc.start.line) continue;\n\n\t\t\t\t\tif (isMethodProperty(previous) || isMethodProperty(current)) {\n\t\t\t\t\t\trequireBlankLine(previous, current, \"betweenObjectMethods\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { isStepDecorator } from \"../utils/ast\";\nimport { docsUrl } from \"../utils/docs\";\nimport { conventionsFor } from \"../utils/settings\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\n/** The same pattern `@step` uses at runtime: the path is taken as written, so `{{ name }}` looks up \" name \". */\nconst NAMED = /\\{\\{(.*?)\\}\\}/g;\n\nconst INDEX = /\\[\\[(\\d+)\\]\\]/g;\n\n/** A lookbehind instead of a consumed prefix character, so adjacent placeholders (`{a}{b}`) are all found. */\nconst SINGLE_BRACES = /(?<!\\{)\\{([A-Za-z_$][\\w$]*(?:\\.[\\w$]+)*)\\}(?!\\})/g;\n\nconst findAll = (pattern: RegExp, text: string): RegExpExecArray[] => {\n\tconst regex = new RegExp(pattern.source, \"g\");\n\tconst found: RegExpExecArray[] = [];\n\n\tfor (let match = regex.exec(text); match !== null; match = regex.exec(text)) {\n\t\tfound.push(match);\n\t}\n\n\treturn found;\n};\n\nconst paramName = (param: AstNode): string | undefined => {\n\tconst target = param.type === \"TSParameterProperty\" ? param.parameter : param;\n\tconst binding =\n\t\ttarget.type === \"AssignmentPattern\" ? target.left : target.type === \"RestElement\" ? target.argument : target;\n\n\treturn binding.type === \"Identifier\" ? binding.name : undefined;\n};\n\n/** True when a placeholder path starts at a parameter, or at `this` (a property of the instance). */\nconst isKnownRoot = (path: string, names: readonly (string | undefined)[]): boolean => {\n\tconst [root] = path.split(\".\");\n\n\treturn root === \"this\" || names.includes(root);\n};\n\n/**\n * What is wrong with the path of a `{{path}}` placeholder, if anything. `@step` reads the path exactly as written,\n * so spaces around it either fail the parameter lookup or read a property that does not exist.\n */\nconst namedProblem = (\n\tpath: string,\n\tnames: readonly (string | undefined)[]\n): \"whitespace\" | \"unknownParameter\" | undefined => {\n\tconst trimmed = path.trim();\n\tconst isParameter = (value: string): boolean => isKnownRoot(value, names);\n\n\tif (trimmed !== path && isParameter(trimmed)) return \"whitespace\";\n\n\treturn trimmed === path && isParameter(path) ? undefined : \"unknownParameter\";\n};\n\nconst isLiteralDescription = (node: AstNode): boolean =>\n\t(node.type === \"Literal\" && typeof node.value === \"string\") ||\n\t(node.type === \"TemplateLiteral\" && node.expressions.length === 0);\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"problem\",\n\t\tdocs: {\n\t\t\tdescription: \"Validate the placeholders in `@step` descriptions against the method parameters.\",\n\t\t\turl: docsUrl(\"step-placeholders\"),\n\t\t},\n\t\tfixable: \"code\",\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tsingleBraces: \"'{{found}}' is printed literally; use '{{expected}}' for a named placeholder.\",\n\t\t\twhitespace:\n\t\t\t\t\"'{{found}}' does not resolve, because @step does not trim the spaces inside placeholders; use '{{expected}}'.\",\n\t\t\tunknownParameter: \"Placeholder '{{found}}' does not match a parameter of '{{method}}' ({{params}}).\",\n\t\t\tindexOutOfRange: \"Placeholder '{{found}}' is out of range; '{{method}}' has {{count}} parameter(s).\",\n\t\t\tnotLast: \"@step must be the decorator directly above the method, otherwise placeholders cannot be resolved.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst { stepDecorators } = conventionsFor(context);\n\n\t\t/** Reports a `{{path}}` placeholder in `description` that `@step` cannot resolve. */\n\t\tconst checkNamed = (\n\t\t\tdescription: AstNode,\n\t\t\tmatch: RegExpExecArray,\n\t\t\tnames: readonly (string | undefined)[],\n\t\t\tmethodName: string\n\t\t): void => {\n\t\t\tconst problem = namedProblem(match[1], names);\n\n\t\t\tif (problem === \"whitespace\") {\n\t\t\t\tconst from = description.range[0] + match.index;\n\t\t\t\tconst range: [number, number] = [from, from + match[0].length];\n\t\t\t\tconst expected = `{{${match[1].trim()}}}`;\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: description,\n\t\t\t\t\tmessageId: \"whitespace\",\n\t\t\t\t\tdata: { found: match[0], expected },\n\n\t\t\t\t\tfix: fixer => fixer.replaceTextRange(range, expected),\n\t\t\t\t});\n\t\t\t} else if (problem === \"unknownParameter\") {\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode: description,\n\t\t\t\t\tmessageId: \"unknownParameter\",\n\t\t\t\t\tdata: { found: match[0], method: methodName, params: names.filter(Boolean).join(\", \") || \"none\" },\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tDecorator(node): void {\n\t\t\t\tif (!isStepDecorator(node, stepDecorators)) return;\n\n\t\t\t\tconst method = node.parent;\n\n\t\t\t\tif (method.type !== \"MethodDefinition\") return;\n\n\t\t\t\tconst { decorators } = method;\n\n\t\t\t\tif (decorators[decorators.length - 1] !== node) {\n\t\t\t\t\tcontext.report({ node, messageId: \"notLast\" });\n\t\t\t\t}\n\n\t\t\t\tconst { expression } = node;\n\t\t\t\tconst description = expression.type === \"CallExpression\" ? expression.arguments[0] : undefined;\n\n\t\t\t\tif (!description || !isLiteralDescription(description)) return;\n\n\t\t\t\tconst { params } = method.value;\n\t\t\t\tconst names = params.map(paramName);\n\t\t\t\tconst hasRest = params.some(param => param.type === \"RestElement\");\n\t\t\t\tconst methodName = context.sourceCode.getText(method.key);\n\t\t\t\tconst raw = context.sourceCode.getText(description);\n\t\t\t\tconst start = description.range[0];\n\n\t\t\t\tfor (const match of findAll(NAMED, raw)) checkNamed(description, match, names, methodName);\n\n\t\t\t\tfor (const match of findAll(INDEX, raw)) {\n\t\t\t\t\tconst index = Number(match[1]);\n\n\t\t\t\t\tif (!hasRest && index >= params.length) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode: description,\n\t\t\t\t\t\t\tmessageId: \"indexOutOfRange\",\n\t\t\t\t\t\t\tdata: { found: match[0], method: methodName, count: String(params.length) },\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const match of findAll(SINGLE_BRACES, raw)) {\n\t\t\t\t\tconst placeholder = match[1];\n\t\t\t\t\tconst from = start + match.index;\n\t\t\t\t\tconst range: [number, number] = [from, from + placeholder.length + 2];\n\t\t\t\t\tconst data = { found: `{${placeholder}}`, expected: `{{${placeholder}}}` };\n\n\t\t\t\t\tif (isKnownRoot(placeholder, names)) {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode: description,\n\t\t\t\t\t\t\tmessageId: \"singleBraces\",\n\t\t\t\t\t\t\tdata,\n\n\t\t\t\t\t\t\tfix: fixer => fixer.replaceTextRange(range, data.expected),\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.report({ node: description, messageId: \"singleBraces\", data });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import { isStepDecorator } from \"../utils/ast\";\nimport { docsUrl } from \"../utils/docs\";\nimport { conventionsFor, rootFor } from \"../utils/settings\";\nimport { classify } from \"../utils/sparta-paths\";\nimport type { AstNode, Rule } from \"../utils/types\";\n\nconst STEP_LAYERS = new Set([\"stepper\", \"asserter\", \"scenario\"]);\n\nconst FUNCTION_VALUES = new Set([\"ArrowFunctionExpression\", \"FunctionExpression\"]);\n\n/** The parts of a method or property definition that decide its visibility. */\ninterface Member {\n\tstatic: boolean;\n\tkey: AstNode;\n\taccessibility?: string | null;\n}\n\n/** Public instance members are steps; static members are helpers (such as factories). */\nconst isPublicInstance = (member: Member): boolean =>\n\t!member.static &&\n\tmember.key.type !== \"PrivateIdentifier\" &&\n\tmember.accessibility !== \"private\" &&\n\tmember.accessibility !== \"protected\";\n\nconst rule: Rule = {\n\tmeta: {\n\t\ttype: \"suggestion\",\n\t\tdocs: {\n\t\t\tdescription: \"Require a `@step` decorator on public methods of steppers, asserters and scenarios.\",\n\t\t\turl: docsUrl(\"step-required\"),\n\t\t},\n\t\tschema: [],\n\t\tmessages: {\n\t\t\tmissingStep: \"Public method '{{method}}' in a {{layer}} needs a @step decorator so it is visible in the report.\",\n\t\t\tfunctionProperty:\n\t\t\t\t\"Public function property '{{method}}' in a {{layer}} cannot carry a @step decorator; make it a method with @step.\",\n\t\t},\n\t},\n\n\tcreate(context) {\n\t\tconst conventions = conventionsFor(context);\n\t\tconst info = classify(context.filename, conventions, rootFor(context, conventions));\n\t\tconst layer = info?.kind === \"top-scenario\" ? \"scenario\" : info?.layer;\n\n\t\tif (layer === undefined || !STEP_LAYERS.has(layer)) return {};\n\n\t\tconst report = (key: AstNode, messageId: \"missingStep\" | \"functionProperty\"): void => {\n\t\t\tcontext.report({ node: key, messageId, data: { method: context.sourceCode.getText(key), layer } });\n\t\t};\n\n\t\treturn {\n\t\t\tMethodDefinition(node): void {\n\t\t\t\tif (\n\t\t\t\t\tnode.kind !== \"method\" ||\n\t\t\t\t\t!isPublicInstance(node) ||\n\t\t\t\t\tnode.value.type === \"TSEmptyBodyFunctionExpression\" ||\n\t\t\t\t\tnode.decorators.some(decorator => isStepDecorator(decorator, conventions.stepDecorators))\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\treport(node.key, \"missingStep\");\n\t\t\t},\n\n\t\t\tPropertyDefinition(node): void {\n\t\t\t\tif (isPublicInstance(node) && node.value && FUNCTION_VALUES.has(node.value.type)) {\n\t\t\t\t\treport(node.key, \"functionProperty\");\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t},\n};\n\nexport default rule;\n","import type { Rule } from \"../utils/types\";\n\nimport architectureBoundaries from \"./architecture-boundaries\";\nimport classMatchesFilename from \"./class-matches-filename\";\nimport directorComposesBuilders from \"./director-composes-builders\";\nimport expectFromSupport from \"./expect-from-support\";\nimport fileNaming from \"./file-naming\";\nimport linesBetweenClassMembers from \"./lines-between-class-members\";\nimport memberOrdering from \"./member-ordering\";\nimport noDirectConstructionInTests from \"./no-direct-construction-in-tests\";\nimport noExpectInTests from \"./no-expect-in-tests\";\nimport noHardWaits from \"./no-hard-waits\";\nimport noNestedPolling from \"./no-nested-polling\";\nimport paddingLines from \"./padding-lines\";\nimport stepPlaceholders from \"./step-placeholders\";\nimport stepRequired from \"./step-required\";\n\nexport const rules = {\n\t\"architecture-boundaries\": architectureBoundaries,\n\t\"class-matches-filename\": classMatchesFilename,\n\t\"director-composes-builders\": directorComposesBuilders,\n\t\"expect-from-support\": expectFromSupport,\n\t\"file-naming\": fileNaming,\n\t\"lines-between-class-members\": linesBetweenClassMembers,\n\t\"member-ordering\": memberOrdering,\n\t\"no-direct-construction-in-tests\": noDirectConstructionInTests,\n\t\"no-expect-in-tests\": noExpectInTests,\n\t\"no-hard-waits\": noHardWaits,\n\t\"no-nested-polling\": noNestedPolling,\n\t\"padding-lines\": paddingLines,\n\t\"step-placeholders\": stepPlaceholders,\n\t\"step-required\": stepRequired,\n} satisfies Record<string, Rule>;\n\nexport type RuleName = keyof typeof rules;\n\nexport const PLUGIN_NAME = \"sparta\";\n\nexport type Severity = \"error\" | \"warn\";\n\n/** Recommended severities: `problem` rules are errors, `suggestion` and `layout` rules are warnings. */\nexport const recommendedRules = Object.fromEntries(\n\tObject.entries(rules).map(([name, rule]) => [\n\t\t`${PLUGIN_NAME}/${name}`,\n\t\trule.meta?.type === \"problem\" ? \"error\" : \"warn\",\n\t])\n) as Record<`${typeof PLUGIN_NAME}/${RuleName}`, Severity>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAa,gBAAgB,MAAkC,SAC9D,MAAM,SAAS,gBAAgB,KAAK,SAAS;;AAG9C,MAAa,eAAe,SAC3B,MAAM,SAAS,aAAa,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ,KAAA;;AAG3E,MAAa,gBAAgB,SAC5B,MAAM,SAAS,qBAAqB,KAAK,YAAY,WAAW,IAC5D,KAAK,OAAO,EAAE,EAAE,MAAM,UAAU,KAAA,IACjC,YAAY,IAAI;;AAGpB,MAAa,mBAAmB,WAAoC,UAAwC;CAC3G,MAAM,EAAE,eAAe;CACvB,MAAM,SAAS,WAAW,SAAS,mBAAmB,WAAW,SAAS;CAE1E,OAAO,OAAO,SAAS,gBAAgB,MAAM,IAAI,OAAO,IAAI;AAC7D;;ACfA,MAAa,YAAY,WACxB,OAAO,SAAS,sBAAsB,OAAO,SAAS;AAEvD,MAAMA,oCAAkB,IAAI,IAAI;CAAC;CAA2B;CAAsB;AAAiB,CAAC;;;;;AAMpG,MAAa,mBAA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