mirror of
https://github.com/sasjs/lint.git
synced 2026-01-08 21:10:05 +00:00
feat(format): add the ability to format files, folders and projects
This commit is contained in:
15
src/format/formatProject.ts
Normal file
15
src/format/formatProject.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { getProjectRoot } from '../utils/getProjectRoot'
|
||||
import { formatFolder } from './formatFolder'
|
||||
|
||||
/**
|
||||
* Automatically formats all SAS files in the current project.
|
||||
* @returns {Promise<void>} Resolves successfully when all SAS files in the current project have been formatted.
|
||||
*/
|
||||
export const formatProject = async () => {
|
||||
const projectRoot =
|
||||
(await getProjectRoot()) || process.projectDir || process.currentDir
|
||||
if (!projectRoot) {
|
||||
throw new Error('SASjs Project Root was not found.')
|
||||
}
|
||||
return await formatFolder(projectRoot)
|
||||
}
|
||||
Reference in New Issue
Block a user