mirror of
https://github.com/sasjs/lint.git
synced 2026-01-13 15:20:05 +00:00
feat: new rules noNestedMacros & hasMacroParentheses
This commit is contained in:
19
src/utils/trimComments.ts
Normal file
19
src/utils/trimComments.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export const trimComments = (
|
||||
statement: string,
|
||||
commentStarted: boolean = false
|
||||
): { statement: string; commentStarted: boolean } => {
|
||||
let trimmed = statement.trim()
|
||||
|
||||
if (commentStarted || trimmed.startsWith('/*')) {
|
||||
const parts = trimmed.split('*/')
|
||||
if (parts.length > 1) {
|
||||
return {
|
||||
statement: (parts.pop() as string).trim(),
|
||||
commentStarted: false
|
||||
}
|
||||
} else {
|
||||
return { statement: '', commentStarted: true }
|
||||
}
|
||||
}
|
||||
return { statement: trimmed, commentStarted: false }
|
||||
}
|
||||
Reference in New Issue
Block a user