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

feat: add a new config maxHeaderLineLength

This commit is contained in:
2023-01-10 14:48:18 +05:00
parent 4cb2fe8a69
commit b6e9ee0825
10 changed files with 107 additions and 10 deletions

View File

@@ -0,0 +1,25 @@
import { LintConfig } from '../types'
import { splitText } from './splitText'
/**
* This funtion returns the number of lines header spans upon.
*/
export const getHeaderLinesCount = (text: string, config: LintConfig) => {
text = text.replace('/*', '/**')
text = text.replace('*/', '**/')
let count = 0
if (text.trimStart().startsWith('/**')) {
const lines = splitText(text, config)
for (const line of lines) {
count++
if (line.match(/\*\*\//)) {
break
}
}
}
return count
}