Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
teodora-sandu committed Jun 4, 2024
1 parent 6c18e7e commit 30a9514
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScriptLS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,19 @@
type: 'get';
};

type SuggestionMessage =
| OpenLocalMessage
| IgnoreIssueMessage
| SetSuggestionMessage
| GetSuggestionMessage
type SuggestionMessage = OpenLocalMessage | IgnoreIssueMessage | SetSuggestionMessage | GetSuggestionMessage;

const vscode = acquireVsCodeApi();

function sendMessage(message: SuggestionMessage) {
vscode.postMessage(message);
}

function navigateToIssue(_e: any, range: any) {
function navigateToIssue(_e: any, position: MarkerPosition) {
if (!suggestion) return;
const message: OpenLocalMessage = {
type: 'openLocal',
args: getSuggestionPosition(suggestion, range),
args: getSuggestionPosition(suggestion, position),

Check failure on line 84 in src/snyk/snykCode/views/suggestion/codeSuggestionWebviewScriptLS.ts

View workflow job for this annotation

GitHub Actions / Build and Test (ubuntu-latest)

Property 'suggestionUri' is missing in type '{ uri: string; rows: Point; cols: Point; }' but required in type '{ uri: string; cols: [number, number]; rows: [number, number]; suggestionUri: string; }'.
};

sendMessage(message);
Expand All @@ -110,27 +106,30 @@
sendMessage(message);
}

function getSuggestionPosition(suggestionParam: Suggestion, position?: { file: string; rows: any; cols: any }) {
function getSuggestionPosition(suggestionParam: Suggestion, position?: MarkerPosition) {
return {
uri: position?.file ?? suggestionParam.filePath,
rows: position ? position.rows : suggestionParam.rows,
cols: position ? position.cols : suggestionParam.cols,
suggestionUri: suggestionParam.filePath,
};
}
const dataFlows = document.getElementsByClassName('data-flow-clickable-row')
for(let i = 0; i < dataFlows.length; i++) {
dataFlows[i].addEventListener('click', (e) => {

const dataFlows = document.getElementsByClassName('data-flow-clickable-row');
for (let i = 0; i < dataFlows.length; i++) {
dataFlows[i].addEventListener('click', e => {
if (!suggestion) {
return;
}
const markers = suggestion.markers
const markers = suggestion.markers;
if (!markers) {
return;
}
navigateToIssue(e, { file: suggestion?.filePath, rows: markers[i]?.pos[0].rows, cols: markers[i].pos[0].cols } )
});
navigateToIssue(e, {
file: suggestion.filePath,
rows: markers[i].pos[0].rows,
cols: markers[i].pos[0].cols,
});
});
}
document.getElementById('ignore-line-issue')!.addEventListener('click', () => {
ignoreIssue(true);
Expand Down

0 comments on commit 30a9514

Please sign in to comment.