1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-11 14:30:04 +00:00

chore(*): add PR template, add TSDoc comments

This commit is contained in:
Krishna Acondy
2021-03-22 20:36:19 +00:00
parent bf23963127
commit da528bb031
12 changed files with 77 additions and 1 deletions

View File

@@ -2,11 +2,21 @@ import { Diagnostic } from './types/Diagnostic'
import { LintConfig } from './types/LintConfig'
import { getLintConfig } from './utils/getLintConfig'
/**
* Analyses and produces a set of diagnostics for the given text content.
* @param {string} text - the text content to be linted.
* @returns {Diagnostic[]} array of diagnostic objects, each containing a warning, line number and column number.
*/
export const lint = async (text: string) => {
const config = await getLintConfig()
return processText(text, config)
}
/**
* 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): string[] => {
if (!text) return []
return text.replace(/\r\n/g, '\n').split('\n')