interface AstNode { readonly type: string; [key: string]: any; } /** * ESLint rule definition for no-non-array-iterable-spread. */ export interface UtilNoNonArrayIterableSpreadRuleDefinition { readonly meta: { readonly type: 'problem'; readonly fixable: 'code'; readonly docs: { readonly description: string; readonly recommended: boolean; }; readonly messages: { readonly useArrayFrom: string; readonly useArrayFromMixed: string; }; readonly schema: readonly object[]; }; create(context: { report: (descriptor: { node: AstNode; messageId: string; data?: Record; fix?: (fixer: AstNode) => AstNode | AstNode[]; }) => void; sourceCode: AstNode; }): Record void>; } /** * ESLint rule that flags spreading a NON-ARRAY iterable into an array literal — e.g. * `[...map.values()]`, `[...someSet]`, `[...'abc']` — and steers it to `Array.from(...)`. * * WHY THIS IS A CORRECTNESS RULE, not a style one. `@nx/webpack` hardcodes `jsc.loose: true` for * swc-loader with no `jsc.target`, so an app build downlevels to es5 in LOOSE mode. Loose mode * compiles `[...iterable]` to `[].concat(iterable)`, which is correct ONLY for arrays: * `Array.prototype.concat` does not consume an iterator, so a Map/Set iterator is appended as a * SINGLE ELEMENT instead of being spread. * * ```ts * [...new Map().values()] // source: [] * [].concat(new Map().values()) // bundle: [MapIterator {}] <- length 1 * ``` * * An EMPTY collection reporting one bogus element is the shape that bites. It silently corrupted * `HashSet.valuesArray()`, which made a published calendar emit an ICS RDATE built from a MapIterator * and throw `RangeError: Invalid time value` on every attempt for two days. * * Critically, this is INVISIBLE to source-mode testing: the library builds emit the correct * `_to_consumable_array` helper and vitest runs source, so only a bundled app ever reproduces it. A * lint rule is the only cheap guard. * * Scope is array literals only. A call spread (`f(...x)`) downlevels through `.apply()`, which does * consume an iterator, so it is left alone. * * The fix rewrites a sole-spread literal `[...x]` to `Array.from(x)` — a plain call no downlevel * transform rewrites. A mixed literal (`[a, ...x]`) is reported without a fix, since preserving order * there needs a restructure the author should choose. * * Requires type information — it no-ops in lint passes without it (no `projectService` / `project`). */ export declare const UTIL_NO_NON_ARRAY_ITERABLE_SPREAD_RULE: UtilNoNonArrayIterableSpreadRuleDefinition; export {};