Skip to content

Commit 56f7263

Browse files
committed
Fix lint issues
1 parent fe72cca commit 56f7263

File tree

10 files changed

+30
-32
lines changed

10 files changed

+30
-32
lines changed

.eslintrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ env:
99
browser: true
1010
rules:
1111
"@typescript-eslint/no-explicit-any": ["off"]
12+
parserOptions:
13+
sourceType: module

lib/util/errors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ function setErrorName (err) {
123123

124124
export function isHandledError (err) {
125125
return err instanceof JSONParserError || err instanceof JSONParserErrorGroup;
126-
};
126+
}
127127

128128
export function normalizeError (err) {
129129
if (err.path === null) {
130130
err.path = [];
131131
}
132132

133133
return err;
134-
};
134+
}

lib/util/plugins.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function all (plugins) {
1414
plugins[key].name = key;
1515
return plugins[key];
1616
});
17-
};
17+
}
1818

1919
/**
2020
* Filters the given plugins, returning only the ones return `true` for the given method.
@@ -29,7 +29,7 @@ export function filter (plugins, method, file) {
2929
.filter((plugin) => {
3030
return !!getResult(plugin, method, file);
3131
});
32-
};
32+
}
3333

3434
/**
3535
* Sorts the given plugins, in place, by their `order` property.
@@ -43,7 +43,7 @@ export function sort (plugins) {
4343
}
4444

4545
return plugins.sort((a, b) => { return a.order - b.order; });
46-
};
46+
}
4747

4848
/**
4949
* Runs the specified method of the given plugins, in order, until one of them returns a successful result.
@@ -117,7 +117,7 @@ export function run (plugins, method, file, $refs) {
117117
runNextPlugin();
118118
}
119119
}));
120-
};
120+
}
121121

122122
/**
123123
* Returns the value of the given property.

lib/util/url.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import nodePath from "path";
21
import projectDir from "./projectDir.cjs";
32

43
let isWindows = /^win/.test(globalThis.process ? globalThis.process.platform : undefined),
@@ -37,7 +36,7 @@ export function resolve (from, to) {
3736
return pathname + search + hash;
3837
}
3938
return resolvedUrl.toString();
40-
};
39+
}
4140

4241
/**
4342
* Returns the current working directory (in Node) or the current page URL (in browsers).
@@ -58,7 +57,7 @@ export function cwd () {
5857
else {
5958
return path + "/";
6059
}
61-
};
60+
}
6261

6362
/**
6463
* Returns the protocol of the given URL, or `undefined` if it has no protocol.
@@ -71,7 +70,7 @@ export function getProtocol (path) {
7170
if (match) {
7271
return match[1].toLowerCase();
7372
}
74-
};
73+
}
7574

7675
/**
7776
* Returns the lowercased file extension of the given URL,
@@ -86,7 +85,7 @@ export function getExtension (path) {
8685
return stripQuery(path.substr(lastDot).toLowerCase());
8786
}
8887
return "";
89-
};
88+
}
9089

9190
/**
9291
* Removes the query, if any, from the given path.
@@ -100,7 +99,7 @@ export function stripQuery (path) {
10099
path = path.substr(0, queryIndex);
101100
}
102101
return path;
103-
};
102+
}
104103

105104
/**
106105
* Returns the hash (URL fragment), of the given path.
@@ -115,7 +114,7 @@ export function getHash (path) {
115114
return path.substr(hashIndex);
116115
}
117116
return "#";
118-
};
117+
}
119118

120119
/**
121120
* Removes the hash (URL fragment), if any, from the given path.
@@ -129,7 +128,7 @@ export function stripHash (path) {
129128
path = path.substr(0, hashIndex);
130129
}
131130
return path;
132-
};
131+
}
133132

134133
/**
135134
* Determines whether the given path is an HTTP(S) URL.
@@ -150,7 +149,7 @@ export function isHttp (path) {
150149
// It's some other protocol, such as "ftp://", "mongodb://", etc.
151150
return false;
152151
}
153-
};
152+
}
154153

155154
/**
156155
* Determines whether the given path is a filesystem path.
@@ -168,7 +167,7 @@ export function isFileSystemPath (path) {
168167

169168
let protocol = getProtocol(path);
170169
return protocol === undefined || protocol === "file";
171-
};
170+
}
172171

173172
/**
174173
* Converts a filesystem path to a properly-encoded URL.
@@ -211,7 +210,7 @@ export function fromFileSystemPath (path) {
211210
}
212211

213212
return path;
214-
};
213+
}
215214

216215
/**
217216
* Converts a URL to a local filesystem path.
@@ -268,7 +267,7 @@ export function toFileSystemPath (path, keepFileProtocol) {
268267
}
269268

270269
return path;
271-
};
270+
}
272271

273272
/**
274273
* Converts a $ref pointer to a valid JSON Path.
@@ -289,4 +288,4 @@ export function safePointerToPath (pointer) {
289288
.replace(jsonPointerSlash, "/")
290289
.replace(jsonPointerTilde, "~");
291290
});
292-
};
291+
}

test/specs/__({[ % & $ # @ ` ~ ,)}]__/special-characters.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import path from "../../utils/path.js";
44
import chai from "chai";
55
import parsedSchema from "./parsed.js";
66
import dereferencedSchema from "./dereferenced.js";
7-
import { doesNotMatch } from "assert";
87

9-
const { expect } = chai
8+
const { expect } = chai;
109

1110
describe("File names with special characters", () => {
1211
it("should parse successfully", async () => {

test/specs/absolute-root/absolute-root.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import dereferencedSchema from "./dereferenced.js";
99
import bundledSchema from "./bundled.js";
1010

1111
const { expect } = chai;
12-
const url = { cwd: urlModule.cwd }
12+
const url = { cwd: urlModule.cwd };
1313

1414
describe("When executed in the context of root directory", () => {
1515
// Store the OS root directory

test/specs/circular-extended/dereferenced.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,4 @@ dereferencedSchema.indirectAncestor.fullyDereferenced.definitions.parent.propert
209209
dereferencedSchema.indirectAncestor.fullyDereferenced.definitions.child.properties.children.items.properties =
210210
dereferencedSchema.indirectAncestor.fullyDereferenced.definitions.child.properties;
211211

212-
export default dereferencedSchema;
212+
export default dereferencedSchema;
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export default
2-
{
3-
$ref: "./circular-external-direct-root.yaml#/foo",
4-
};
1+
export default {
2+
$ref: "./circular-external-direct-root.yaml#/foo",
3+
};

test/specs/dereference-callback/dereference-callback.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import chai from "chai";
22
import $RefParser from "../../../lib/index.js";
3-
import path from "../../utils/path.js";
3+
import pathUtils from "../../utils/path.js";
44

55
const { expect } = chai;
66

@@ -9,7 +9,7 @@ describe("Schema with a $ref", () => {
99
let parser = new $RefParser();
1010
const calls = [];
1111
await parser.dereference(
12-
path.rel("specs/dereference-callback/dereference-callback.yaml"),
12+
pathUtils.rel("specs/dereference-callback/dereference-callback.yaml"),
1313
{
1414
dereference: {
1515
onDereference (path, object) {

test/specs/exports.spec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
import chai from "chai";
33
import defaultExport from "../../lib/index.js";
44
import * as namespaceExport from "../../lib/index.js";
5-
import { default as namedDefaultExport} from "../../lib/index.js";
5+
import { default as namedDefaultExport } from "../../lib/index.js";
66
import {
77
JSONParserError,
88
InvalidPointerError,
99
MissingPointerError,
1010
ResolverError,
1111
ParserError,
1212
UnmatchedParserError,
13-
UnmatchedResolverError,
14-
dereference,
13+
UnmatchedResolverError
1514
} from "../../lib/index.js";
1615

1716
const { expect } = chai;

0 commit comments

Comments
 (0)