1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-10 14:00:05 +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

@@ -3,6 +3,10 @@ import { LintConfig } from '../types/LintConfig'
import { readFile } from '@sasjs/utils/file'
import { getProjectRoot } from './getProjectRoot'
/**
* Fetches the config from the .sasjslint file and creates a LintConfig object.
* @returns {Promise<LintConfig>} resolves with an object representing the current lint configuration.
*/
export async function getLintConfig(): Promise<LintConfig> {
const projectRoot = await getProjectRoot()
const configuration = await readFile(path.join(projectRoot, '.sasjslint'))

View File

@@ -1,7 +1,12 @@
import path from 'path'
import { fileExists } from '@sasjs/utils/file'
export async function getProjectRoot() {
/**
* Returns the absolute path to the location of the .sasjslint file.
* Traverses the folder tree until the .sasjslint file is found.
* @returns {Promise<string>} the path to the folder containing the lint config.
*/
export async function getProjectRoot(): Promise<string> {
let root = ''
let rootFound = false
let i = 1