Files
renovate/lib/modules/datasource/npm/index.ts
Sebastian Poxhofer a473e73b3e fix(linters): forbid inert counts in v8 coverage-ignore comments (#45287)
Adds a custom oxlint rule renovate/v8-ignore-no-count that flags the
count form '/* v8 ignore next <N> */'. The count is not honored by
vitest's ast-v8-to-istanbul hint parser, which captures only the
keyword (if/else/next/file); 'next' always exempts exactly the next
AST node. Trailing counts therefore suggest a line range that is never
applied and mislead readers.

The rule is autofixable (drops the count, preserving actual behavior)
and has been applied to all existing occurrences.
2026-08-22 11:25:31 +00:00

44 lines
1.3 KiB
TypeScript

import * as npmVersioning from '../../versioning/npm/index.ts';
import { Datasource } from '../datasource.ts';
import type { GetReleasesConfig, ReleaseResult } from '../types.ts';
import { defaultRegistryUrl } from './common.ts';
import { getDependency } from './get.ts';
export { setNpmrc } from './npmrc.ts';
export class NpmDatasource extends Datasource {
static readonly id = 'npm';
override readonly customRegistrySupport = true;
override readonly registryStrategy = 'first';
override readonly defaultVersioning = npmVersioning.id;
override readonly defaultRegistryUrls = [defaultRegistryUrl];
override readonly releaseTimestampSupport = true;
override readonly releaseTimestampNote =
'The release timestamp is determined from the `time` field in the results.';
override readonly sourceUrlSupport = 'release';
override readonly sourceUrlNote =
'The source URL is determined from the `repository` field in the results.';
constructor() {
super(NpmDatasource.id);
}
async getReleases({
packageName,
registryUrl,
}: GetReleasesConfig): Promise<ReleaseResult | null> {
/* v8 ignore next -- should never happen */
if (!registryUrl) {
return null;
}
const res = await getDependency(this.http, registryUrl, packageName);
return res;
}
}