Skip to content

Commit

Permalink
fix: Allow renderer v4
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Dec 11, 2024
1 parent 09141c0 commit 9d8e7e5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/linter/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ export function resolveReader({
// When we work with files paths we actually need to limit the result to those
// matches, instead of allowing all except XYZ
!isFileIncluded(resPath, minimatchPatterns, patternsMatch) :
isFileIncluded(resPath, minimatchPatterns, patternsMatch);
isFileIncluded(resPath, minimatchPatterns, patternsMatch);

Check failure on line 357 in src/linter/linter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 5 tabs but found 4
},
});
}
Expand Down
7 changes: 5 additions & 2 deletions src/linter/ui5Types/SourceFileLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,16 @@ export default class SourceFileLinter {
if (node && (ts.isObjectLiteralExpression(node) || ts.isVariableDeclaration(node))) {
const apiVersionNode = findApiVersionNode(node) as ts.PropertyAssignment | ts.NumericLiteral | undefined;

const availableApiVersions = ["2", "4"];
let nodeToHighlight: ts.PropertyAssignment | ts.PropertyDeclaration |
ts.VariableDeclaration | ts.ObjectLiteralExpression |
ts.NumericLiteral | undefined = undefined;
if (!apiVersionNode) { // No 'apiVersion' property
nodeToHighlight = node;
} else if ((ts.isNumericLiteral(apiVersionNode) && apiVersionNode.getText() !== "2") ||
(ts.isPropertyAssignment(apiVersionNode) && apiVersionNode.initializer.getText() !== "2")) {
} else if ((ts.isNumericLiteral(apiVersionNode) &&
!availableApiVersions.includes(apiVersionNode.getText())) ||
(ts.isPropertyAssignment(apiVersionNode) &&
!availableApiVersions.includes(apiVersionNode.initializer.getText()))) {
// String value would be "\"2\""
nodeToHighlight = apiVersionNode;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class ConfigManager {
// If it's an relative path, transform to POSIX format
const configFilePath = path.isAbsolute(this.#configFile) ?
this.#configFile :
this.#resolveModulePaths(this.#configFile);
this.#resolveModulePaths(this.#configFile);

Check failure on line 46 in src/utils/ConfigManager.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 5 tabs but found 4

({default: config} = await import(configFilePath) as {default: UI5LintConfigType});
} else {
Expand Down
10 changes: 1 addition & 9 deletions test/lib/linter/rules/snapshots/renderer.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ Generated by [AVA](https://avajs.dev).
},
{
coverageInfo: [],
errorCount: 3,
errorCount: 2,
fatalErrorCount: 0,
filePath: 'ControlRendererDeclaration_negative.js',
messages: [
Expand All @@ -441,14 +441,6 @@ Generated by [AVA](https://avajs.dev).
ruleId: 'no-deprecated-api',
severity: 2,
},
{
column: 4,
line: 52,
message: 'Use of deprecated renderer detected. Define explicitly the {apiVersion: 2} parameter in the renderer object',
messageDetails: '"Renderer Object (https://ui5.sap.com/#/topic/c9ab34570cc14ea5ab72a6d1a4a03e3f)",',
ruleId: 'no-deprecated-api',
severity: 2,
},
{
column: 2,
line: 4,
Expand Down
Binary file modified test/lib/linter/rules/snapshots/renderer.ts.snap
Binary file not shown.

0 comments on commit 9d8e7e5

Please sign in to comment.