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

feat: customise the defaultHeader

This commit is contained in:
2022-11-07 16:50:35 +05:00
parent 1d821db934
commit a3bade0a5a
4 changed files with 15 additions and 5 deletions

View File

@@ -3,8 +3,7 @@ import { LineEndings } from '../../types/LineEndings'
import { FileLintRule } from '../../types/LintRule'
import { LintRuleType } from '../../types/LintRuleType'
import { Severity } from '../../types/Severity'
const DoxygenHeader = `/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding} <h4> SAS Macros </h4>{lineEnding}**/`
import { DefaultLintConfiguration } from '../../utils/getLintConfig'
const name = 'hasDoxygenHeader'
const description =
@@ -61,10 +60,11 @@ const fix = (value: string, config?: LintConfig): string => {
} else if (result[0].message == messageForSingleAsterisk)
return value.replace('/*', '/**')
config = config || new LintConfig(DefaultLintConfiguration)
const lineEndingConfig = config?.lineEndings || LineEndings.LF
const lineEnding = lineEndingConfig === LineEndings.LF ? '\n' : '\r\n'
return `${DoxygenHeader.replace(
return `${config?.defaultHeader.replace(
/{lineEnding}/g,
lineEnding
)}${lineEnding}${value}`