Skip to content

Commit

Permalink
apply biome 1.6.0 lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seriousme committed Mar 11, 2024
1 parent 588ee5f commit 999a3b9
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 87 deletions.
6 changes: 3 additions & 3 deletions bin/bundle-api-cli.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env node

import { writeFileSync } from "fs";
import { basename } from "path";
import { writeFileSync } from "node:fs";
import { basename } from "node:path";
import { dump } from "js-yaml";
import argvParser from "minimist";
import { argv, exit } from "process";
import { argv, exit } from "node:process";
import { Validator } from "../index.js";

const cmd = basename(argv[1]);
Expand Down
2 changes: 1 addition & 1 deletion bin/validate-api-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Validator } from "../index.js";
const validator = new Validator();
import { argv, exit } from "process";
import { argv, exit } from "node:process";

const filename = argv[2];
if (!filename) {
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ErrorObject, Options } from "ajv";
import type { ErrorObject, Options } from "ajv";
export class Validator {
static supportedVersions: Set<string>;
constructor(ajvOptions?: Options);
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { readFileSync } from "fs";
import { URL, fileURLToPath } from "url";
import { readFileSync } from "node:fs";
import { URL, fileURLToPath } from "node:url";
import Ajv04 from "ajv-draft-04";
import addFormats from "ajv-formats";
import Ajv2020 from "ajv/dist/2020.js";
import { readFile } from "fs/promises";
import { readFile } from "node:fs/promises";
import { JSON_SCHEMA, load } from "js-yaml";
import { checkRefs, replaceRefs } from "./resolve.js";

Expand Down
113 changes: 54 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,61 +1,56 @@
{
"name": "@seriousme/openapi-schema-validator",
"version": "2.2.1",
"description": "Validate OpenApi specifications against their JSON schema",
"main": "index.js",
"type": "module",
"bin": {
"validate-api": "./bin/validate-api-cli.js",
"bundle-api": "./bin/bundle-api-cli.js"
},
"dependencies": {
"ajv": "^8.12.0",
"ajv-draft-04": "^1.0.0",
"ajv-formats": "^2.1.1",
"js-yaml": "^4.1.0",
"minimist": "^1.2.8"
},
"scripts": {
"test": "c8 node --test test/test-*.js",
"format": "biome format --write .",
"lint": "biome ci .",
"pretest": "npm run format",
"posttest": "c8 check-coverage --lines 100 --functions 100 --branches 100",
"covtest": "c8 --reporter=lcov npm test",
"cloneOas": "rm -rf OpenAPI-Specification && git clone --branch 'gh-pages' --single-branch https://github.com/OAI/OpenAPI-Specification.git",
"checkOasVersions": "node test/check-versions.js",
"checkOasVersionsSnapshot": "node test/check-versions.js --updateSnapshot",
"preconvert31": "npm run cloneOas",
"convert31": "node test/convert-3.1.js ",
"postconvert31": "npm run checkOasVersionsSnapshot",
"preversion": "npm test",
"postversion": "git push && git push --tags",
"realWorldTest": "node test/realworld/realworld.js",
"realWorldTestAll": "node test/realworld/realworld.js --all",
"realWorldTestFailed": "node test/realworld/realworld.js --failedOnly",
"realWorldTestCI": "node test/realworld/realworld.js --ci"
},
"author": "Hans Klunder",
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"c8": "^9.1.0"
},
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/seriousme/openapi-schema-validator.git"
},
"keywords": [
"openapi",
"json",
"schema",
"validation"
],
"bugs": {
"url": "https://github.com/seriousme/openapi-schema-validator/issues"
},
"homepage": "https://github.com/seriousme/openapi-schema-validator#readme"
"name": "@seriousme/openapi-schema-validator",
"version": "2.2.1",
"description": "Validate OpenApi specifications against their JSON schema",
"main": "index.js",
"type": "module",
"bin": {
"validate-api": "./bin/validate-api-cli.js",
"bundle-api": "./bin/bundle-api-cli.js"
},
"dependencies": {
"ajv": "^8.12.0",
"ajv-draft-04": "^1.0.0",
"ajv-formats": "^2.1.1",
"js-yaml": "^4.1.0",
"minimist": "^1.2.8"
},
"scripts": {
"test": "c8 node --test test/test-*.js",
"format": "biome format --write .",
"lint": "biome ci .",
"pretest": "npm run format",
"posttest": "c8 check-coverage --lines 100 --functions 100 --branches 100",
"covtest": "c8 --reporter=lcov npm test",
"cloneOas": "rm -rf OpenAPI-Specification && git clone --branch 'gh-pages' --single-branch https://github.com/OAI/OpenAPI-Specification.git",
"checkOasVersions": "node test/check-versions.js",
"checkOasVersionsSnapshot": "node test/check-versions.js --updateSnapshot",
"preconvert31": "npm run cloneOas",
"convert31": "node test/convert-3.1.js ",
"postconvert31": "npm run checkOasVersionsSnapshot",
"preversion": "npm test",
"postversion": "git push && git push --tags",
"realWorldTest": "node test/realworld/realworld.js",
"realWorldTestAll": "node test/realworld/realworld.js --all",
"realWorldTestFailed": "node test/realworld/realworld.js --failedOnly",
"realWorldTestCI": "node test/realworld/realworld.js --ci"
},
"author": "Hans Klunder",
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"c8": "^9.1.0"
},
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/seriousme/openapi-schema-validator.git"
},
"keywords": ["openapi", "json", "schema", "validation"],
"bugs": {
"url": "https://github.com/seriousme/openapi-schema-validator/issues"
},
"homepage": "https://github.com/seriousme/openapi-schema-validator#readme"
}
8 changes: 4 additions & 4 deletions test/check-versions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createHash } from "crypto";
import { readFileSync } from "fs";
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
import { strict as assert } from "node:assert/strict";
import { test } from "node:test";
import { URL } from "url";
import { readdir } from "fs/promises";
import { URL } from "node:url";
import { readdir } from "node:fs/promises";
import { Validator } from "../index.js";
import { Snapshot } from "./snapshot.js";

