diff --git a/extensions/aerial-photo/tests/aerial_photo_collection.test.mjs b/extensions/aerial-photo/tests/aerial_photo_collection.test.mjs index 787a7924..5ff9ddbb 100644 --- a/extensions/aerial-photo/tests/aerial_photo_collection.test.mjs +++ b/extensions/aerial-photo/tests/aerial_photo_collection.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.mjs'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/aerial-photo/tests/aerial_photo_item.test.mjs b/extensions/aerial-photo/tests/aerial_photo_item.test.mjs index 17d814ca..aa6448b5 100644 --- a/extensions/aerial-photo/tests/aerial_photo_item.test.mjs +++ b/extensions/aerial-photo/tests/aerial_photo_item.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.mjs'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/camera/tests/camera_collection.test.mjs b/extensions/camera/tests/camera_collection.test.mjs index 971e3cc1..22b4c1e7 100644 --- a/extensions/camera/tests/camera_collection.test.mjs +++ b/extensions/camera/tests/camera_collection.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/camera/tests/camera_item.test.mjs b/extensions/camera/tests/camera_item.test.mjs index 81f70cdf..3ca90f28 100644 --- a/extensions/camera/tests/camera_item.test.mjs +++ b/extensions/camera/tests/camera_item.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/film/tests/film_collection.test.mjs b/extensions/film/tests/film_collection.test.mjs index c60a8638..56054bcb 100644 --- a/extensions/film/tests/film_collection.test.mjs +++ b/extensions/film/tests/film_collection.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/film/tests/film_item.test.mjs b/extensions/film/tests/film_item.test.mjs index 33389b49..522e00c0 100644 --- a/extensions/film/tests/film_item.test.mjs +++ b/extensions/film/tests/film_item.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/historical-imagery/tests/historical-imagery_collection.test.mjs b/extensions/historical-imagery/tests/historical-imagery_collection.test.mjs index ebc88b01..0efba843 100644 --- a/extensions/historical-imagery/tests/historical-imagery_collection.test.mjs +++ b/extensions/historical-imagery/tests/historical-imagery_collection.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); @@ -98,7 +99,7 @@ o.spec('Historical Imagery Extension Collection', () => { // given for (const role of ['producer', 'licensor', 'processor', 'host']) { const example = JSON.parse(await fs.readFile(examplePath)); - example.providers = example.providers.filter((provider) => !role in provider.roles); + example.providers = example.providers.filter((provider) => (!role) in provider.roles); // when let valid = validate(example); diff --git a/extensions/historical-imagery/tests/historical-imagery_item.test.mjs b/extensions/historical-imagery/tests/historical-imagery_item.test.mjs index d6c421f8..d5cde3a2 100644 --- a/extensions/historical-imagery/tests/historical-imagery_item.test.mjs +++ b/extensions/historical-imagery/tests/historical-imagery_item.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/linz/tests/linz_collection.test.mjs b/extensions/linz/tests/linz_collection.test.mjs index 97ce1a68..332d0227 100644 --- a/extensions/linz/tests/linz_collection.test.mjs +++ b/extensions/linz/tests/linz_collection.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); @@ -404,7 +405,7 @@ o.spec('LINZ collection', () => { // given for (const role of ['producer', 'licensor']) { const example = JSON.parse(await fs.readFile(examplePath)); - example.providers = example.providers.filter((provider) => !role in provider.roles); + example.providers = example.providers.filter((provider) => (!role) in provider.roles); // when let valid = validate(example); @@ -423,7 +424,7 @@ o.spec('LINZ collection', () => { // given for (const role of ['manager', 'custodian']) { const example = JSON.parse(await fs.readFile(examplePath)); - example['linz:providers'] = example['linz:providers'].filter((provider) => !role in provider.roles); + example['linz:providers'] = example['linz:providers'].filter((provider) => (!role) in provider.roles); // when let valid = validate(example); diff --git a/extensions/linz/tests/linz_item.test.mjs b/extensions/linz/tests/linz_item.test.mjs index d3047042..82aaaf38 100644 --- a/extensions/linz/tests/linz_item.test.mjs +++ b/extensions/linz/tests/linz_item.test.mjs @@ -1,9 +1,10 @@ +import Ajv from 'ajv'; +import { promises as fs } from 'fs'; import o from 'ospec'; -import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; -import Ajv from 'ajv'; + +import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); const schemaPath = join(__dirname, '..', 'schema.json'); diff --git a/extensions/quality/tests/quality_collection.test.mjs b/extensions/quality/tests/quality_collection.test.mjs index 2e0ac78c..6317c7e2 100644 --- a/extensions/quality/tests/quality_collection.test.mjs +++ b/extensions/quality/tests/quality_collection.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/scanning/tests/scanning_collection.test.mjs b/extensions/scanning/tests/scanning_collection.test.mjs index 5e0efd10..12c3f918 100644 --- a/extensions/scanning/tests/scanning_collection.test.mjs +++ b/extensions/scanning/tests/scanning_collection.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/scanning/tests/scanning_item.test.mjs b/extensions/scanning/tests/scanning_item.test.mjs index 3225ad00..8228ffb7 100644 --- a/extensions/scanning/tests/scanning_item.test.mjs +++ b/extensions/scanning/tests/scanning_item.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/template/tests/template_collection.test.mjs b/extensions/template/tests/template_collection.test.mjs index 617aad02..34fa9c56 100644 --- a/extensions/template/tests/template_collection.test.mjs +++ b/extensions/template/tests/template_collection.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/extensions/template/tests/template_item.test.mjs b/extensions/template/tests/template_item.test.mjs index cf65aa28..e53e1af1 100644 --- a/extensions/template/tests/template_item.test.mjs +++ b/extensions/template/tests/template_item.test.mjs @@ -1,8 +1,9 @@ -import o from 'ospec'; import Ajv from 'ajv'; +import { promises as fs } from 'fs'; +import o from 'ospec'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; + import { AjvOptions, DefaultTimeoutMillis } from '../../../validation.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/package.json b/package.json index 20960a20..a86b2068 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,9 @@ "version": "0.0.15", "type": "module", "scripts": { - "lint": "npx eslint . --fix && npm run format", - "format": "npm run format:markdown && npm run format:yaml", + "lint": "npx eslint . && npm run format", + "format": "npm run format:js && npm run format:markdown && npm run format:yaml", + "format:js": "npx eslint --fix .", "format:markdown": "npx prettier **/*.md --write", "format:yaml": "npx prettier **/*.yaml --write", "version": "conventional-changelog -p angular -i CHANGELOG.md -s && npm run format && git add CHANGELOG.md", diff --git a/validation.mjs b/validation.mjs index 5fbf20e0..0fb50435 100644 --- a/validation.mjs +++ b/validation.mjs @@ -1,10 +1,10 @@ import axios from 'axios'; +import { promises as fs } from 'fs'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; -import { promises as fs } from 'fs'; const __dirname = dirname(fileURLToPath(import.meta.url)); -import iriFormats from 'stac-node-validator/iri.js'; import { fastFormats } from 'ajv-formats/dist/formats.js'; +import iriFormats from 'stac-node-validator/iri.js'; const Schemas = new Map(); export function loadSchema(uri) {