mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
refactor(datasource/dart): Enable strict null checks (#13981)
* refactor(datasource/dart): Enable strict null checks * Fix coverage
This commit is contained in:
parent
99c0e9cfd0
commit
8e3478e69a
2 changed files with 14 additions and 9 deletions
|
@ -18,10 +18,14 @@ export class DartDatasource extends Datasource {
|
|||
lookupName,
|
||||
registryUrl,
|
||||
}: GetReleasesConfig): Promise<ReleaseResult | null> {
|
||||
let result: ReleaseResult = null;
|
||||
// istanbul ignore if
|
||||
if (!registryUrl) {
|
||||
return null;
|
||||
}
|
||||
let result: ReleaseResult | null = null;
|
||||
const pkgUrl = `${registryUrl}api/packages/${lookupName}`;
|
||||
|
||||
let raw: HttpResponse<DartResult> = null;
|
||||
let raw: HttpResponse<DartResult> | null = null;
|
||||
try {
|
||||
raw = await this.http.getJson<DartResult>(pkgUrl);
|
||||
} catch (err) {
|
||||
|
@ -31,13 +35,12 @@ export class DartDatasource extends Datasource {
|
|||
const body = raw?.body;
|
||||
if (body) {
|
||||
const { versions, latest } = body;
|
||||
if (versions && latest) {
|
||||
result = {
|
||||
releases: body.versions.map(({ version, published }) => ({
|
||||
version,
|
||||
releaseTimestamp: published,
|
||||
})),
|
||||
};
|
||||
const releases = versions?.map(({ version, published }) => ({
|
||||
version,
|
||||
releaseTimestamp: published,
|
||||
}));
|
||||
if (releases && latest) {
|
||||
result = { releases };
|
||||
|
||||
const pubspec = latest.pubspec;
|
||||
if (pubspec) {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"lib/datasource/**/types.ts",
|
||||
"lib/datasource/adoptium-java",
|
||||
"lib/datasource/artifactory",
|
||||
"lib/datasource/dart",
|
||||
"lib/datasource/gitlab-tags/util.ts",
|
||||
"lib/datasource/helm/common.ts",
|
||||
"lib/datasource/metadata.ts",
|
||||
|
@ -74,6 +75,7 @@
|
|||
"lib/constants/platform.spec.ts",
|
||||
"lib/datasource/adoptium-java/**/*.spec.ts",
|
||||
"lib/datasource/artifactory/**/*.spec.ts",
|
||||
"lib/datasource/dart/**/*.spec.ts",
|
||||
"lib/datasource/docker/common.ts",
|
||||
"lib/datasource/github-releases/common.ts",
|
||||
"lib/datasource/go/common.ts",
|
||||
|
|
Loading…
Reference in a new issue