Skip to content

Commit

Permalink
chore: fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Nov 13, 2023
1 parent 691072a commit d88b541
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/lib/components/controls/createAutoScrollHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export function createAutoScrollHandler(scrollableElement: Element) {
return diff < 20
? AUTO_SCROLL_SPEED_SLOW
: diff < 50
? AUTO_SCROLL_SPEED_NORMAL
: AUTO_SCROLL_SPEED_FAST
? AUTO_SCROLL_SPEED_NORMAL
: AUTO_SCROLL_SPEED_FAST
}

function autoScrollCallback() {
Expand Down
12 changes: 6 additions & 6 deletions src/lib/components/modes/tablemode/TableModeWelcome.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
$: documentType = hasNestedArrays
? 'Object with nested arrays'
: isEmptyDocument
? 'An empty document'
: isJSONObject(json)
? 'An object'
: isJSONArray(json)
? 'An empty array' // note: can also be an array with objects but without properties
: `A ${valueType(json, parser)}`
? 'An empty document'
: isJSONObject(json)
? 'An object'
: isJSONArray(json)
? 'An empty array' // note: can also be an array with objects but without properties
: `A ${valueType(json, parser)}`
</script>

<div class="jse-table-mode-welcome">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
$: editValueText = Array.isArray(focusValue)
? 'Edit array'
: isObject(focusValue)
? 'Edit object'
: 'Edit value'
? 'Edit object'
: 'Edit value'
$: hasSelectionContents =
hasJson &&
Expand Down
4 changes: 2 additions & 2 deletions src/lib/logic/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ export function onRemoveRow({
rowIndex < (patchedJson as JSONArray).length
? rowIndex
: rowIndex > 0
? rowIndex - 1
: undefined
? rowIndex - 1
: undefined

const newSelection =
newRowIndex !== undefined
Expand Down
4 changes: 2 additions & 2 deletions src/lib/logic/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,8 @@ export function createNewValue(
return Array.isArray(value)
? []
: isObject(value)
? undefined // leave object as is, will recurse into it
: ''
? undefined // leave object as is, will recurse into it
: ''
})
} else {
// just a primitive value
Expand Down
14 changes: 7 additions & 7 deletions src/lib/logic/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ export function updateSearchResult(
matchingActiveIndex !== -1
? matchingActiveIndex
: previousResult?.activeIndex !== undefined &&
previousResult?.activeIndex < newResultItems.length
? previousResult?.activeIndex
: newResultItems.length > 0
? 0
: -1
previousResult?.activeIndex < newResultItems.length
? previousResult?.activeIndex
: newResultItems.length > 0
? 0
: -1

const items: ExtendedSearchResultItem[] = newResultItems.map((item, index) => {
return { ...item, active: index === activeIndex }
Expand All @@ -68,8 +68,8 @@ export function searchNext(searchResult: SearchResult): SearchResult {
searchResult.activeIndex < searchResult.items.length - 1
? searchResult.activeIndex + 1
: searchResult.items.length > 0
? 0
: -1
? 0
: -1

const nextActiveItem = searchResult.items[nextActiveIndex]

Expand Down
4 changes: 2 additions & 2 deletions src/lib/logic/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ export function getSelectionDown(
return nextPathAfter !== null
? createValueSelection(nextPathAfter, false)
: nextPath !== null
? createValueSelection(nextPath, false)
: null
? createValueSelection(nextPath, false)
: null
}

return null
Expand Down
4 changes: 2 additions & 2 deletions src/lib/plugins/query/javascriptQueryLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function createQuery(json: JSONValue, queryOptions: QueryLanguageOptions): strin
typeof filterValue === 'string'
? `'${filter.value}'`
: isInteger(filter.value) && !Number.isSafeInteger(filterValue)
? `${filter.value}n` // bigint
: filter.value
? `${filter.value}n` // bigint
: filter.value

queryParts.push(` .filter(${actualValueGetter} ${filter.relation} ${filterValueStr})\n`)
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/plugins/query/lodashQueryLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ function createQuery(json: JSONValue, queryOptions: QueryLanguageOptions): strin
typeof filterValue === 'string'
? `'${filter.value}'`
: isInteger(filter.value) && !Number.isSafeInteger(filterValue)
? `${filter.value}n` // bigint
: filter.value
? `${filter.value}n` // bigint
: filter.value

queryParts.push(` .filter(${actualValueGetter} ${filter.relation} ${filterValueStr})\n`)
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/utils/pathUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export function stringifyJSONPath(path: JSONPath): string {
return integerNumberRegex.test(p)
? '[' + p + ']'
: /[.[\]]/.test(p) || p === '' // match any character . or [ or ] and handle an empty string
? '["' + escapeQuotes(p) + '"]'
: (index > 0 ? '.' : '') + p
? '["' + escapeQuotes(p) + '"]'
: (index > 0 ? '.' : '') + p
})
.join('')
}
Expand Down Expand Up @@ -104,8 +104,8 @@ export function createLodashPropertySelector(path: JSONPath): string {
return path.length === 0
? ''
: path.every((prop) => integerNumberRegex.test(prop) || javaScriptPropertyRegex.test(prop))
? "'" + path.map(stringifyLodashProperty).join('').replace(/^\./, '') + "'"
: JSON.stringify(path)
? "'" + path.map(stringifyLodashProperty).join('').replace(/^\./, '') + "'"
: JSON.stringify(path)
}

/**
Expand Down

0 comments on commit d88b541

Please sign in to comment.