Skip to content

Commit

Permalink
feat: Detect attachInit or ready in *.qunit.js
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Dec 17, 2024
1 parent 6af9955 commit a36d42c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/linter/ui5Types/SourceFileLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,11 @@ export default class SourceFileLinter {
this.#analyzeMobileInit(node);
} else if (symbolName === "setTheme" && moduleName === "sap/ui/core/Theming") {
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);
}
}

Expand Down Expand Up @@ -826,11 +831,19 @@ export default class SourceFileLinter {
}
}

const propName = getPropertyName(reportNode);

this.#reporter.addMessage(MESSAGE.DEPRECATED_FUNCTION_CALL, {
functionName: getPropertyName(reportNode),
functionName: propName,
additionalMessage,
details: deprecationInfo.messageDetails,
}, reportNode);

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

getSymbolModuleDeclaration(symbol: ts.Symbol) {
Expand Down

0 comments on commit a36d42c

Please sign in to comment.