mirror of
https://github.com/sasjs/lint.git
synced 2026-01-17 09:10:06 +00:00
chore: quick fix
This commit is contained in:
@@ -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, config)
|
processedLine = rule.fix!(processedLine, config)
|
||||||
})
|
})
|
||||||
|
|
||||||
return processedLine
|
return processedLine
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export const DefaultLintConfiguration = {
|
|||||||
noNestedMacros: true,
|
noNestedMacros: true,
|
||||||
hasMacroParentheses: true,
|
hasMacroParentheses: true,
|
||||||
strictMacroDefinition: true,
|
strictMacroDefinition: true,
|
||||||
|
noGremlins: true,
|
||||||
defaultHeader: getDefaultHeader()
|
defaultHeader: getDefaultHeader()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,19 @@ import { LineEndings } from '../types/LineEndings'
|
|||||||
*/
|
*/
|
||||||
export const splitText = (text: string, config: LintConfig): string[] => {
|
export const splitText = (text: string, config: LintConfig): string[] => {
|
||||||
if (!text) return []
|
if (!text) return []
|
||||||
|
|
||||||
const expectedLineEndings =
|
const expectedLineEndings =
|
||||||
config.lineEndings === LineEndings.LF ? '\n' : '\r\n'
|
config.lineEndings === LineEndings.LF ? '\n' : '\r\n'
|
||||||
|
|
||||||
const incorrectLineEndings = expectedLineEndings === '\n' ? '\r\n' : '\n'
|
const incorrectLineEndings = expectedLineEndings === '\n' ? '\r\n' : '\n'
|
||||||
return text
|
|
||||||
.replace(new RegExp(incorrectLineEndings, 'g'), expectedLineEndings)
|
text = text.replace(
|
||||||
.split(expectedLineEndings)
|
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