Skip to content

Commit 66a0f6e

Browse files
committed
Linting fixes.
1 parent 7855f14 commit 66a0f6e

9 files changed

+42
-12
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests/setImmediate.js

lib/jsonld.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ const _browser = !_nodejs &&
8787
// attaches jsonld API to the given object
8888
const wrapper = function(jsonld) {
8989

90+
/** Registered RDF dataset parsers hashed by content-type. */
91+
const _rdfParsers = {};
92+
9093
/* Core API */
9194

9295
/**
@@ -464,11 +467,10 @@ jsonld.frame = util.callbackify(async function(input, frame, options) {
464467

465468
// if the unexpanded frame includes a key expanding to @graph, frame the
466469
// default graph, otherwise, the merged graph
467-
let framed;
468470
// FIXME should look for aliases of @graph
469471
opts.merged = !('@graph' in frame);
470472
// do framing
471-
framed = _frameMergedOrDefault(expanded, expandedFrame, opts);
473+
const framed = _frameMergedOrDefault(expanded, expandedFrame, opts);
472474

473475
// compact result (force @graph option to true, skip expansion,
474476
// check for linked embeds)
@@ -594,7 +596,8 @@ jsonld.fromRDF = util.callbackify(async function(dataset, options) {
594596
format: _isString(dataset) ? 'application/n-quads' : undefined
595597
});
596598

597-
let {format, rdfParser} = options;
599+
const {format} = options;
600+
let {rdfParser} = options;
598601

599602
// handle special format
600603
if(format) {
@@ -969,9 +972,6 @@ jsonld.useDocumentLoader = function(type) {
969972
jsonld, Array.prototype.slice.call(arguments, 1));
970973
};
971974

972-
/** Registered RDF dataset parsers hashed by content-type. */
973-
const _rdfParsers = {};
974-
975975
/**
976976
* Registers an RDF dataset parser by content-type, for use with
977977
* jsonld.fromRDF. An RDF dataset parser will always be given two parameters,

lib/url.js

+2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ api.parsers = {
1919
keys: [
2020
'href', 'scheme', 'authority', 'path', 'query', 'fragment'
2121
],
22+
/* eslint-disable-next-line max-len */
2223
regex: /^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/
2324
},
2425
full: {
2526
keys: [
2627
'href', 'protocol', 'scheme', 'authority', 'auth', 'user', 'password',
2728
'hostname', 'port', 'path', 'directory', 'file', 'query', 'fragment'
2829
],
30+
/* eslint-disable-next-line max-len */
2931
regex: /^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/
3032
}
3133
};

