Skip to content

Commit

Permalink
refactor: Rename variable + Fix ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
maxreichmann committed Apr 9, 2024
1 parent f92674e commit 7604e74
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/linter/yaml/UI5YamlLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,27 @@ interface UI5YamlContentSchema { // extend for further detections
};
}

interface UI5YamlContentSchemaWithPosInfo extends DataWithPosition {
framework?: {
libraries?: {
name: string;
}[];
};
positionKey?: {
end: {
column: number;
line: number;
};
start: {
column: number;
line: number;
};
};
}

export default class UI5YamlLinter {
#content = "";
#fromYamlContent: DataWithPosition;
#yamlContentWithPosInfo: UI5YamlContentSchemaWithPosInfo = {};
#path = "";
#messages: LintMessage[] = [];
#coverageInfo: CoverageInfo[] = [];
Expand Down Expand Up @@ -78,7 +96,7 @@ export default class UI5YamlLinter {

#parseUI5Yaml(fileContent: string): UI5YamlContentSchema {
// Create JS object from YAML content with position information
this.#fromYamlContent = fromYaml(fileContent);
this.#yamlContentWithPosInfo = fromYaml(fileContent) as UI5YamlContentSchemaWithPosInfo;
// Convert YAML content to JS object
return yaml.load(fileContent) as UI5YamlContentSchema;
}
Expand All @@ -88,7 +106,7 @@ export default class UI5YamlLinter {
if (ui5YamlObject?.framework?.libraries?.length) {
ui5YamlObject.framework.libraries.forEach((lib, index: number) => {
if (deprecatedLibraries.includes(lib.name)) {
const positionInfo = getPosition(this.#fromYamlContent.framework.libraries[index]);
const positionInfo = getPosition(this.#yamlContentWithPosInfo.framework!.libraries![index]);
this.#messages.push({
ruleId: "ui5-linter-no-deprecated-api",
severity: LintMessageSeverity.Error,
Expand Down

0 comments on commit 7604e74

Please sign in to comment.