Skip to content

Commit

Permalink
feat: look for global .sasjslint file before using default setting
Browse files Browse the repository at this point in the history
  • Loading branch information
sabhas committed Apr 12, 2023
1 parent 93e027b commit 448a6c9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/utils/getLintConfig.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import * as path from 'path'
import * as os from 'os'
import { workspace } from 'vscode'
import { LintConfig, DefaultLintConfiguration } from '@sasjs/lint'
import { readFile } from './file'
import { fileExists } from '@sasjs/utils'

export const getLintConfig = async () => {
let config = DefaultLintConfiguration

const lintConfigPath = path.join(process.projectDir, '.sasjslint')
let lintConfigPath = path.join(os.homedir(), '.sasjslint')

if (await fileExists(path.join(process.projectDir, '.sasjslint'))) {
lintConfigPath = path.join(process.projectDir, '.sasjslint')
}

await readFile(lintConfigPath)
.then((content) => {
config = { ...config, ...JSON.parse(content) }
config = JSON.parse(content)
})
.catch(() => {
const extConfig = workspace.getConfiguration('sasjs-for-vscode')
Expand Down

0 comments on commit 448a6c9

Please sign in to comment.