1
0
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:
Krishna Acondy
2021-04-19 20:46:38 +01:00
parent 0c22ade942
commit eb5a1bbbcb
32 changed files with 318 additions and 930 deletions

View File

@@ -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)
}