1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-10 13:50:05 +00:00

chore(lint): fixed linting issues

This commit is contained in:
Yury Shkoda
2022-06-20 19:26:29 +03:00
parent 1596173dda
commit 489947bcae
59 changed files with 243 additions and 236 deletions

View File

@@ -22,12 +22,12 @@ export const convertToCSV = (
let invalidString = false
if (formats) {
headers = Object.keys(formats).map((key) => `${key}:${formats![key]}`)
headers = Object.keys(formats).map(key => `${key}:${formats![key]}`)
}
const headerFields = Object.keys(table[0])
headerFields.forEach((field) => {
headerFields.forEach(field => {
if (!formats || !Object.keys(formats).includes(field)) {
let hasNullOrNumber = false
let hasSpecialMissingString = false

View File

@@ -1,2 +1,2 @@
export const delay = (ms: number) =>
new Promise((resolve) => setTimeout(resolve, ms))
new Promise(resolve => setTimeout(resolve, ms))

View File

@@ -41,14 +41,13 @@ export const fetchLog = async (
const loglimit = end < 10000 ? end : 10000
do {
logger.info(
`Fetching logs from line no: ${start + 1} to ${
start + loglimit
} of ${end}.`
`Fetching logs from line no: ${start + 1} to ${start +
loglimit} of ${end}.`
)
const logChunkJson = await requestClient!
.get<any>(`${logUrl}?start=${start}&limit=${loglimit}`, accessToken)
.then((res: any) => res.result)
.catch((err) => {
.catch(err => {
throw prefixMessage(err, 'Error while getting log. ')
})

View File

@@ -11,7 +11,7 @@ const classes = {
}
export const openLoginPrompt = (): Promise<boolean> => {
return new Promise(async (resolve) => {
return new Promise(async resolve => {
const style = document.createElement('style')
style.id = domIDs.styles
style.innerText = cssContent
@@ -60,7 +60,7 @@ export const openLoginPrompt = (): Promise<boolean> => {
})
}
const closeLoginPrompt = () => {
Object.values(domIDs).forEach((id) => {
Object.values(domIDs).forEach(id => {
const elem = document.getElementById(id)
elem?.parentNode?.removeChild(elem)
})

View File

@@ -2,7 +2,7 @@ export const parseSasViyaLog = (logResponse: { items: any[] }) => {
let log
try {
log = logResponse.items
? logResponse.items.map((i) => i.line).join('\n')
? logResponse.items.map(i => i.line).join('\n')
: JSON.stringify(logResponse)
} catch (e) {
console.error('An error has occurred while parsing the log response', e)

View File

@@ -1,6 +1,10 @@
export const parseSourceCode = (log: string): string => {
const isSourceCodeLine = (line: string) =>
line.trim().substring(0, 10).trimStart().match(/^\d/)
line
.trim()
.substring(0, 10)
.trimStart()
.match(/^\d/)
const logLines = log.split('\n').filter(isSourceCodeLine)
return logLines.join('\r\n')
}