1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 17:34:36 +00:00
Files
lint/src/format/formatProject.ts

19 lines
685 B
TypeScript

import { lintFolder } from '../lint/lintFolder'
import { FormatResult } from '../types/FormatResult'
import { getProjectRoot } from '../utils/getProjectRoot'
import { formatFolder } from './formatFolder'
/**
* Automatically formats all SAS files in the current project.
* @returns {Promise<FormatResult>} Resolves successfully when all SAS files in the current project have been formatted.
*/
export const formatProject = async (): Promise<FormatResult> => {
const projectRoot =
(await getProjectRoot()) || process.projectDir || process.currentDir
if (!projectRoot) {
throw new Error('SASjs Project Root was not found.')
}
return await formatFolder(projectRoot)
}