@frankmeza/affirm 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/AGENTS.md +154 -0
  2. package/LICENSE +21 -0
  3. package/README.md +152 -2
  4. package/dist/affirm.d.ts +79 -0
  5. package/dist/checks/arrays.d.ts +10 -0
  6. package/dist/checks/composition.d.ts +10 -0
  7. package/dist/checks/equality.d.ts +7 -0
  8. package/dist/checks/nullish.d.ts +9 -0
  9. package/dist/checks/numbers.d.ts +11 -0
  10. package/dist/checks/objects.d.ts +9 -0
  11. package/dist/checks/runtime-type.d.ts +14 -0
  12. package/dist/checks/size.d.ts +8 -0
  13. package/dist/checks/strings.d.ts +6 -0
  14. package/dist/core/check-def.d.ts +93 -0
  15. package/dist/core/describe.d.ts +11 -0
  16. package/dist/core/errors.d.ts +18 -0
  17. package/dist/core/evaluate.d.ts +8 -0
  18. package/dist/core/registry.d.ts +18 -0
  19. package/dist/core/report.d.ts +22 -0
  20. package/dist/core/util/deep-equal.d.ts +12 -0
  21. package/dist/core/util/kind.d.ts +22 -0
  22. package/dist/core/util/levenshtein.d.ts +3 -0
  23. package/dist/core/util/same-value-zero.d.ts +5 -0
  24. package/dist/core/util/standard-schema.d.ts +62 -0
  25. package/dist/core/validate-params.d.ts +8 -0
  26. package/dist/eslint/check-keys.d.ts +7 -0
  27. package/dist/eslint/const-params.d.ts +2 -0
  28. package/dist/eslint/guard-naming.d.ts +2 -0
  29. package/dist/eslint/index.d.ts +29 -0
  30. package/dist/eslint/no-negated-affirm.d.ts +2 -0
  31. package/dist/eslint/shared.d.ts +65 -0
  32. package/dist/eslint.js +734 -0
  33. package/dist/eslint.js.map +1 -0
  34. package/dist/index.d.ts +5 -0
  35. package/dist/index.js +967 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/types/affirmed.d.ts +55 -0
  38. package/dist/types/arrays.d.ts +64 -0
  39. package/dist/types/composition.d.ts +53 -0
  40. package/dist/types/contradictions.d.ts +90 -0
  41. package/dist/types/equality.d.ts +65 -0
  42. package/dist/types/narrowing.d.ts +66 -0
  43. package/dist/types/nullish.d.ts +80 -0
  44. package/dist/types/numbers.d.ts +94 -0
  45. package/dist/types/objects.d.ts +99 -0
  46. package/dist/types/params.d.ts +14 -0
  47. package/dist/types/runtime-type.d.ts +129 -0
  48. package/dist/types/size.d.ts +76 -0
  49. package/dist/types/strings.d.ts +49 -0
  50. package/docs/client-usage.md +842 -0
  51. package/package.json +75 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eslint.js","names":[],"sources":["../src/eslint/check-keys.ts","../src/eslint/shared.ts","../src/eslint/const-params.ts","../src/eslint/guard-naming.ts","../src/eslint/no-negated-affirm.ts","../src/eslint/index.ts"],"sourcesContent":["// Every params key affirm accepts, for recognising params objects by their keys (const-params).\n// A static copy, so the plugin doesn't bundle the runtime checks; `eslint-check-keys.test.ts` fails\n// if it drifts from `src/core/registry.ts`.\nexport const CHECK_KEYS: ReadonlySet<string> = new Set([\n 'isNull', 'isUndefined', 'isNullish', 'isDefined', 'isPresent', 'isTruthy', 'isFalsy',\n 'isType', 'isArray', 'isPlainObject', 'isFunction', 'isInstanceOf', 'isValidDate', 'isInteger', 'isFiniteNumber', 'isNaN',\n 'is', 'isNot', 'isOneOf', 'isNotOneOf', 'isDeepEqual',\n 'isEmpty', 'isNotEmpty', 'isBlank', 'hasLength', 'hasMinLength', 'hasMaxLength',\n 'isGreaterThan', 'isAtLeast', 'isLessThan', 'isAtMost', 'isBetween', 'isPositive', 'isNegative', 'isMultipleOf',\n 'startsWith', 'endsWith', 'includes', 'matches',\n 'shape', 'hasKey', 'hasKeys', 'hasAnyKey', 'hasOnlyKeys', 'hasPath',\n 'contains', 'containsAll', 'containsAny', 'everyItem', 'someItem',\n 'not', 'anyOf', 'satisfies',\n])\n\n/**\n * Check names that are ordinary words in other objects (`{ shape: 'circle' }`, a manifest's `matches`,\n * JSON Schema's `anyOf` / `not` / `contains`). An object made only of these is not taken for params\n * unless its nested params are distinctive.\n */\nexport const GENERIC_KEYS: ReadonlySet<string> = new Set([\n 'is', 'not', 'anyOf', 'shape', 'includes', 'matches', 'contains', 'startsWith', 'endsWith', 'satisfies',\n])\n","import type { Rule, Scope, SourceCode } from 'eslint'\n\n// Helpers shared by the affirm ESLint rules (design D8). Only ESLint types are imported, so the\n// plugin has no runtime dependencies (design §2).\n\nexport type Node = Rule.Node\n\nconst MAX_USAGE = 60\n\nexport const ADVICE =\n 'Negating affirm() is true when any check fails for any reason, so it tells you nothing reliable about the value. ' +\n 'Use affirm.assert(value, params) to stop on bad data, affirm.explain(value, params) to handle failures by reason, ' +\n 'or a positive check for the state you mean (e.g. `isNullish: true`).'\n\n/** Wrappers that don't change the value: `affirm?.()`, `affirm() as boolean`, `affirm()!`, … (parentheses aren't nodes). */\nconst TRANSPARENT = new Set(['ChainExpression', 'TSAsExpression', 'TSSatisfiesExpression', 'TSNonNullExpression', 'TSTypeAssertion'])\n\n/** The outermost transparent wrapper around `node`. */\nexport function outermost(node: Node): Node {\n let current = node\n while (current.parent !== null && TRANSPARENT.has(current.parent.type)) current = current.parent\n return current\n}\n\n/**\n * The whole expression carrying a value's result through `&&` / `||` (and transparent wrappers):\n * for `affirm(a) && ok` that is the `&&` expression. Negating it negates the affirm() inside.\n */\nexport function carrier(node: Node): Node {\n let current = outermost(node)\n while (current.parent?.type === 'LogicalExpression' && current.parent.operator !== '??') current = outermost(current.parent)\n return current\n}\n\n/** `!x`, `x === false`, `x == false`, `x !== true`, `x != true` (either side): the node that negates `expr`, if any. */\nexport function negationOf(expr: Node): Node | undefined {\n const value = outermost(expr)\n const parent = value.parent\n if (parent?.type === 'UnaryExpression' && parent.operator === '!') return parent\n if (parent?.type === 'BinaryExpression') {\n const other = (parent.left === value ? parent.right : parent.left) as Node\n if (other.type !== 'Literal' || typeof other.value !== 'boolean') return undefined\n const equals = parent.operator === '===' || parent.operator === '=='\n const differs = parent.operator === '!==' || parent.operator === '!='\n if ((equals && other.value === false) || (differs && other.value === true)) return parent\n }\n return undefined\n}\n\n/** One assignment at most (its initializer), so every read sees the same value. */\nexport function assignedOnce(variable: Scope.Variable): boolean {\n return variable.references.filter((reference) => reference.isWrite()).length <= 1\n}\n\n/** The variable a function is bound to: `function f() {}`, `const f = () => …`, `const f = function () {}`. */\nexport function functionVariable(fn: Node, sourceCode: SourceCode): Scope.Variable | undefined {\n if (fn.type === 'FunctionDeclaration') {\n return fn.id ? sourceCode.getDeclaredVariables(fn).find((v) => v.name === fn.id!.name) : undefined\n }\n const declarator = outermost(fn).parent\n if (declarator?.type !== 'VariableDeclarator' || declarator.init !== outermost(fn) || declarator.id.type !== 'Identifier') return undefined\n return sourceCode.getDeclaredVariables(declarator)[0]\n}\n\n/**\n * The function whose entire body is `value`: `(v) => value`, or a body that is only `return value`.\n * Calling such a function is the same as evaluating `value`.\n */\nexport function wrapperOf(value: Node): Node | undefined {\n const parent = value.parent\n if (parent?.type === 'ArrowFunctionExpression' && parent.body === value) return parent\n if (parent?.type !== 'ReturnStatement') return undefined\n const block = parent.parent\n if (block?.type !== 'BlockStatement' || block.body.length !== 1) return undefined\n const fn = block.parent\n const isFunction = fn?.type === 'FunctionDeclaration' || fn?.type === 'FunctionExpression' || fn?.type === 'ArrowFunctionExpression'\n return isFunction ? fn : undefined\n}\n\nexport function findVariable(scope: Scope.Scope | null, name: string): Scope.Variable | undefined {\n for (let s = scope; s !== null; s = s.upper) {\n const variable = s.set.get(name)\n if (variable !== undefined) return variable\n }\n return undefined\n}\n\n/** `'named'` for `import { affirm }` (any local name), `'namespace'` for `import * as ns`, from one of `sources`. */\nfunction importKind(variable: Scope.Variable | undefined, sources: ReadonlySet<string>): 'named' | 'namespace' | undefined {\n const def = variable?.defs[0]\n if (def?.type !== 'ImportBinding') return undefined\n const declaration = def.parent as { source?: { value?: unknown } } | null\n if (!sources.has(declaration?.source?.value as string)) return undefined\n const spec = def.node as { type: string; imported?: { type: string; name?: string; value?: unknown } }\n if (spec.type === 'ImportNamespaceSpecifier') return 'namespace'\n if (spec.type !== 'ImportSpecifier') return undefined\n const imported = spec.imported?.type === 'Identifier' ? spec.imported.name : spec.imported?.value\n return imported === 'affirm' ? 'named' : undefined\n}\n\n/** `affirm`, `check` (aliased import) or `ns.affirm` / `ns['affirm']` (namespace import): the affirm function itself. */\nfunction isAffirmReference(expr: Node, scope: Scope.Scope, sources: ReadonlySet<string>): boolean {\n if (expr.type === 'Identifier') return importKind(findVariable(scope, expr.name), sources) === 'named'\n if (expr.type === 'MemberExpression' && expr.object.type === 'Identifier') {\n return memberName(expr) === 'affirm' && importKind(findVariable(scope, expr.object.name), sources) === 'namespace'\n }\n return false\n}\n\n/** `x.name` or `x['name']`: the property name, if it is static. */\nfunction memberName(expr: Node): string | undefined {\n if (expr.type !== 'MemberExpression') return undefined\n if (!expr.computed) return expr.property.type === 'Identifier' ? expr.property.name : undefined\n return expr.property.type === 'Literal' && typeof expr.property.value === 'string' ? expr.property.value : undefined\n}\n\n/** `affirm(…)`, `check(…)` (aliased import) or `ns.affirm(…)` / `ns['affirm'](…)` (namespace import). */\nexport function isAffirmCall(node: Node, sourceCode: SourceCode, sources: ReadonlySet<string>): boolean {\n return node.type === 'CallExpression' && isAffirmReference(node.callee as Node, sourceCode.getScope(node), sources)\n}\n\n/** Any call that takes affirm params second: `affirm(v, p)`, `affirm.assert(v, p, msg)`, `affirm.explain(v, p)`. */\nexport function takesAffirmParams(node: Node, sourceCode: SourceCode, sources: ReadonlySet<string>): boolean {\n if (node.type !== 'CallExpression') return false\n if (isAffirmCall(node, sourceCode, sources)) return true\n const callee = node.callee as Node\n const method = memberName(callee)\n return (\n callee.type === 'MemberExpression' &&\n (method === 'assert' || method === 'explain') &&\n isAffirmReference(callee.object as Node, sourceCode.getScope(node), sources)\n )\n}\n\nexport function truncate(text: string): string {\n return text.length <= MAX_USAGE ? text : `${text.slice(0, MAX_USAGE - 1)}…`\n}\n\n/** The offending code, on one line, shortened for the message. */\nexport function usageText(sourceCode: SourceCode, node: Node): string {\n return truncate(sourceCode.getText(node).replace(/\\s+/g, ' '))\n}\n\n\n/**\n * Shared settings for every affirm rule, in the flat config's `settings.affirm`:\n *\n * - `sources`: module specifiers that export `affirm` (default `['@frankmeza/affirm']`). Add your own re-export.\n * - `guards`: a regular expression (as a string) that every function returning `affirm(…)` must match,\n * and that only such functions may match. With it, negated calls to imported guards are caught too.\n * - `guardModules`: import prefixes that are your own code, for path aliases such as `'@/'`.\n * Guards are recognised when defined in the file, imported from a relative path, or imported from\n * one of these prefixes; anything imported from a package (a third-party `isValid…`) is not a guard.\n */\nexport interface AffirmSettings {\n sources?: string[]\n guards?: string\n guardModules?: string[]\n}\n\nfunction settingsOf(context: Rule.RuleContext): AffirmSettings {\n const settings = (context.settings as { affirm?: unknown }).affirm\n if (settings === undefined) return {}\n if (typeof settings !== 'object' || settings === null) throw new Error('affirm: `settings.affirm` must be an object')\n return settings as AffirmSettings\n}\n\n/** `sources` from the rule's own option (if given), else `settings.affirm.sources`, else `['@frankmeza/affirm']`. */\nexport function sourcesOf(context: Rule.RuleContext, option?: string[]): ReadonlySet<string> {\n const sources = option ?? settingsOf(context).sources ?? ['@frankmeza/affirm']\n if (!Array.isArray(sources) || sources.some((s) => typeof s !== 'string')) {\n throw new Error('affirm: `settings.affirm.sources` must be an array of module specifiers')\n }\n return new Set(sources)\n}\n\n/** `settings.affirm.guards` compiled, or `undefined` when no guard pattern is configured. */\nexport function guardPatternOf(context: Rule.RuleContext): RegExp | undefined {\n const pattern = settingsOf(context).guards\n if (pattern === undefined) return undefined\n if (typeof pattern !== 'string' || pattern === '') {\n throw new Error('affirm: `settings.affirm.guards` must be a non-empty regular expression string, e.g. \"^isValid\"')\n }\n try {\n return new RegExp(pattern, 'u')\n } catch (error) {\n throw new Error(`affirm: \\`settings.affirm.guards\\` is not a valid regular expression: ${(error as Error).message}`)\n }\n}\n\n/** `guardModules` as a list of prefixes (default none: only relative imports count as project code). */\nexport function guardModulesOf(context: Rule.RuleContext): readonly string[] {\n const modules = settingsOf(context).guardModules ?? []\n if (!Array.isArray(modules) || modules.some((m) => typeof m !== 'string' || m === '')) {\n throw new Error(\"affirm: `settings.affirm.guardModules` must be an array of import prefixes, e.g. ['@/']\")\n }\n return modules\n}\n\n/** The module an imported variable comes from, or `undefined` when it isn't an import. */\nexport function importSourceOf(variable: Scope.Variable | undefined): string | undefined {\n const def = variable?.defs[0]\n if (def?.type !== 'ImportBinding') return undefined\n const source = (def.parent as { source?: { value?: unknown } } | null)?.source?.value\n return typeof source === 'string' ? source : undefined\n}\n\n/**\n * Whether a call that matches the guard pattern can be one of the project's guards: defined in this\n * file, imported from a relative path or a `guardModules` prefix, or a method on a local value.\n * Calls into packages (`import validator from 'validator'; validator.isValidX()`) are not.\n */\nexport function isProjectCall(call: Node, sourceCode: SourceCode, guardModules: readonly string[]): boolean {\n if (call.type !== 'CallExpression') return false\n const callee = call.callee as Node\n const root = callee.type === 'Identifier' ? callee : callee.type === 'MemberExpression' && callee.object.type === 'Identifier' ? callee.object : undefined\n if (root === undefined) return true // `this.isValidX()`, `make().isValidX()`: project code we can't trace\n const variable = findVariable(sourceCode.getScope(call), root.name)\n if (variable === undefined) return callee.type !== 'Identifier' // an undeclared global function is not a project guard\n const source = importSourceOf(variable)\n if (source === undefined) return true // defined in this file\n return source.startsWith('.') || guardModules.some((prefix) => source.startsWith(prefix))\n}\n\n/** The name a function is bound to, and the node to report on: declarations, variables, object and class members. */\nexport function functionName(fn: Node): { name: string; node: Node } | undefined {\n if (fn.type === 'FunctionDeclaration') return fn.id ? { name: fn.id.name, node: fn.id as Node } : undefined\n const holder = outermost(fn).parent\n if (holder?.type === 'VariableDeclarator' && holder.init === outermost(fn) && holder.id.type === 'Identifier') {\n return { name: holder.id.name, node: holder.id as Node }\n }\n const member = holder as (Node & { key?: Node; computed?: boolean; value?: unknown }) | null\n const isMember = member?.type === 'Property' || member?.type === 'MethodDefinition' || (member?.type as string) === 'PropertyDefinition'\n if (isMember && member!.value === outermost(fn) && !member!.computed && member!.key?.type === 'Identifier') {\n return { name: member!.key.name, node: member!.key }\n }\n return undefined\n}\n\n/** The name a call goes through: `isValidOrder(x)` or `guards.isValidOrder(x)`. */\nexport function calleeName(call: Node): string | undefined {\n if (call.type !== 'CallExpression') return undefined\n const callee = call.callee as Node\n if (callee.type === 'Identifier') return callee.name\n if (callee.type === 'MemberExpression' && !callee.computed && callee.property.type === 'Identifier') return callee.property.name\n return undefined\n}\n","import type { Rule, Scope, SourceCode } from 'eslint'\nimport { CHECK_KEYS, GENERIC_KEYS } from './check-keys.js'\nimport { findVariable, sourcesOf, takesAffirmParams, type Node } from './shared.js'\n\n// Hoisted params lose their literal types: `const p = { isOneOf: ['a', 'b'] }` is typed\n// `{ isOneOf: string[] }` before affirm() ever sees it, so narrowing silently weakens\n// (docs/client-usage.md §8.1). affirm can't recover the literals, so this rule asks for `as const`\n// where the params are declared. TypeScript files only: `as const` is not JavaScript.\n//\n// Params are found two ways: by following what is passed to affirm() in this file, and by their\n// keys, wherever they are declared. The second covers params exported to other files, which a\n// one-file-at-a-time linter can't follow (design D10).\n//\n// With type information (typescript-eslint's `projectService`), a third way covers the rest: for an\n// imported name used in params, TypeScript finds its declaration in the other file. This is the only\n// way to catch bare lists (`isOneOf: ROLES`), which have no keys to recognise.\n\nconst TS_FILE = /\\.[cm]?tsx?$/\n\n/** `to` relative to `from` when it's inside it (for readable messages); otherwise unchanged. */\nfunction relativePath(from: string, to: string): string {\n const base = from.endsWith('/') ? from : `${from}/`\n return to.startsWith(base) ? to.slice(base.length) : to\n}\n\n/** Nodes that wrap an expression without changing what it is, for walking into params. */\nconst WRAPPERS = new Set(['TSAsExpression', 'TSSatisfiesExpression', 'TSNonNullExpression', 'TSTypeAssertion'])\n\ninterface Finding {\n variable: Scope.Variable\n /** The declared name, where the problem is reported. */\n id: Node\n /** The object or array literal the params are written as. */\n literal: Node\n /** `plain`: no `as const`. `typed`: an annotation or `as T` cast erases the literal types. */\n kind: 'plain' | 'typed'\n /** For `typed`: the type node, and the node to remove (`: T` annotation or the whole `as T` cast). */\n type?: Node\n cast?: Node\n}\n\nfunction isAsConst(node: Node): boolean {\n if ((node.type as string) !== 'TSAsExpression') return false\n const type = (node as unknown as { typeAnnotation: { type: string; typeName?: { type: string; name?: string } } }).typeAnnotation\n return type.type === 'TSTypeReference' && type.typeName?.type === 'Identifier' && type.typeName.name === 'const'\n}\n\nconst isLiteral = (node: Node | null | undefined): boolean => node?.type === 'ObjectExpression' || node?.type === 'ArrayExpression'\n\nfunction expressionOf(node: Node): Node {\n return (node as unknown as { expression: Node }).expression\n}\n\n/** Whether a reference sits inside a type query (`typeof p` in a type), which `as const` only improves. */\nfunction inTypeQuery(identifier: Node): boolean {\n for (let n: Node | null = identifier.parent; n !== null; n = n.parent) {\n if ((n.type as string) === 'TSTypeQuery') return true\n if (!(n.type as string).startsWith('TS') && n.type !== 'MemberExpression') return false\n }\n return false\n}\n\n// ---- Type-aware part -------------------------------------------------------------------------\n// The plugin can't import `typescript` (no runtime dependencies; TypeScript 7 has no JS API; the\n// client's version is unknown), so it only uses the checker the parser provides, and recognises\n// TypeScript syntax nodes by their properties instead of version-specific `SyntaxKind` numbers.\n\n/** `ts.SymbolFlags.Alias` (1 << 21), stable across TypeScript versions. */\nconst SYMBOL_FLAGS_ALIAS = 2097152\n\ninterface TsNode {\n parent?: TsNode\n getText(): string\n getStart(): number\n getSourceFile(): { fileName: string; getLineAndCharacterOfPosition(position: number): { line: number } }\n [property: string]: unknown\n}\ninterface TsSymbol {\n flags: number\n valueDeclaration?: TsNode\n declarations?: TsNode[]\n}\ninterface TsChecker {\n getSymbolAtLocation(node: TsNode): TsSymbol | undefined\n getAliasedSymbol(symbol: TsSymbol): TsSymbol\n}\ninterface TypedServices {\n program: { getTypeChecker(): TsChecker }\n esTreeNodeToTSNodeMap: { get(node: Node): TsNode }\n}\n\n/** typescript-eslint's services, when the client lints with type information; otherwise `undefined`. */\nfunction typedServicesOf(sourceCode: SourceCode): TypedServices | undefined {\n const services = sourceCode.parserServices as Partial<TypedServices> | undefined\n return services?.program && services.esTreeNodeToTSNodeMap ? (services as TypedServices) : undefined\n}\n\n/**\n * Why a declaration in another file widens its value, if it does: a list or object literal declared\n * `const` without `as const` (or with a type annotation). `undefined` when it's fine or unknowable:\n * `as const` / `<const>`, a call such as `loadRoles()`, `let`, or an ambient `.d.ts` declaration.\n */\nfunction widenedBy(declaration: TsNode): string | undefined {\n let init = declaration.initializer as TsNode | undefined\n if (!init || !('name' in declaration)) return undefined\n if (!/^const\\b/.test(declaration.parent?.getText() ?? '')) return undefined // the VariableDeclarationList\n if (declaration.type) return `with the type \\`${(declaration.type as TsNode).getText()}\\``\n while ('type' in init && 'expression' in init) {\n // `x as T`, `x satisfies T`, `<T>x`: `as const` / `<const>` keeps the literals\n if ((init.type as TsNode).getText() === 'const') return undefined\n init = init.expression as TsNode\n }\n return 'elements' in init || 'properties' in init ? 'without `as const`' : undefined\n}\n\n/** A property's static key: `isOneOf`, `'isOneOf'`. */\nfunction keyOf(property: Node): string | undefined {\n if (property.type !== 'Property' || property.computed) return undefined\n const key = property.key as Node\n if (key.type === 'Identifier') return key.name\n return key.type === 'Literal' && typeof key.value === 'string' ? key.value : undefined\n}\n\n/** Keys whose value is itself params (or, for `shape`, an object of params; for `anyOf`, a list of params). */\nfunction nestedParams(key: string, value: Node): Node[] {\n if (key === 'not' || key === 'everyItem' || key === 'someItem') return [value]\n if (key === 'shape' && value.type === 'ObjectExpression') return value.properties.flatMap((p) => (p.type === 'Property' ? [p.value as Node] : []))\n if (key === 'anyOf' && value.type === 'ArrayExpression') return value.elements.filter((e): e is NonNullable<typeof e> & Node => e?.type === 'ObjectExpression')\n return []\n}\n\n/**\n * Whether an object literal is unmistakably affirm params: every key is a check name, and at least\n * one key (here or in nested params) is distinctive. `{ isOneOf: […] }` and `{ shape: { id: { isType: 'string' } } }`\n * are params; `{ shape: 'circle' }`, a manifest's `{ matches: […] }` and JSON Schema's `{ anyOf: […] }` are not.\n */\nfunction looksLikeParams(node: Node | null | undefined, depth = 0): boolean {\n if (node?.type !== 'ObjectExpression' || depth > 8) return false\n const keyed = node.properties.filter((p) => p.type === 'Property')\n if (keyed.length === 0) return false\n let distinctive = false\n for (const property of keyed) {\n const key = keyOf(property as Node)\n if (key === undefined || !CHECK_KEYS.has(key)) return false\n if (!GENERIC_KEYS.has(key)) distinctive = true\n }\n if (distinctive) return true\n return keyed.some((property) => nestedParams(keyOf(property as Node)!, property.value as Node).some((inner) => looksLikeParams(inner, depth + 1)))\n}\n\n/** The object literal a declaration is written as, under `satisfies` / `as` (including `as const`). */\nfunction literalOf(init: Node | null | undefined): Node | undefined {\n let node = init\n while (node && WRAPPERS.has(node.type as string)) node = expressionOf(node)\n return node ?? undefined\n}\n\n/**\n * What's wrong with a `const` declaration used as params, if anything:\n * `{…}` → plain; `: T = {…}` or `{…} as T` → typed. `{…} as const` (optionally `satisfies T`) is fine.\n */\nfunction classify(declarator: Node, variable: Scope.Variable): Finding | undefined {\n if (declarator.type !== 'VariableDeclarator' || declarator.id.type !== 'Identifier' || !declarator.init) return undefined\n const id = declarator.id as Node & { typeAnnotation?: { typeAnnotation: Node } }\n let init = declarator.init as Node\n if ((init.type as string) === 'TSSatisfiesExpression') init = expressionOf(init)\n if (isAsConst(init)) return undefined\n if ((init.type as string) === 'TSAsExpression' && isLiteral(expressionOf(init))) {\n const type = (init as unknown as { typeAnnotation: Node }).typeAnnotation\n return { variable, id, literal: expressionOf(init), kind: 'typed', type, cast: init }\n }\n if (!isLiteral(init)) return undefined\n if (id.typeAnnotation) return { variable, id, literal: init, kind: 'typed', type: id.typeAnnotation.typeAnnotation }\n return { variable, id, literal: init, kind: 'plain' }\n}\n\n/** `{…} as const`, or for a typed declaration `{…} as const satisfies T` (keeps the type check). */\nfunction fixFor(finding: Finding, sourceCode: SourceCode): Rule.ReportFixer {\n return (fixer) => {\n if (finding.kind === 'plain') return fixer.insertTextAfter(finding.literal, ' as const')\n const typeText = sourceCode.getText(finding.type!)\n if (finding.cast) return fixer.replaceText(finding.cast, `${sourceCode.getText(finding.literal)} as const satisfies ${typeText}`)\n const annotation = (finding.id as Node & { typeAnnotation: Node }).typeAnnotation\n return [fixer.remove(annotation), fixer.insertTextAfter(finding.literal, ` as const satisfies ${typeText}`)]\n }\n}\n\nexport const constParams: Rule.RuleModule = {\n meta: {\n type: 'problem',\n fixable: 'code',\n hasSuggestions: true,\n docs: {\n description: 'Require `as const` on params declared apart from the affirm() call, so their literal types (and narrowing) survive.',\n },\n schema: [],\n messages: {\n needsConst:\n \"affirm: params `{{name}}` need `as const`. Without it TypeScript widens their values ('a' → string, true → boolean) \" +\n 'before affirm() sees them, so narrowing is silently lost. Declare `const {{name}} = { … } as const`.',\n typed:\n 'affirm: params `{{name}}` are typed as `{{type}}`, which erases their exact values, so affirm() can only narrow ' +\n 'with the general type. Use `as const satisfies {{type}}` instead: it keeps both the type check and the exact values.',\n suggestConst: 'Add `as const` (`{{name}}` is also used outside affirm params; check those uses still compile).',\n suggestTyped: 'Replace the `{{type}}` type with `as const satisfies {{type}}`.',\n importedWidened:\n 'affirm: `{{name}}` is used in params here, but it is declared {{reason}} in {{file}}:{{line}}, so TypeScript widened ' +\n \"its values ('a' → string) before affirm() sees them, and narrowing is silently lost. Fix that declaration: `= … as const`.\",\n },\n },\n\n create(context) {\n if (!TS_FILE.test(context.filename)) return {}\n const { sourceCode } = context\n const sources = sourcesOf(context)\n\n const typed = typedServicesOf(sourceCode)\n const reportedRemote = new Set<TsNode>() // declarations in other files, reported once per file\n\n const paramRefs = new Set<Node>() // identifiers used in a params position\n const seen = new Set<Scope.Variable>()\n const findings: Finding[] = []\n\n /** Visits everything that ends up in params: the literal, nested values, spreads, and hoisted variables. */\n function walk(node: Node | null | undefined): void {\n if (!node) return\n if (WRAPPERS.has(node.type as string)) return walk(expressionOf(node))\n if (node.type === 'ObjectExpression') {\n for (const property of node.properties) walk((property.type === 'SpreadElement' ? property.argument : property.value) as Node)\n } else if (node.type === 'ArrayExpression') {\n for (const element of node.elements) walk((element?.type === 'SpreadElement' ? element.argument : element) as Node | null)\n } else if (node.type === 'Identifier') {\n paramRefs.add(node)\n const variable = findVariable(sourceCode.getScope(node), node.name)\n if (variable?.defs[0]?.type === 'ImportBinding' || variable === undefined) checkRemote(node)\n else inspect(variable)\n } else if (node.type === 'MemberExpression' && !node.computed) {\n checkRemote(node.property as Node) // `P.orderParams` from `import * as P`\n }\n }\n\n /** With type information: a name declared in another file, widened where it's declared. */\n function checkRemote(node: Node): void {\n if (typed === undefined) return\n const checker = typed.program.getTypeChecker()\n const here = typed.esTreeNodeToTSNodeMap.get(node)\n let symbol = checker.getSymbolAtLocation(here)\n if (symbol !== undefined && (symbol.flags & SYMBOL_FLAGS_ALIAS) !== 0) symbol = checker.getAliasedSymbol(symbol)\n const declaration = symbol?.valueDeclaration ?? symbol?.declarations?.[0]\n if (declaration === undefined || declaration.getSourceFile() === here.getSourceFile() || reportedRemote.has(declaration)) return\n const reason = widenedBy(declaration)\n if (reason === undefined) return\n reportedRemote.add(declaration)\n const source = declaration.getSourceFile()\n const file = relativePath(context.cwd, source.fileName)\n const line = String(source.getLineAndCharacterOfPosition(declaration.getStart()).line + 1)\n const name = node.type === 'Identifier' ? node.name : sourceCode.getText(node)\n context.report({ node, messageId: 'importedWidened', data: { name, reason, file, line } })\n }\n\n /** Checks a `const` that holds params (once), then everything inside it: nested hoisted params need `as const` too. */\n function inspect(variable: Scope.Variable | undefined): void {\n if (variable === undefined || seen.has(variable)) return\n seen.add(variable)\n const def = variable.defs[0]\n if (def?.type !== 'Variable' || (def.parent as { kind?: string } | null)?.kind !== 'const') return\n const finding = classify(def.node as Node, variable)\n if (finding) findings.push(finding)\n walk((def.node as Node & { init?: Node }).init)\n }\n\n return {\n CallExpression(node) {\n if (takesAffirmParams(node, sourceCode, sources)) walk(node.arguments[1] as Node | undefined)\n },\n\n // Params recognised by their keys, even if this file never passes them to affirm() (e.g. exported ones).\n VariableDeclarator(node) {\n if (node.id.type !== 'Identifier' || (node.parent as { kind?: string }).kind !== 'const') return\n if (!looksLikeParams(literalOf(node.init as Node | null))) return\n for (const variable of sourceCode.getDeclaredVariables(node)) inspect(variable)\n },\n\n 'Program:exit'() {\n for (const finding of findings) {\n const name = finding.variable.name\n const fix = fixFor(finding, sourceCode)\n if (finding.kind === 'typed') {\n const type = sourceCode.getText(finding.type!)\n context.report({ node: finding.id, messageId: 'typed', data: { name, type }, suggest: [{ messageId: 'suggestTyped', data: { type }, fix }] })\n continue\n }\n // Autofix only when every use is as params (or `typeof` in a type): then `as const` can't break anything.\n const onlyParams = finding.variable.references.every(\n (ref) => ref.identifier === finding.id || paramRefs.has(ref.identifier as Node) || inTypeQuery(ref.identifier as Node),\n )\n context.report({\n node: finding.id,\n messageId: 'needsConst',\n data: { name },\n ...(onlyParams ? { fix } : { suggest: [{ messageId: 'suggestConst', data: { name }, fix }] }),\n })\n }\n },\n }\n },\n}\n","import type { Rule } from 'eslint'\nimport { carrier, functionName, guardPatternOf, isAffirmCall, sourcesOf, wrapperOf, type Node } from './shared.js'\n\n// Design D8, cross-file part. ESLint checks one file at a time, so `no-negated-affirm` can't tell\n// that an imported `isValidOrder` returns affirm(…). This rule makes the name carry that fact:\n// with `settings.affirm.guards` set (e.g. \"^isValid\"), a named function returns affirm(…) if and\n// only if its name matches the pattern. `no-negated-affirm` then flags `!isValidOrder(x)` in any\n// file. Without the setting this rule does nothing.\n\nexport const guardNaming: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description:\n 'With `settings.affirm.guards`, require functions that return affirm(…) to match the guard pattern, and reserve the pattern for them.',\n },\n schema: [],\n messages: {\n unnamedGuard:\n \"affirm: `{{name}}` returns affirm(…), so its name must match the guard pattern `{{pattern}}` (settings.affirm.guards). \" +\n 'That lets affirm/no-negated-affirm catch `!{{name}}(…)` in the files that import it.',\n reservedName:\n \"affirm: `{{name}}` matches the guard pattern `{{pattern}}` (settings.affirm.guards), which is reserved for functions whose whole body returns affirm(…). \" +\n 'Rename it, or make it return affirm(…) (negating it is reported as negating a guard).',\n },\n },\n\n create(context) {\n const guards = guardPatternOf(context)\n if (guards === undefined) return {}\n const sources = sourcesOf(context)\n const { sourceCode } = context\n\n const wrappers = new Set<Node>()\n const named = new Map<Node, { name: string; node: Node }>()\n\n function collect(fn: Node): void {\n const binding = functionName(fn)\n if (binding !== undefined && guards!.test(binding.name)) named.set(fn, binding)\n }\n\n return {\n FunctionDeclaration: collect,\n FunctionExpression: collect,\n ArrowFunctionExpression: collect,\n\n CallExpression(node) {\n if (!isAffirmCall(node, sourceCode, sources)) return\n const wrapper = wrapperOf(carrier(node))\n if (wrapper === undefined || wrappers.has(wrapper)) return // `check(a) && check(b)`: one function, one report\n wrappers.add(wrapper)\n const binding = functionName(wrapper) // undefined for inline callbacks such as `.filter((r) => affirm(r, p))`\n if (binding !== undefined && !guards.test(binding.name)) {\n context.report({ node: binding.node, messageId: 'unnamedGuard', data: { name: binding.name, pattern: guards.source } })\n }\n },\n\n 'Program:exit'() {\n for (const [fn, binding] of named) {\n if (wrappers.has(fn)) continue\n context.report({ node: binding.node, messageId: 'reservedName', data: { name: binding.name, pattern: guards.source } })\n }\n },\n }\n },\n}\n","import type { Rule, Scope, SourceCode } from 'eslint'\nimport {\n ADVICE,\n assignedOnce,\n calleeName,\n carrier,\n functionVariable,\n guardModulesOf,\n guardPatternOf,\n isAffirmCall,\n isProjectCall,\n negationOf,\n outermost,\n sourcesOf,\n truncate,\n usageText,\n wrapperOf,\n type Node,\n} from './shared.js'\n\n// Design D8: `affirm(value, params)` is an AND of narrow checks, so its negation means \"some\n// check failed, for some reason\", which is too broad to build on. This rule forbids negating it.\n\ninterface Options {\n /** Module specifiers that export `affirm`. Overrides `settings.affirm.sources`. */\n sources?: string[]\n}\n\n/**\n * `if (!affirm(v, p)) throw new X('msg')` → `affirm.assert(v, p, 'msg')`. A suggestion, never an autofix:\n * the thrown error becomes an `AffirmError`.\n */\nfunction assertSuggestion(negation: Node, call: Node, sourceCode: SourceCode): Rule.SuggestionReportDescriptor | undefined {\n const statement = negation.parent\n if (negation.type !== 'UnaryExpression' || statement?.type !== 'IfStatement') return undefined\n if (statement.test !== negation || statement.alternate) return undefined\n if (call.type !== 'CallExpression' || call.optional || call.arguments.length < 2) return undefined\n const consequent = statement.consequent\n const thrown =\n consequent.type === 'ThrowStatement'\n ? consequent\n : consequent.type === 'BlockStatement' && consequent.body.length === 1 && consequent.body[0]!.type === 'ThrowStatement'\n ? consequent.body[0]\n : undefined\n if (thrown === undefined) return undefined\n\n const args = call.arguments as Node[]\n const argsText = sourceCode.text.slice(args[0]!.range![0], args[args.length - 1]!.range![1])\n const error = thrown.argument as Node\n let message = ''\n if (error.type === 'NewExpression' && error.arguments.length === 1) {\n const arg = error.arguments[0] as Node\n const plainText = (arg.type === 'Literal' && typeof arg.value === 'string') || (arg.type === 'TemplateLiteral' && arg.expressions.length === 0)\n if (plainText) message = `, ${sourceCode.getText(arg)}`\n }\n const replacement = `${sourceCode.getText(call.callee as Node)}.assert(${argsText}${message})`\n return {\n messageId: 'suggestAssert',\n data: { replacement: truncate(replacement.replace(/\\s+/g, ' ')) },\n fix: (fixer) => fixer.replaceText(statement, replacement),\n }\n}\n\nexport const noNegatedAffirm: Rule.RuleModule = {\n meta: {\n type: 'problem',\n docs: {\n description: 'Disallow negating affirm() (`!affirm(…)`, `affirm(…) === false`, …): its negation is too broad to rely on.',\n },\n hasSuggestions: true,\n schema: [\n {\n type: 'object',\n properties: { sources: { type: 'array', items: { type: 'string' }, minItems: 1 } },\n additionalProperties: false,\n },\n ],\n messages: {\n negated: `affirm: \\`{{usage}}\\` is not allowed. ${ADVICE}`,\n negatedResult: `affirm: \\`{{usage}}\\` negates the affirm() result stored in \\`{{name}}\\`, which is not allowed. ${ADVICE}`,\n negatedWrapper: `affirm: \\`{{usage}}\\` negates \\`{{name}}\\`, which returns affirm(…), which is not allowed. ${ADVICE}`,\n negatedGuard: `affirm: \\`{{usage}}\\` negates \\`{{name}}\\`, a guard built on affirm() (its name matches the guard pattern \\`{{pattern}}\\`), which is not allowed. ${ADVICE}`,\n suggestAssert: 'Replace with `{{replacement}}` (throws AffirmError with the full report instead).',\n },\n },\n\n create(context) {\n const { sourceCode } = context\n const options = (context.options[0] ?? {}) as Options\n const sources = sourcesOf(context, options.sources)\n const guards = guardPatternOf(context)\n const guardModules = guardModulesOf(context)\n\n const reported = new Set<Node>()\n\n interface Problem {\n messageId: string\n data: Record<string, string>\n suggest?: Rule.SuggestionReportDescriptor[]\n }\n\n function report(negation: Node, problem: Problem): void {\n if (reported.has(negation)) return // `!(affirm(a) && affirm(b))` is one problem, not two\n reported.add(negation)\n context.report({ node: negation, ...problem })\n }\n\n /** Reports negated reads of a variable holding an affirm() result, or calls of a wrapper function. */\n function checkVariable(variable: Scope.Variable, asWrapper: boolean): void {\n if (!assignedOnce(variable)) return\n for (const reference of variable.references) {\n if (!reference.isRead()) continue\n let value = reference.identifier as Node\n if (asWrapper) {\n const call = value.parent\n if (call?.type !== 'CallExpression' || call.callee !== value) continue\n value = call\n }\n const negation = negationOf(carrier(value))\n if (negation === undefined) continue\n report(negation, {\n messageId: asWrapper ? 'negatedWrapper' : 'negatedResult',\n data: { usage: usageText(sourceCode, negation), name: variable.name },\n })\n }\n }\n\n return {\n CallExpression(node) {\n if (!isAffirmCall(node, sourceCode, sources)) {\n // A guard from anywhere (usually another file): its name matches `settings.affirm.guards`.\n const name = calleeName(node)\n if (guards === undefined || name === undefined || !guards.test(name)) return\n if (!isProjectCall(node, sourceCode, guardModules)) return // a third-party `isValid…` is not our guard\n const negation = negationOf(carrier(node))\n if (negation !== undefined) {\n report(negation, { messageId: 'negatedGuard', data: { usage: usageText(sourceCode, negation), name, pattern: guards.source } })\n }\n return\n }\n const value = carrier(node)\n\n // `!affirm(…)`, `!(affirm(…) && x)`, `affirm(…) === false`, …\n const negation = negationOf(value)\n if (negation !== undefined) {\n const suggestion = value === outermost(node) ? assertSuggestion(negation, node, sourceCode) : undefined\n report(negation, {\n messageId: 'negated',\n data: { usage: usageText(sourceCode, negation) },\n ...(suggestion ? { suggest: [suggestion] } : {}),\n })\n return\n }\n\n // `const ok = affirm(…)` (or a `let` / `var` never reassigned), later `!ok`.\n const declarator = value.parent\n if (declarator?.type === 'VariableDeclarator' && declarator.init === value && declarator.id.type === 'Identifier') {\n for (const variable of sourceCode.getDeclaredVariables(declarator)) checkVariable(variable, false)\n return\n }\n\n // A same-file wrapper, `const isOrder = (v) => affirm(v, p)`, later `!isOrder(x)`.\n const wrapper = wrapperOf(value)\n const variable = wrapper && functionVariable(wrapper, sourceCode)\n if (variable) checkVariable(variable, true)\n },\n }\n },\n}\n","import type { ESLint, Linter } from 'eslint'\nimport { constParams } from './const-params.js'\nimport { guardNaming } from './guard-naming.js'\nimport { noNegatedAffirm } from './no-negated-affirm.js'\n\n/**\n * ESLint plugin for projects that use `affirm` (flat config, ESLint 9+).\n *\n * @example\n * // eslint.config.js\n * import affirm from '@frankmeza/affirm/eslint'\n * export default [affirm.configs.recommended]\n *\n * // Optional: catch negated guards imported from other files, and/or a local re-export of affirm.\n * export default [\n * affirm.configs.recommended,\n * { settings: { affirm: { guards: '^isValid', sources: ['@frankmeza/affirm', '@/lib/affirm'] } } },\n * ]\n */\nconst plugin = {\n meta: { name: '@frankmeza/affirm/eslint' },\n rules: { 'no-negated-affirm': noNegatedAffirm, 'guard-naming': guardNaming, 'const-params': constParams },\n configs: {} as { recommended: Linter.Config },\n} satisfies ESLint.Plugin\n\nplugin.configs.recommended = {\n name: 'affirm/recommended',\n plugins: { affirm: plugin },\n // guard-naming does nothing until `settings.affirm.guards` is set; const-params only checks TypeScript files.\n rules: { 'affirm/no-negated-affirm': 'error', 'affirm/guard-naming': 'error', 'affirm/const-params': 'error' },\n}\n\nexport default plugin\n"],"mappings":";AAGA,IAAa,6BAAkC,IAAI,IAAI;CACrD;CAAU;CAAe;CAAa;CAAa;CAAa;CAAY;CAC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K,IAAI,GAAG;MACtE,IAAI,CAAC,cAAc,MAAM,YAAY,YAAY,GAAG;MACpD,MAAM,WAAW,WAAW,QAAQ,IAAI,CAAC;MACzC,IAAI,aAAa,KAAA,GACf,OAAO,UAAU;OAAE,WAAW;OAAgB,MAAM;QAAE,OAAO,UAAU,YAAY,QAAQ;QAAG;QAAM,SAAS,OAAO;OAAO;MAAE,CAAC;MAEhI;KACF;KACA,MAAM,QAAQ,QAAQ,IAAI;KAG1B,MAAM,WAAW,WAAW,KAAK;KACjC,IAAI,aAAa,KAAA,GAAW;MAC1B,MAAM,aAAa,UAAU,UAAU,IAAI,IAAI,iBAAiB,UAAU,MAAM,UAAU,IAAI,KAAA;MAC9F,OAAO,UAAU;OACf,WAAW;OACX,MAAM,EAAE,OAAO,UAAU,YAAY,QAAQ,EAAE;OAC/C,GAAI,aAAa,EAAE,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC;MAChD,CAAC;MACD;KACF;KAGA,MAAM,aAAa,MAAM;KACzB,IAAI,YAAY,SAAS,wBAAwB,WAAW,SAAS,SAAS,WAAW,GAAG,SAAS,cAAc;MACjH,KAAK,MAAM,YAAY,WAAW,qBAAqB,UAAU,GAAG,cAAc,UAAU,KAAK;MACjG;KACF;KAGA,MAAM,UAAU,UAAU,KAAK;KAC/B,MAAM,WAAW,WAAW,iBAAiB,SAAS,UAAU;KAChE,IAAI,UAAU,cAAc,UAAU,IAAI;IAC5C,EACF;GACF;EClJ8B;EAAiB,gBAAgB;EAAa,gBAAgB;CAAY;CACxG,SAAS,CAAC;AACZ;AAEA,OAAO,QAAQ,cAAc;CAC3B,MAAM;CACN,SAAS,EAAE,QAAQ,OAAO;CAE1B,OAAO;EAAE,4BAA4B;EAAS,uBAAuB;EAAS,uBAAuB;CAAQ;AAC/G"}
@@ -0,0 +1,5 @@
1
+ export { affirm, type Affirm } from './affirm.js';
2
+ export { AffirmError } from './core/errors.js';
3
+ export type { AffirmFailure, AffirmReport } from './core/report.js';
4
+ export type { AffirmParams } from './types/params.js';
5
+ export type { Affirmed } from './types/affirmed.js';