Skip to content

Commit

Permalink
refactor(ManifestLinter.ts): Fix ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
maxreichmann committed Mar 19, 2024
1 parent 58ec8f9 commit ea5321c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/linter/json/ManifestLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface locType {
pos: number;
}

const deprecatedLibraries: Array<string> = [
const deprecatedLibraries: string[] = [
"sap.ca.scfld.md",
"sap.ca.ui",
"sap.dragonfly",
Expand All @@ -35,13 +35,12 @@ const deprecatedLibraries: Array<string> = [
"sap.zen.crosstab",
];

const deprecatedComponents: Array<string> = [
const deprecatedComponents: string[] = [
"sap.zen.dsh.fioriwrapper",
];

export type jsonMapPointers = Record<string, {key: locType; keyEnd: locType; value: locType; valueEnd: locType}>;


export interface jsonSourceMapType {
data: SAPJSONSchemaForWebApplicationManifestFile;
pointers: jsonMapPointers;
Expand Down Expand Up @@ -75,9 +74,9 @@ export default class ManifestLinter {
#analyzeManifest(manifest: SAPJSONSchemaForWebApplicationManifestFile) {
const {resources, models, dependencies} = (manifest["sap.ui5"] ?? {} as JSONSchemaForSAPUI5Namespace);
const {dataSources} = (manifest["sap.app"] ?? {} as JSONSchemaForSAPAPPNamespace);

// Detect deprecated libraries:
const libKeys: string[] = (dependencies?.libs && Object.keys(dependencies.libs)) || [];
const libKeys: string[] = (dependencies?.libs && Object.keys(dependencies.libs)) ?? [];
libKeys.forEach((libKey: string) => {
if (deprecatedLibraries.includes(libKey)) {
this.#reporter?.addMessage({
Expand All @@ -90,7 +89,7 @@ export default class ManifestLinter {
});

// Detect deprecated components:
const componentKeys: string[] = (dependencies?.components && Object.keys(dependencies.components)) || [];
const componentKeys: string[] = (dependencies?.components && Object.keys(dependencies.components)) ?? [];
componentKeys.forEach((componentKey: string) => {
if (deprecatedComponents.includes(componentKey)) {
this.#reporter?.addMessage({
Expand Down

0 comments on commit ea5321c

Please sign in to comment.