1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 17:34:36 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Allan Bowe
9623828fc8 Merge pull request #180 from sasjs/quick-fix
feat: add configuration as an optional argument for formatText
2022-11-08 14:48:44 +00:00
debeff7929 fix: updated sasjslint-schema.json 2022-11-08 19:43:18 +05:00
c210699954 feat: add configuration as an optional argument for formatText 2022-11-08 19:33:21 +05:00
3 changed files with 14 additions and 7 deletions

View File

@@ -7,6 +7,7 @@
"default": {
"noEncodedPasswords": true,
"hasDoxygenHeader": true,
"defaultHeader": "/**{lineEnding} @file{lineEnding} @brief <Your brief here>{lineEnding} <h4> SAS Macros </h4>{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 <Your brief here>{lineEnding} <h4> SAS Macros </h4>{lineEnding}**/",
"examples": []
},
"hasMacroNameInMend": {
"$id": "#/properties/hasMacroNameInMend",
"type": "boolean",

View File

@@ -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)
}

View File

@@ -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