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

feat: add configuration as an optional argument for formatText

This commit is contained in:
2022-11-08 19:33:21 +05:00
parent cee30d0030
commit c210699954
2 changed files with 4 additions and 3 deletions

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