sonarsource.sonarlint-vscode v1.20.1
https://rules.sonarsource.com/typescript/RSPEC-1874
export interface LanguageService {
/**
* @deprecated Use getEncodedSyntacticClassifications instead.
*/
getSyntacticClassifications(fileName: any, span: any): any[];
}
declare const getLanguageService: () => LanguageService;
const syntacticClassifications = getLanguageService().getSyntacticClassifications(
"file",
"span"
); // Noncompliant
No error, but it should has a error.
Hello, welcome to the community! And thank you for your question.
This rule is not enabled by default.
You can enable it in the UI:
Open the “SonarLint Rules” view
In the “…” menu, use the “Find Rule By Key” action
Input typescript:S1874
Use the “ ” icon in the view to enable the rule
See illustration of the process below:
Additionally, you can put the block below in your user settings to enable this rule:
"sonarlint.rules": {
"typescript:S1874": {
"level": "on"
}
}
Finally, if you are using SonarCloud or a SonarQube server, you can enable this rule in a quality profile on the server, and use SonarLint’s connected mode to synchronize enabled rules.
2 Likes
system
(system)
Closed
March 24, 2021, 9:37am
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.