mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
20 lines
725 B
TypeScript
20 lines
725 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.currentDir
|
|
if (!projectRoot) {
|
|
throw new Error('SASjs Project Root was not found.')
|
|
}
|
|
|
|
console.info(`Formatting all .sas files under ${projectRoot}`)
|
|
|
|
return await formatFolder(projectRoot)
|
|
}
|