Expand Down
2 changes: 1 addition & 1 deletion test/convert-3.1.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readFileSync, readdirSync, writeFileSync } from "fs";
import { readFileSync, readdirSync, writeFileSync } from "node:fs";

function localPath(path) {
return new URL(path, import.meta.url).pathname;
Expand Down
6 changes: 3 additions & 3 deletions test/realworld/realworld.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// test the validator against the APIs of https://apis.guru
import { createRequire } from "module";
import { createRequire } from "node:module";
const importJSON = createRequire(import.meta.url);
const localFile = (fileName) => new URL(fileName, import.meta.url).pathname;
import { Validator } from "../../index.js";
const validator = new Validator();
import { writeFileSync } from "fs";
import { writeFileSync } from "node:fs";
import { JSON_SCHEMA, load } from "js-yaml";
import { argv, exit } from "process";
import { argv, exit } from "node:process";
import { createReport } from "./createReport.js";
const yamlOpts = { schema: JSON_SCHEMA };
const failedFile = localFile("./failed.json");
Expand Down
4 changes: 2 additions & 2 deletions test/realworld/reportFromJson.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createRequire } from "module";
import { createRequire } from "node:module";
import { createReport } from "./createReport.js";
const importJSON = createRequire(import.meta.url);
const localFile = (fileName) => new URL(fileName, import.meta.url).pathname;

import { writeFileSync } from "fs";
import { writeFileSync } from "node:fs";

const mdFile = localFile("./failed.fromJson.md");
const failedFile = localFile("./failed.json");
Expand Down
2 changes: 1 addition & 1 deletion test/snapshot.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// simple snapshot handling utility for testing, nothing fancy

import { readFileSync, writeFileSync } from "fs";
import { readFileSync, writeFileSync } from "node:fs";

export class Snapshot {
/**
Expand Down
6 changes: 3 additions & 3 deletions test/test-bundle-cli.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { execSync } from "child_process";
import { readFileSync, unlinkSync } from "fs";
import { execSync } from "node:child_process";
import { readFileSync, unlinkSync } from "node:fs";
import { strict as assert } from "node:assert/strict";
import { test } from "node:test";
import { URL, fileURLToPath } from "url";
import { URL, fileURLToPath } from "node:url";
import { load } from "js-yaml";

function localFile(fileName) {
Expand Down
4 changes: 2 additions & 2 deletions test/test-validate-cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { execSync } from "child_process";
import { execSync } from "node:child_process";
import { strict as assert } from "node:assert/strict";
import { test } from "node:test";
import { URL, fileURLToPath } from "url";
import { URL, fileURLToPath } from "node:url";

function localFile(fileName) {
return fileURLToPath(new URL(fileName, import.meta.url));
Expand Down
2 changes: 1 addition & 1 deletion test/test-validation-refs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strict as assert } from "node:assert/strict";
import { test } from "node:test";
import { URL, fileURLToPath } from "url";
import { URL, fileURLToPath } from "node:url";
import { Validator } from "../index.js";

function localFile(fileName) {
Expand Down
6 changes: 3 additions & 3 deletions test/test-validation.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { readFileSync } from "fs";
import { readFileSync } from "node:fs";
import { strict as assert } from "node:assert/strict";
import { test } from "node:test";
import { URL, fileURLToPath } from "url";
import { readFile } from "fs/promises";
import { URL, fileURLToPath } from "node:url";
import { readFile } from "node:fs/promises";
import { Validator } from "../index.js";

function localFile(fileName) {
Expand Down

0 comments on commit 999a3b9

Please sign in to comment.