Skip to content

Commit 3de2a25

Browse files
committed
Update indentation to latest ESLint.
1 parent 3c1c629 commit 3de2a25

File tree

8 files changed

+128
-141
lines changed

8 files changed

+128
-141
lines changed

lib/N3Lexer.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ var immediately = typeof setImmediate === 'function' ? setImmediate :
66
// Regular expression and replacement string to escape N3 strings.
77
// Note how we catch invalid unicode sequences separately (they will trigger an error).
88
var escapeSequence = /\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\[uU]|\\(.)/g;
9-
var escapeReplacements = { '\\': '\\', "'": "'", '"': '"',
10-
'n': '\n', 'r': '\r', 't': '\t', 'f': '\f', 'b': '\b',
11-
'_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&',
12-
'(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=',
13-
'/': '/', '?': '?', '#': '#', '@': '@', '%': '%' };
9+
var escapeReplacements = {
10+
'\\': '\\', "'": "'", '"': '"',
11+
'n': '\n', 'r': '\r', 't': '\t', 'f': '\f', 'b': '\b',
12+
'_': '_', '~': '~', '.': '.', '-': '-', '!': '!', '$': '$', '&': '&',
13+
'(': '(', ')': ')', '*': '*', '+': '+', ',': ',', ';': ';', '=': '=',
14+
'/': '/', '?': '?', '#': '#', '@': '@', '%': '%',
15+
};
1416
var illegalIriChars = /[\x00-\x20<>\\"\{\}\|\^\`]/;
1517

1618
// ## Constructor

lib/N3Parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,8 @@ N3Parser.prototype = {
738738

739739
// ### `_triple` emits a triple through the callback.
740740
_triple: function (subject, predicate, object, graph) {
741-
this._callback(null, { subject: subject, predicate: predicate, object: object,
742-
graph: graph || '' });
741+
this._callback(null,
742+
{ subject: subject, predicate: predicate, object: object, graph: graph || '' });
743743
},
744744

745745
// ### `_error` emits an error message through the callback.

lib/N3Writer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ var RDF_PREFIX = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
1010
// Characters in literals that require escaping
1111
var escape = /["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,
1212
escapeAll = /["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,
13-
escapeReplacements = { '\\': '\\\\', '"': '\\"', '\t': '\\t',
14-
'\n': '\\n', '\r': '\\r', '\b': '\\b', '\f': '\\f' };
13+
escapeReplacements = {
14+
'\\': '\\\\', '"': '\\"', '\t': '\\t',
15+
'\n': '\\n', '\r': '\\r', '\b': '\\b', '\f': '\\f',
16+
};
1517

1618
// ## Constructor
1719
function N3Writer(outputStream, options) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"colors": "^1.1.2",
2424
"coveralls": "^2.11.14",
2525
"docco": "^0.7.0",
26-
"eslint": "^3.4.0",
26+
"eslint": "^3.10.0",
2727
"mocha": "^3.0.2",
2828
"nyc": "^8.3.0",
2929
"pre-commit": "^1.1.3",

spec/SpecTester.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ SpecTester.prototype.run = function () {
6464
async.mapLimit(manifest.tests, workers,
6565
// 1.2.1 Execute an individual test
6666
function (test, callback) {
67-
async.series({ actionStream: self._fetch.bind(self, test.action),
68-
resultStream: self._fetch.bind(self, test.result) },
69-
function (error, results) {
70-
if (error) return callback(error);
71-
self._performTest(test, results.actionStream, callback);
72-
});
67+
async.series({
68+
actionStream: self._fetch.bind(self, test.action),
69+
resultStream: self._fetch.bind(self, test.result),
70+
},
71+
function (error, results) {
72+
if (error) return callback(error);
73+
self._performTest(test, results.actionStream, callback);
74+
});
7375
},
7476
// 1.2.2 Show the summary of all performed tests
7577
function showSummary(error, tests) {

test/N3Parser-test.js

Lines changed: 28 additions & 56 deletions
Large diffs are not rendered by default.

test/N3StreamWriter-test.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,39 @@ describe('N3StreamWriter', function () {
2020

2121
describe('An N3StreamWriter instance', function () {
2222
it('should serialize 0 triples',
23-
shouldSerialize([], ''));
23+
shouldSerialize(''));
2424

2525
it('should serialize 1 triple',
26-
shouldSerialize([['abc', 'def', 'ghi']],
26+
shouldSerialize(['abc', 'def', 'ghi'],
2727
'<abc> <def> <ghi>.\n'));
2828

2929
it('should serialize 2 triples',
30-
shouldSerialize([['abc', 'def', 'ghi'],
31-
['jkl', 'mno', 'pqr']],
30+
shouldSerialize(['abc', 'def', 'ghi'],
31+
['jkl', 'mno', 'pqr'],
3232
'<abc> <def> <ghi>.\n' +
3333
'<jkl> <mno> <pqr>.\n'));
3434

3535
it('should serialize 3 triples',
36-
shouldSerialize([['abc', 'def', 'ghi'],
37-
['jkl', 'mno', 'pqr'],
38-
['stu', 'vwx', 'yz']],
36+
shouldSerialize(['abc', 'def', 'ghi'],
37+
['jkl', 'mno', 'pqr'],
38+
['stu', 'vwx', 'yz'],
3939
'<abc> <def> <ghi>.\n' +
4040
'<jkl> <mno> <pqr>.\n' +
4141
'<stu> <vwx> <yz>.\n'));
4242

4343
it('should not serialize a literal in the subject',
44-
shouldNotSerialize([['"a"', 'b', '"c']],
44+
shouldNotSerialize(['"a"', 'b', '"c'],
4545
'A literal as subject is not allowed: "a"'));
4646

4747
it('should not serialize a literal in the predicate',
48-
shouldNotSerialize([['a', '"b"', '"c']],
48+
shouldNotSerialize(['a', '"b"', '"c'],
4949
'A literal as predicate is not allowed: "b"'));
5050

5151
it('should use prefixes when possible',
5252
shouldSerialize({ prefixes: { a: 'http://a.org/', b: 'http://a.org/b#', c: 'http://a.org/b' } },
53-
[['http://a.org/bc', 'http://a.org/b#ef', 'http://a.org/bhi'],
54-
['http://a.org/bc/de', 'http://a.org/b#e#f', 'http://a.org/b#x/t'],
55-
['http://a.org/3a', 'http://a.org/b#3a', 'http://a.org/b#a3']],
53+
['http://a.org/bc', 'http://a.org/b#ef', 'http://a.org/bhi'],
54+
['http://a.org/bc/de', 'http://a.org/b#e#f', 'http://a.org/b#x/t'],
55+
['http://a.org/3a', 'http://a.org/b#3a', 'http://a.org/b#a3'],
5656
'@prefix a: <http://a.org/>.\n' +
5757
'@prefix b: <http://a.org/b#>.\n\n' +
5858
'a:bc b:ef a:bhi.\n' +
@@ -62,9 +62,11 @@ describe('N3StreamWriter', function () {
6262
});
6363

6464

65-
function shouldSerialize(options, tripleArrays, expectedResult) {
66-
if (!expectedResult)
67-
expectedResult = tripleArrays, tripleArrays = options, options = null;
65+
function shouldSerialize(/* options?, tripleArrays..., expectedResult */) {
66+
var tripleArrays = Array.prototype.slice.call(arguments),
67+
expectedResult = tripleArrays.pop(),
68+
options = tripleArrays[0] instanceof Array ? null : tripleArrays.shift();
69+
6870
return function (done) {
6971
var inputStream = new ArrayReader(tripleArrays),
7072
transform = new N3StreamWriter(options),
@@ -79,7 +81,10 @@ function shouldSerialize(options, tripleArrays, expectedResult) {
7981
};
8082
}
8183

82-
function shouldNotSerialize(tripleArrays, expectedMessage) {
84+
function shouldNotSerialize(/* tripleArrays..., expectedMessage */) {
85+
var tripleArrays = Array.prototype.slice.call(arguments),
86+
expectedMessage = tripleArrays.pop();
87+
8388
return function (done) {
8489
var inputStream = new ArrayReader(tripleArrays),
8590
transform = new N3StreamWriter(),

0 commit comments

Comments
 (0)