diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 00000000..13533417 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,28 @@ +name: Node.js CI + +on: + push: + branches: ["ci"] + pull_request: + branches: ["main"] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - run: npm test + - run: npm run lint + - run: npm run check-types diff --git a/annotations/annotated-instance.js b/annotations/annotated-instance.js index 62cba009..1963a484 100644 --- a/annotations/annotated-instance.js +++ b/annotations/annotated-instance.js @@ -5,8 +5,8 @@ import { getKeywordId } from "../lib/keywords.js"; const defaultDialectId = "https://json-schema.org/validation"; -export const nil = { ...nilInstance, annotations: {} }; -export const cons = (instance, id = undefined) => ({ +export const nil = { ...nilInstance, annotations: {} }; // eslint-disable-line import/export +export const cons = (instance, id = undefined) => ({ // eslint-disable-line import/export ...nil, id: id ? toAbsoluteIri(id) : "", instance, @@ -47,4 +47,4 @@ export const annotatedWith = (instance, keyword, dialectId = defaultDialectId) = return instances; }; -export * from "../lib/instance.js"; +export * from "../lib/instance.js"; // eslint-disable-line import/export diff --git a/lib/yaml-schema.spec.ts b/lib/yaml-schema.spec.ts index 987ddbaf..3c237386 100644 --- a/lib/yaml-schema.spec.ts +++ b/lib/yaml-schema.spec.ts @@ -23,7 +23,7 @@ const testDomain = "http://test.jsc.hyperjump.io"; addMediaTypePlugin("application/schema+yaml", { parse: async (response) => { const contentType = contentTypeParser.parse(response.headers.get("content-type") ?? ""); - const contextDialectId = contentType.parameters.schema ?? contentType.parameters.profile; + const contextDialectId = contentType.parameters.schema ?? contentType.parameters.profile; // eslint-disable-line @typescript-eslint/no-unnecessary-condition const json = YAML.parse(await response.text()) as SchemaObject | boolean; diff --git a/package.json b/package.json index 52e9ace2..ebc21241 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "scripts": { "clean": "xargs -a .gitignore rm -rf", "lint": "eslint lib stable draft-* openapi-* bundle annotations", - "test": "vitest --watch=false" + "test": "vitest --watch=false", + "check-types": "tsc --noEmit" }, "repository": { "type": "git", diff --git a/tsconfig.json b/tsconfig.json index 15cf563a..dbd3d97e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,7 @@ "moduleResolution": "Node16", "esModuleInterop": true, "strict": true, - "allowJs": true + "allowJs": true, + "skipLibCheck": true } }