tests/earl-report.js

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function EarlReport(options) {
1919
'0' + (today.getMonth() + 1) : today.getMonth() + 1) + '-' +
2020
(today.getDate() < 10 ? '0' + today.getDate() : today.getDate());
2121
this.id = options.id;
22+
/* eslint-disable quote-props */
2223
this._report = {
2324
'@context': {
2425
'doap': 'http://usefulinc.com/ns/doap#',
@@ -66,6 +67,7 @@ function EarlReport(options) {
6667
},
6768
'subjectOf': []
6869
};
70+
/* eslint-enable quote-props */
6971
this._report['@id'] += '#' + this.id;
7072
this._report['doap:name'] += ' ' + this.id;
7173
this._report['dc:title'] += ' ' + this.id;

tests/misc.js

+10
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ describe('other toRDF tests', () => {
8989
it('should process with options and promise', done => {
9090
const p = jsonld.toRDF({}, {});
9191
assert(p instanceof Promise);
92+
/* eslint-disable-next-line no-unused-vars */
9293
p.catch(e => {
9394
assert.fail();
9495
}).then(output => {
@@ -100,6 +101,7 @@ describe('other toRDF tests', () => {
100101
it('should process with no options and promise', done => {
101102
const p = jsonld.toRDF({});
102103
assert(p instanceof Promise);
104+
/* eslint-disable-next-line no-unused-vars */
103105
p.catch(e => {
104106
assert.fail();
105107
}).then(output => {
@@ -109,6 +111,7 @@ describe('other toRDF tests', () => {
109111
});
110112

111113
it('should fail with no args and callback', done => {
114+
/* eslint-disable-next-line no-unused-vars */
112115
jsonld.toRDF((err, output) => {
113116
assert(err);
114117
done();
@@ -118,6 +121,7 @@ describe('other toRDF tests', () => {
118121
it('should fail with no args and promise', done => {
119122
const p = jsonld.toRDF();
120123
assert(p instanceof Promise);
124+
/* eslint-disable-next-line no-unused-vars */
121125
p.then(output => {
122126
assert.fail();
123127
}).catch(e => {
@@ -127,6 +131,7 @@ describe('other toRDF tests', () => {
127131
});
128132

129133
it('should fail for bad format and callback', done => {
134+
/* eslint-disable-next-line no-unused-vars */
130135
jsonld.toRDF({}, {format: 'bogus'}, (err, output) => {
131136
assert(err);
132137
assert.equal(err.name, 'jsonld.UnknownFormat');
@@ -198,6 +203,7 @@ describe('other fromRDF tests', () => {
198203
it('should process with options and promise', done => {
199204
const p = jsonld.fromRDF(emptyNQuads, {});
200205
assert(p instanceof Promise);
206+
/* eslint-disable-next-line no-unused-vars */
201207
p.catch(e => {
202208
assert.fail();
203209
}).then(output => {
@@ -209,6 +215,7 @@ describe('other fromRDF tests', () => {
209215
it('should process with no options and promise', done => {
210216
const p = jsonld.fromRDF(emptyNQuads);
211217
assert(p instanceof Promise);
218+
/* eslint-disable-next-line no-unused-vars */
212219
p.catch(e => {
213220
assert.fail();
214221
}).then(output => {
@@ -218,6 +225,7 @@ describe('other fromRDF tests', () => {
218225
});
219226

220227
it('should fail with no args and callback', done => {
228+
/* eslint-disable-next-line no-unused-vars */
221229
jsonld.fromRDF((err, output) => {
222230
assert(err);
223231
done();
@@ -227,6 +235,7 @@ describe('other fromRDF tests', () => {
227235
it('should fail with no args and promise', done => {
228236
const p = jsonld.fromRDF();
229237
assert(p instanceof Promise);
238+
/* eslint-disable-next-line no-unused-vars */
230239
p.then(output => {
231240
assert.fail();
232241
}).catch(e => {
@@ -236,6 +245,7 @@ describe('other fromRDF tests', () => {
236245
});
237246

238247
it('should fail for bad format and callback', done => {
248+
/* eslint-disable-next-line no-unused-vars */
239249
jsonld.fromRDF(emptyNQuads, {format: 'bogus'}, (err, output) => {
240250
assert(err);
241251
assert.equal(err.name, 'jsonld.UnknownFormat');

tests/node-document-loader-tests.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*
44
* @author goofballLogic
55
*/
6+
/* eslint-disable quote-props */
67
const jsonld = require('..');
78
const assert = require('assert');
89

@@ -17,6 +18,7 @@ describe('For the node.js document loader', function() {
1718
describe('When built with no options specified', function() {
1819
it('loading should work', function(done) {
1920
jsonld.useDocumentLoader(documentLoaderType);
21+
/* eslint-disable-next-line no-unused-vars */
2022
jsonld.expand('http://schema.org/', function(err, expanded) {
2123
assert.ifError(err);
2224
done();
@@ -55,7 +57,9 @@ describe('For the node.js document loader', function() {
5557
'Authorization': 'Bearer d783jkjaods9f87o83hj'
5658
};
5759

58-
it('loading should pass the headers through on the request', function(done) {
60+
/* eslint-disable indent */
61+
it('loading should pass the headers through on the request',
62+
function(done) {
5963
jsonld.useDocumentLoader(documentLoaderType, options);
6064
requestMock.calls = [];
6165
const iri = 'http://some.thing.test.com/my-thing.jsonld';
@@ -75,9 +79,12 @@ describe('For the node.js document loader', function() {
7579
done();
7680
});
7781
});
82+
/* eslint-enable indent */
7883
});
7984

80-
describe('When built using headers that already contain an Accept header', function() {
85+
/* eslint-disable indent */
86+
describe('When built using headers that already contain an Accept header',
87+
function() {
8188
const options = {request: requestMock};
8289
options.headers = {
8390
'x-test-header-3': 'Third value',
@@ -99,5 +106,5 @@ describe('For the node.js document loader', function() {
99106
done();
100107
});
101108
});
102-
109+
/* eslint-enable indent */
103110
});

tests/test-common.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ function addTest(manifest, test, tests) {
836836
.on('error', err => {
837837
reject(new Error(err));
838838
})
839-
.on('complete', e => {
839+
.on('complete', () => {
840840
resolve();
841841
})
842842
.run({async: true});
@@ -1214,7 +1214,7 @@ function createDocumentLoader(test) {
12141214
return p.then(readJson).then(json => {
12151215
doc.document = json;
12161216
return doc;
1217-
}).catch(err => {
1217+
}).catch(() => {
12181218
throw {name: 'loading document failed', url};
12191219
});
12201220
}

tests/test-karma.js

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*
2323
* Copyright (c) 2011-2017 Digital Bazaar, Inc. All rights reserved.
2424
*/
25+
/* global serverRequire */
2526
// FIXME: hack to ensure delay is set first
2627
mocha.setup({delay: true, ui: 'bdd'});
2728

@@ -100,6 +101,7 @@ const options = {
100101
nodejs: false,
101102
assert,
102103
jsonld,
104+
/* eslint-disable-next-line no-unused-vars */
103105
exit: code => {
104106
console.error('exit not implemented');
105107
throw new Error('exit not implemented');
@@ -126,6 +128,7 @@ const options = {
126128
return fs.outputFile(filename, data);
127129
});
128130
},
131+
/* eslint-disable-next-line no-unused-vars */
129132
import: f => {
130133
console.error('import not implemented');
131134
}

tests/test-webidl.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55
*
66
* Copyright (c) 2011-2017 Digital Bazaar, Inc. All rights reserved.
77
*/
8+
/* global IdlArray */
9+
/* global add_result_callback */
10+
/* global add_completion_callback */
11+
/* global done */
12+
/* eslint-disable no-var */
813
const assert = require('chai').assert;
9-
const jsonld = require('..');
1014

1115
require('./webidl/testharness.js');
1216
require('./webidl/WebIDLParser.js');
@@ -71,6 +75,7 @@ return new Promise((resolve, reject) => {
7175
done();
7276
};
7377
});
78+
/* eslint-disable-next-line no-unused-vars */
7479
add_completion_callback(function(tests, status) {
7580
resolve(suite);
7681
});

0 commit comments

Comments
 (0)