diff --git a/sasjslint-schema.json b/sasjslint-schema.json index d52669f..f5cac94 100644 --- a/sasjslint-schema.json +++ b/sasjslint-schema.json @@ -7,6 +7,7 @@ "default": { "noEncodedPasswords": true, "hasDoxygenHeader": true, + "defaultHeader": "/**{lineEnding} @file{lineEnding} @brief {lineEnding}

SAS Macros

{lineEnding}**/", "hasMacroNameInMend": false, "hasMacroParentheses": true, "indentationMultiple": 2, @@ -18,10 +19,7 @@ "noTrailingSpaces": true, "lineEndings": "lf", "strictMacroDefinition": true, - "ignoreList": [ - "sajsbuild", - "sasjsresults" - ] + "ignoreList": ["sajsbuild", "sasjsresults"] }, "examples": [ { @@ -58,6 +56,14 @@ "default": true, "examples": [true, false] }, + "defaultHeader": { + "$id": "#/properties/defaultHeader", + "type": "boolean", + "title": "defaultHeader", + "description": "This sets the default program header - applies when a SAS program does NOT begin with `/**`.", + "default": "/**{lineEnding} @file{lineEnding} @brief {lineEnding}

SAS Macros

{lineEnding}**/", + "examples": [] + }, "hasMacroNameInMend": { "$id": "#/properties/hasMacroNameInMend", "type": "boolean", diff --git a/src/format/formatText.ts b/src/format/formatText.ts index b33807e..2b666cf 100644 --- a/src/format/formatText.ts +++ b/src/format/formatText.ts @@ -1,7 +1,8 @@ +import { LintConfig } from '../types' import { getLintConfig } from '../utils' import { processText } from './shared' -export const formatText = async (text: string) => { - const config = await getLintConfig() +export const formatText = async (text: string, configuration?: LintConfig) => { + const config = configuration || (await getLintConfig()) return processText(text, config) } diff --git a/src/format/shared.ts b/src/format/shared.ts index 3918987..76702f1 100644 --- a/src/format/shared.ts +++ b/src/format/shared.ts @@ -30,7 +30,7 @@ export const processLine = (config: LintConfig, line: string): string => { config.lineLintRules .filter((r) => !!r.fix) .forEach((rule) => { - processedLine = rule.fix!(line) + processedLine = rule.fix!(line, config) }) return processedLine