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,
|
lookupName,
|
||||||
registryUrl,
|
registryUrl,
|
||||||
}: GetReleasesConfig): Promise<ReleaseResult | null> {
|
}: 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}`;
|
const pkgUrl = `${registryUrl}api/packages/${lookupName}`;
|
||||||
|
|
||||||
let raw: HttpResponse<DartResult> = null;
|
let raw: HttpResponse<DartResult> | null = null;
|
||||||
try {
|
try {
|
||||||
raw = await this.http.getJson<DartResult>(pkgUrl);
|
raw = await this.http.getJson<DartResult>(pkgUrl);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -31,13 +35,12 @@ export class DartDatasource extends Datasource {
|
||||||
const body = raw?.body;
|
const body = raw?.body;
|
||||||
if (body) {
|
if (body) {
|
||||||
const { versions, latest } = body;
|
const { versions, latest } = body;
|
||||||
if (versions && latest) {
|
const releases = versions?.map(({ version, published }) => ({
|
||||||
result = {
|
|
||||||
releases: body.versions.map(({ version, published }) => ({
|
|
||||||
version,
|
version,
|
||||||
releaseTimestamp: published,
|
releaseTimestamp: published,
|
||||||
})),
|
}));
|
||||||
};
|
if (releases && latest) {
|
||||||
|
result = { releases };
|
||||||
|
|
||||||
const pubspec = latest.pubspec;
|
const pubspec = latest.pubspec;
|
||||||
if (pubspec) {
|
if (pubspec) {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
"lib/datasource/**/types.ts",
|
"lib/datasource/**/types.ts",
|
||||||
"lib/datasource/adoptium-java",
|
"lib/datasource/adoptium-java",
|
||||||
"lib/datasource/artifactory",
|
"lib/datasource/artifactory",
|
||||||
|
"lib/datasource/dart",
|
||||||
"lib/datasource/gitlab-tags/util.ts",
|
"lib/datasource/gitlab-tags/util.ts",
|
||||||
"lib/datasource/helm/common.ts",
|
"lib/datasource/helm/common.ts",
|
||||||
"lib/datasource/metadata.ts",
|
"lib/datasource/metadata.ts",
|
||||||
|
@ -74,6 +75,7 @@
|
||||||
"lib/constants/platform.spec.ts",
|
"lib/constants/platform.spec.ts",
|
||||||
"lib/datasource/adoptium-java/**/*.spec.ts",
|
"lib/datasource/adoptium-java/**/*.spec.ts",
|
||||||
"lib/datasource/artifactory/**/*.spec.ts",
|
"lib/datasource/artifactory/**/*.spec.ts",
|
||||||
|
"lib/datasource/dart/**/*.spec.ts",
|
||||||
"lib/datasource/docker/common.ts",
|
"lib/datasource/docker/common.ts",
|
||||||
"lib/datasource/github-releases/common.ts",
|
"lib/datasource/github-releases/common.ts",
|
||||||
"lib/datasource/go/common.ts",
|
"lib/datasource/go/common.ts",
|
||||||
|
|
Loading…
Reference in a new issue