mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
chore: quick fix
This commit is contained in:
@@ -30,7 +30,7 @@ export const processLine = (config: LintConfig, line: string): string => {
|
||||
config.lineLintRules
|
||||
.filter((r) => !!r.fix)
|
||||
.forEach((rule) => {
|
||||
processedLine = rule.fix!(line, config)
|
||||
processedLine = rule.fix!(processedLine, config)
|
||||
})
|
||||
|
||||
return processedLine
|
||||
|
||||
@@ -22,6 +22,7 @@ export const DefaultLintConfiguration = {
|
||||
noNestedMacros: true,
|
||||
hasMacroParentheses: true,
|
||||
strictMacroDefinition: true,
|
||||
noGremlins: true,
|
||||
defaultHeader: getDefaultHeader()
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,19 @@ import { LineEndings } from '../types/LineEndings'
|
||||
*/
|
||||
export const splitText = (text: string, config: LintConfig): string[] => {
|
||||
if (!text) return []
|
||||
|
||||
const expectedLineEndings =
|
||||
config.lineEndings === LineEndings.LF ? '\n' : '\r\n'
|
||||
|
||||
const incorrectLineEndings = expectedLineEndings === '\n' ? '\r\n' : '\n'
|
||||
return text
|
||||
.replace(new RegExp(incorrectLineEndings, 'g'), expectedLineEndings)
|
||||
.split(expectedLineEndings)
|
||||
|
||||
text = text.replace(
|
||||
new RegExp(incorrectLineEndings, 'g'),
|
||||
expectedLineEndings
|
||||
)
|
||||
|
||||
// splitting text on '\r\n' was causing some problem
|
||||
// as it was retaining carriage return at the end of each line
|
||||
// so, removed the carriage returns from text and splitted on line feed (lf)
|
||||
return text.replace(/\r/g, '').split(/\n/)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user