Skip to content

Commit 93ffa8f

Browse files
ESLint fixes
1 parent b3cd37e commit 93ffa8f

File tree

17 files changed

+150
-147
lines changed

17 files changed

+150
-147
lines changed

.eslintrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44

55
root: true
66
extends: "@jsdevtools"
7+
env:
8+
node: true
9+
browser: true

lib/index.d.ts

Lines changed: 108 additions & 107 deletions
Large diffs are not rendered by default.

lib/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-unused-vars */
12
"use strict";
23

34
const $Refs = require("./refs");

lib/parsers/json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = {
3636
* @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver
3737
* @returns {Promise}
3838
*/
39-
async parse (file) {
39+
async parse (file) { // eslint-disable-line require-await
4040
let data = file.data;
4141
if (Buffer.isBuffer(data)) {
4242
data = data.toString();

lib/parsers/yaml.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = {
3737
* @param {*} file.data - The file contents. This will be whatever data type was returned by the resolver
3838
* @returns {Promise}
3939
*/
40-
async parse (file) {
40+
async parse (file) { // eslint-disable-line require-await
4141
let data = file.data;
4242
if (Buffer.isBuffer(data)) {
4343
data = data.toString();

lib/ref.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module.exports = $Ref;
44

55
const Pointer = require("./pointer");
6-
const { JSONParserError, JSONParserErrorGroup, ParserError, MissingPointerError, ResolverError, InvalidPointerError, isHandledError, normalizeError } = require("./util/errors");
6+
const { InvalidPointerError, isHandledError, normalizeError } = require("./util/errors");
77
const { safePointerToPath, stripHash, getHash } = require("./util/url");
88

99
/**

lib/refs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function $Refs () {
4141
* @param {...string|string[]} [types] - Only return paths of the given types ("file", "http", etc.)
4242
* @returns {string[]}
4343
*/
44-
$Refs.prototype.paths = function (types) {
44+
$Refs.prototype.paths = function (types) { // eslint-disable-line no-unused-vars
4545
let paths = getPaths(this._$refs, arguments);
4646
return paths.map((path) => {
4747
return path.decoded;
@@ -54,7 +54,7 @@ $Refs.prototype.paths = function (types) {
5454
* @param {...string|string[]} [types] - Only return references of the given types ("file", "http", etc.)
5555
* @returns {object}
5656
*/
57-
$Refs.prototype.values = function (types) {
57+
$Refs.prototype.values = function (types) { // eslint-disable-line no-unused-vars
5858
let $refs = this._$refs;
5959
let paths = getPaths($refs, arguments);
6060
return paths.reduce((obj, path) => {

test/specs/callbacks.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ describe("Callback & Promise syntax", () => {
2121
let parser = new $RefParser();
2222
parser[method](path.rel("specs/internal/internal.yaml"), (err, result) => {
2323
try {
24-
expect(err).to.be.null;
25-
expect(result).to.be.an("object").and.ok;
24+
expect(err).to.equal(null);
25+
expect(result).to.be.an("object");
2626

2727
if (method === "resolve") {
2828
expect(result).to.equal(parser.$refs);
@@ -44,7 +44,7 @@ describe("Callback & Promise syntax", () => {
4444
$RefParser[method](path.rel("specs/invalid/invalid.yaml"), (err, result) => {
4545
try {
4646
expect(err).to.be.an.instanceOf(ParserError);
47-
expect(result).to.be.undefined;
47+
expect(result).to.equal(undefined);
4848
done();
4949
}
5050
catch (e) {
@@ -59,7 +59,7 @@ describe("Callback & Promise syntax", () => {
5959
let parser = new $RefParser();
6060
return parser[method](path.rel("specs/internal/internal.yaml"))
6161
.then((result) => {
62-
expect(result).to.be.an("object").and.ok;
62+
expect(result).to.be.an("object");
6363

6464
if (method === "resolve") {
6565
expect(result).to.equal(parser.$refs);

test/specs/deep/dereferenced.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"use strict";
22

3-
const helper = require("../../utils/helper");
4-
53
let name = {
64
required: [
75
"first",

test/specs/empty/empty.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("Empty schema", () => {
1010
let parser = new $RefParser();
1111
const schema = await parser.parse(path.rel("specs/empty/empty.json"));
1212
expect(schema).to.be.an("object");
13-
expect(schema).to.be.empty;
13+
expect(schema).to.be.empty; // eslint-disable-line no-unused-expressions
1414
expect(parser.schema).to.equal(schema);
1515
expect(parser.$refs.paths()).to.deep.equal([path.abs("specs/empty/empty.json")]);
1616
});
@@ -24,7 +24,7 @@ describe("Empty schema", () => {
2424
let parser = new $RefParser();
2525
const schema = await parser.dereference(path.rel("specs/empty/empty.json"));
2626
expect(schema).to.be.an("object");
27-
expect(schema).to.be.empty;
27+
expect(schema).to.be.empty; // eslint-disable-line no-unused-expressions
2828
expect(parser.schema).to.equal(schema);
2929
expect(parser.$refs.paths()).to.deep.equal([path.abs("specs/empty/empty.json")]);
3030
// The "circular" flag should NOT be set
@@ -35,7 +35,7 @@ describe("Empty schema", () => {
3535
let parser = new $RefParser();
3636
const schema = await parser.bundle(path.rel("specs/empty/empty.json"));
3737
expect(schema).to.be.an("object");
38-
expect(schema).to.be.empty;
38+
expect(schema).to.be.empty; // eslint-disable-line no-unused-expressions
3939
expect(parser.schema).to.equal(schema);
4040
expect(parser.$refs.paths()).to.deep.equal([path.abs("specs/empty/empty.json")]);
4141
});

0 commit comments

Comments
 (0)