Skip to content

Commit

Permalink
fix: Eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Apr 4, 2024
1 parent b4d8048 commit 830374d
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions scripts/metadataProvider/createPseudoModulesInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ async function downloadAPIJsons(sapui5Version: string) {
async function transformFiles() {
const metadataProvider = new MetadataProvider();
await metadataProvider.init(RAW_API_JSON_FILES_FOLDER);

const {enums} = metadataProvider.getModel();

const groupedEnums = Object.keys(enums).reduce((acc: Record<string, UI5Enum[]>, enumKey: string) => {
const curEnum = enums[enumKey];

acc[curEnum.library] = acc[curEnum.library] ?? [];
acc[curEnum.library].push(curEnum);

return acc;
}, Object.create(null));

Check failure on line 39 in scripts/metadataProvider/createPseudoModulesInfo.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Unsafe argument of type `any` assigned to a parameter of type `Record<string, UI5Enum[]>`

Expand All @@ -43,16 +43,16 @@ async function transformFiles() {

async function addOverrides(enums: Record<string, UI5Enum[]>) {
const indexFilesImports: string[] = [];
const buildJSDoc = (enumEntry: UI5Enum, indent: string = "") => {
const buildJSDoc = (enumEntry: UI5Enum, indent = "") => {
const jsDocBuilder: string[] = [`${indent}/**`];

if (enumEntry.description) {
jsDocBuilder.push(`${indent} * ${enumEntry.description.replaceAll("\n", "\n" + indent + " * ")}`);
jsDocBuilder.push(`${indent} *`);
}

if (enumEntry.experimentalInfo) {
let experimental: string = `${indent} * @experimental`;
let experimental = `${indent} * @experimental`;
if (enumEntry.experimentalInfo.since) {
experimental += ` (since ${enumEntry.experimentalInfo.since})`;
}
Expand All @@ -61,9 +61,9 @@ async function addOverrides(enums: Record<string, UI5Enum[]>) {
}
jsDocBuilder.push(experimental);
}

if (enumEntry.deprecatedInfo) {
let deprecated: string = `${indent} * @deprecated`;
let deprecated = `${indent} * @deprecated`;
if (enumEntry.deprecatedInfo.since) {
deprecated += ` (since ${enumEntry.deprecatedInfo.since})`;
}
Expand All @@ -81,15 +81,15 @@ async function addOverrides(enums: Record<string, UI5Enum[]>) {
jsDocBuilder.push(`${indent} * @since ${enumEntry.since}`);
}
jsDocBuilder.push(`${indent}*/`);

return jsDocBuilder.join("\n");
}
};

Object.keys(enums).forEach(async (libName) => {

Check failure on line 88 in scripts/metadataProvider/createPseudoModulesInfo.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Promise returned in function argument where a void return was expected
const enumEntries = enums[libName];

let stringBuilder: string[] = [
`declare module "${libName.replaceAll(".", "/")}/library" {`
const stringBuilder: string[] = [
`declare module "${libName.replaceAll(".", "/")}/library" {`,
];
enumEntries.forEach((enumEntry) => {
if (enumEntry.kind !== "UI5Enum") {
Expand All @@ -106,15 +106,15 @@ async function addOverrides(enums: Record<string, UI5Enum[]>) {

return stringBuilder.join("\n");
});
stringBuilder.push(`}`)
stringBuilder.push(`}`);

indexFilesImports.push(`import "./${libName}";`);
await writeFile(
new URL(`../../resources/overrides/library/${libName}.d.ts`, import.meta.url),
stringBuilder.join("\n")
);
});

await writeFile(
new URL(`../../resources/overrides/library/index.d.ts`, import.meta.url),
indexFilesImports.join("\n")
Expand Down

0 comments on commit 830374d

Please sign in to comment.