From 8fc3c399939a4f25568bc2c1bddbe506b2971b43 Mon Sep 17 00:00:00 2001 From: Krishna Acondy Date: Fri, 26 Mar 2021 09:13:07 +0000 Subject: [PATCH] chore(*): export utils modules and default config --- src/index.ts | 1 + src/utils/getLintConfig.ts | 8 ++++++-- src/utils/index.ts | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/utils/index.ts diff --git a/src/index.ts b/src/index.ts index b7c0c5c..a45d40e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,3 @@ export { lintText, lintFile } from './lint' export * from './types' +export * from './utils' diff --git a/src/utils/getLintConfig.ts b/src/utils/getLintConfig.ts index 435f800..be39867 100644 --- a/src/utils/getLintConfig.ts +++ b/src/utils/getLintConfig.ts @@ -3,7 +3,10 @@ import { LintConfig } from '../types/LintConfig' import { readFile } from '@sasjs/utils/file' import { getProjectRoot } from './getProjectRoot' -const defaultConfiguration = { +/** + * Default configuration that is used when a .sasjslint file is not found + */ +export const DefaultLintConfiguration = { noTrailingSpaces: true, noEncodedPasswords: true, hasDoxygenHeader: true, @@ -12,6 +15,7 @@ const defaultConfiguration = { maxLineLength: 80, noTabIndentation: true } + /** * Fetches the config from the .sasjslint file and creates a LintConfig object. * Returns the default configuration when a .sasjslint file is unavailable. @@ -23,7 +27,7 @@ export async function getLintConfig(): Promise { path.join(projectRoot, '.sasjslint') ).catch((_) => { console.warn('Unable to load .sasjslint file. Using default configuration.') - return JSON.stringify(defaultConfiguration) + return JSON.stringify(DefaultLintConfiguration) }) return new LintConfig(JSON.parse(configuration)) } diff --git a/src/utils/index.ts b/src/utils/index.ts new file mode 100644 index 0000000..4bb8061 --- /dev/null +++ b/src/utils/index.ts @@ -0,0 +1,2 @@ +export * from './getLintConfig' +export * from './getProjectRoot'