mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
24 lines
530 B
TypeScript
24 lines
530 B
TypeScript
import { LintConfig } from '../types'
|
|
import { splitText } from './splitText'
|
|
|
|
/**
|
|
* This function returns the number of lines the header spans upon.
|
|
* The file must start with "/*" and the header will finish with ⇙
|
|
*/
|
|
export const getHeaderLinesCount = (text: string, config: LintConfig) => {
|
|
let count = 0
|
|
|
|
if (text.trimStart().startsWith('/*')) {
|
|
const lines = splitText(text, config)
|
|
|
|
for (const line of lines) {
|
|
count++
|
|
if (line.match(/\*\//)) {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
return count
|
|
}
|