Skip to content

Commit dd0b080

Browse files
committed
sty: deno fmt [ignore-rev]
1 parent 8c6b1c0 commit dd0b080

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

src/files/inheritance.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { BIDSFile, FileTree } from '../types/filetree.ts'
22
import { readEntities } from '../schema/entities.ts'
33

4-
54
type Ret<T> = T extends [string, ...string[]] ? (BIDSFile | BIDSFile[]) : BIDSFile
65

76
/** Find associated files in order of proximity to a source file.

src/files/json.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ async function readJSONText(file: BIDSFile): Promise<string> {
2222

2323
export async function loadJSON(file: BIDSFile): Promise<Record<string, unknown>> {
2424
const text = await readJSONText(file) // Raise encoding errors
25-
let parsedText;
25+
let parsedText
2626
try {
2727
parsedText = JSON.parse(text)
2828
} catch (error) {
2929
throw { key: 'JSON_INVALID' } // Raise syntax errors
3030
}
31-
if (Array.isArray(parsedText) || typeof parsedText !== "object") {
32-
throw { key: 'JSON_NOT_AN_OBJECT', evidence: text.substring(0, 10) + (text.length > 10 ? '...' : '') }
31+
if (Array.isArray(parsedText) || typeof parsedText !== 'object') {
32+
throw {
33+
key: 'JSON_NOT_AN_OBJECT',
34+
evidence: text.substring(0, 10) + (text.length > 10 ? '...' : ''),
35+
}
3336
}
3437
return parsedText
3538
}

src/schema/applyRules.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ function evalJsonCheck(
183183
// Count on other JSON rules to use selectors to match the correct files
184184
// Text files at the root do not have sidecars. We might want a cleaner
185185
// or more schematic way to identify them in the future.
186-
if (sidecarRule && (['.json', '', '.md', '.txt', '.rst', '.cff'].includes(context.extension))) return
186+
if (sidecarRule && (['.json', '', '.md', '.txt', '.rst', '.cff'].includes(context.extension))) {
187+
return
188+
}
187189

188190
const json: Record<string, any> = sidecarRule ? context.sidecar : context.json
189191
for (const [key, requirement] of Object.entries(rule.fields)) {

src/schema/tables.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export function evalAdditionalColumns(
239239
if (context.extension !== '.tsv') return
240240
const headers = Object.keys(context?.columns)
241241
if (rule.columns) {
242-
if (!rule.additional_columns || rule.additional_columns === 'n/a' ) {
242+
if (!rule.additional_columns || rule.additional_columns === 'n/a') {
243243
// Old schemas might be missing the field, so be permissive.
244244
// New schemas indicate it is not applicable with 'n/a'.
245245
return

src/summary/collectSubjectMetadata.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export const collectSubjectMetadata = (
5454
)
5555
// make age an integer
5656
if (ageKey) {
57-
if(data[ageKey.index] === "89+") {
58-
data[ageKey.index] = "89+"
57+
if (data[ageKey.index] === '89+') {
58+
data[ageKey.index] = '89+'
5959
} else {
6060
// @ts-expect-error
6161
data[ageKey.index] = parseFloat(data[ageKey.index])

src/types/validation-result.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { DatasetIssues } from '../issues/datasetIssues.ts'
22

33
export interface SubjectMetadata {
44
participantId: string
5-
age?: number | null | "89+"
5+
age?: number | null | '89+'
66
sex?: string
77
}
88
/*

0 commit comments

Comments
 (0)