Skip to content

Commit

Permalink
refactor: Update messages
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Dec 17, 2024
1 parent a36d42c commit d05b6e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/linter/html/transpiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function detectTestStarter(resourcePath: ResourcePath, tag: Tag, context: Linter
});

if (!hasCreateSuite) {
context.addLintingMessage(resourcePath, MESSAGE.PREFER_TEST_STARTER, {message: "Prefer test starter"});
context.addLintingMessage(resourcePath, MESSAGE.PREFER_TEST_STARTER, undefined as never);
}
} else if (resourcePath.includes("qunit.html")) {
// resources/sap/ui/test/starter/runTest.js
Expand All @@ -71,7 +71,7 @@ function detectTestStarter(resourcePath: ResourcePath, tag: Tag, context: Linter
attr.value.value.includes("resources/sap/ui/test/starter/runTest.js");
});
if (!hasRunTest) {
context.addLintingMessage(resourcePath, MESSAGE.PREFER_TEST_STARTER, {message: "Prefer test starter"});
context.addLintingMessage(resourcePath, MESSAGE.PREFER_TEST_STARTER, undefined as never);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/linter/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,9 @@ export const MESSAGE_INFO = {
severity: LintMessageSeverity.Warning,
ruleId: RULES["prefer-test-starter"],

message: ({message}: {message?: string}) => message,
details: () => undefined,
message: () => "To save boilerplate code and ensure compliance with UI5 2.x best practices," +
" please migrate to the Test Starter concept",
details: () => "{@link topic:032be2cb2e1d4115af20862673bedcdb Test Starter}",
},

} as const;
8 changes: 2 additions & 6 deletions src/linter/ui5Types/SourceFileLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,7 @@ export default class SourceFileLinter {
this.#analyzeThemingSetTheme(node);
} else if (this.sourceFile.fileName.includes(".qunit.js") &&
symbolName === "ready" && moduleName === "sap/ui/core/Core") {
this.#reporter.addMessage(MESSAGE.PREFER_TEST_STARTER, {
message: "Prefer test starter",
}, node);
this.#reporter.addMessage(MESSAGE.PREFER_TEST_STARTER, node);
}
}

Expand Down Expand Up @@ -840,9 +838,7 @@ export default class SourceFileLinter {
}, reportNode);

if (propName === "attachInit" && this.sourceFile.fileName.includes(".qunit.js")) {
this.#reporter.addMessage(MESSAGE.PREFER_TEST_STARTER, {
message: "Prefer test starter",
}, reportNode);
this.#reporter.addMessage(MESSAGE.PREFER_TEST_STARTER, reportNode);
}
}

Expand Down

0 comments on commit d05b6e6

Please sign in to comment.