1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-17 09:10:06 +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 { getLintConfig } from '../utils'
import { processText } from './shared' import { processText } from './shared'
export const formatText = async (text: string) => { export const formatText = async (text: string, configuration?: LintConfig) => {
const config = await getLintConfig() const config = configuration || (await getLintConfig())
return processText(text, config) return processText(text, config)
} }

View File

@@ -30,7 +30,7 @@ export const processLine = (config: LintConfig, line: string): string => {
config.lineLintRules config.lineLintRules
.filter((r) => !!r.fix) .filter((r) => !!r.fix)
.forEach((rule) => { .forEach((rule) => {
processedLine = rule.fix!(line) processedLine = rule.fix!(line, config)
}) })
return processedLine return processedLine