1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-10 14:00:05 +00:00

fix: comments within/outside the statement

This commit is contained in:
Saad Jutt
2021-05-20 22:41:16 +05:00
parent 482ecec150
commit d7721f8e5e
2 changed files with 21 additions and 0 deletions

View File

@@ -17,6 +17,18 @@ export const trimComments = (
} else {
return { statement: '', commentStarted: true }
}
} else if (trimmed.includes('/*')) {
const statementBeforeCommentStarts = trimmed.slice(0, trimmed.indexOf('/*'))
const remainingStatement = trimmed.slice(
trimmed.indexOf('/*'),
trimmed.length
)
const result = trimComments(remainingStatement, false)
return {
statement: statementBeforeCommentStarts + result.statement,
commentStarted: result.commentStarted
}
}
return { statement: trimmed, commentStarted: false }
}