mirror of
https://github.com/sasjs/lint.git
synced 2026-01-05 03:30:06 +00:00
Revert "feat(*): add line endings rule, add automatic formatting for fixable violations"
This reverts commit 33a57c3163.
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
import { LintConfig } from '../types/LintConfig'
|
||||
import { LineEndings } from '../types/LineEndings'
|
||||
|
||||
/**
|
||||
* Splits the given content into a list of lines, regardless of CRLF or LF line endings.
|
||||
* @param {string} text - the text content to be split into lines.
|
||||
* @returns {string[]} an array of lines from the given text
|
||||
*/
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user