Skip to content

Commit f2b1a93

Browse files
committed
Lint
Lint everything to meet current standards.
1 parent 4d454f9 commit f2b1a93

14 files changed

+123
-106
lines changed

examples/snippets/esm-usage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as csv from 'jquery-csv';
22
import * as fs from 'fs';
33

4-
let sample = './data/sample.csv';
4+
const sample = './data/sample.csv';
55
fs.readFile(sample, 'UTF-8', (err, fileContent) => {
66
if (err) { console.log(err); }
77
csv.toArrays(fileContent, {}, (err, data) => {

src/jquery.csv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint no-prototype-builtins: 0 */
12
/**
23
* jQuery-csv (jQuery Plugin)
34
*

test/csv.from_arrays.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ const csv = require('../src/jquery.csv.js');
33
const fixtures = require('./fixtures/fixtures.js');
44

55
test('$.csv.fromArrays() - should be able to format multi-entry/multi-cell data set', (t) => {
6-
let result = csv.fromArrays(fixtures.arrays1_obj);
7-
let expect = fixtures.arrays1_csv;
6+
const result = csv.fromArrays(fixtures.arrays1_obj);
7+
const expect = fixtures.arrays1_csv;
88
t.deepEqual(result, expect);
99
t.end();
1010
});
1111

1212
test('$.csv.fromArrays() - should be able to format multi-entry/multi-cell data set with escaped delimiters', (t) => {
13-
let result = csv.fromArrays(fixtures.arrays2_obj);
13+
const result = csv.fromArrays(fixtures.arrays2_obj);
1414
console.dir(result);
15-
let expect = fixtures.arrays2_csv;
15+
const expect = fixtures.arrays2_csv;
1616
t.deepEqual(result, expect);
1717
t.end();
1818
});

test/csv.on_parse_entry_hook.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ const fixtures = require('./fixtures/fixtures.js');
55
test('$.csv.toObjects onParseEntry hook callback - should be passed the data and state', (t) => {
66
let passedData, passedState;
77

8-
csv.toObjects(fixtures.objects_csv, { onParseEntry: (data, state) => {
9-
passedData = data;
10-
passedState = state;
11-
return data;
12-
} });
8+
csv.toObjects(fixtures.objects_csv, {
9+
onParseEntry: (data, state) => {
10+
passedData = data;
11+
passedState = state;
12+
return data;
13+
}
14+
});
1315

1416
t.isNot(passedData, null, 'data argument should not be null');
1517
t.isNot(passedState, null, 'state argument should not be null');
@@ -19,11 +21,13 @@ test('$.csv.toObjects onParseEntry hook callback - should be passed the data and
1921
test('$.csv.toArrays onParseEntry hook callback - should be passed the data and state', (t) => {
2022
let passedData, passedState;
2123

22-
csv.toArrays(fixtures.arrays1_csv, { onParseEntry: (data, state) => {
23-
passedData = data;
24-
passedState = state;
25-
return data;
26-
} });
24+
csv.toArrays(fixtures.arrays1_csv, {
25+
onParseEntry: (data, state) => {
26+
passedData = data;
27+
passedState = state;
28+
return data;
29+
}
30+
});
2731

2832
t.isNot(passedData, null, 'data argument should not be null');
2933
t.isNot(passedState, null, 'state argument should not be null');

test/csv.on_parse_value_hook.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ const fixtures = require('./fixtures/fixtures.js');
55
test('$.csv.toObjects onParseValue hook callback - should be passed the data and state', (t) => {
66
let passedData, passedState;
77

8-
csv.toObjects(fixtures.objects_csv, { onParseValue: (data, state) => {
9-
passedData = data;
10-
passedState = state;
11-
return data;
12-
} });
8+
csv.toObjects(fixtures.objects_csv, {
9+
onParseValue: (data, state) => {
10+
passedData = data;
11+
passedState = state;
12+
return data;
13+
}
14+
});
1315

1416
t.isNot(passedData, null, 'data argument should not be null');
1517
t.isNot(passedState, null, 'state argument should not be null');
@@ -19,11 +21,13 @@ test('$.csv.toObjects onParseValue hook callback - should be passed the data and
1921
test('$.csv.toArrays onParseValue hook callback - should be passed the data and state', (t) => {
2022
let passedData, passedState;
2123

22-
csv.toArrays(fixtures.arrays1_csv, { onParseValue: (data, state) => {
23-
passedData = data;
24-
passedState = state;
25-
return data;
26-
} });
24+
csv.toArrays(fixtures.arrays1_csv, {
25+
onParseValue: (data, state) => {
26+
passedData = data;
27+
passedState = state;
28+
return data;
29+
}
30+
});
2731

2832
t.isNot(passedData, null, 'data argument should not be null');
2933
t.isNot(passedState, null, 'state argument should not be null');

test/csv.on_post_parse_hook.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ const fixtures = require('./fixtures/fixtures.js');
55
test('$.csv.toObjects onPostParse hook callback - should be passed the data and state', (t) => {
66
let passedData, passedState;
77

8-
csv.toObjects(fixtures.objects_csv, { onPostParse: (data, state) => {
9-
passedData = data;
10-
passedState = state;
11-
} });
8+
csv.toObjects(fixtures.objects_csv, {
9+
onPostParse: (data, state) => {
10+
passedData = data;
11+
passedState = state;
12+
}
13+
});
1214

1315
t.isNot(passedData, null, 'data argument should not be null');
1416
t.isNot(passedState, null, 'state argument should not be null');
@@ -18,10 +20,12 @@ test('$.csv.toObjects onPostParse hook callback - should be passed the data and
1820
test('$.csv.toArrays onPostParse hook callback - should be passed the data and state', (t) => {
1921
let passedData, passedState;
2022

21-
csv.toArrays(fixtures.arrays1_csv, { onPostParse: (data, state) => {
22-
passedData = data;
23-
passedState = state;
24-
} });
23+
csv.toArrays(fixtures.arrays1_csv, {
24+
onPostParse: (data, state) => {
25+
passedData = data;
26+
passedState = state;
27+
}
28+
});
2529

2630
t.isNot(passedData, null, 'data argument should not be null');
2731
t.isNot(passedState, null, 'state argument should not be null');

test/csv.on_pre_parse_hook.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ const fixtures = require('./fixtures/fixtures.js');
55
test('$.csv.toObjects onPreParse hook callback - should be passed the raw csv and state', (t) => {
66
let passedCSV, passedState;
77

8-
csv.toObjects(fixtures.objects_csv, { onPreParse: (csv, state) => {
9-
passedCSV = csv;
10-
passedState = state;
11-
return csv;
12-
} });
8+
csv.toObjects(fixtures.objects_csv, {
9+
onPreParse: (csv, state) => {
10+
passedCSV = csv;
11+
passedState = state;
12+
return csv;
13+
}
14+
});
1315

1416
t.isNot(passedCSV, null, 'data argument should not be null');
1517
t.isNot(passedState, null, 'state argument should not be null');
@@ -19,11 +21,13 @@ test('$.csv.toObjects onPreParse hook callback - should be passed the raw csv an
1921
test('$.csv.toArrays onPreParse hook callback - should be passed the raw csv and state', (t) => {
2022
let passedCSV, passedState;
2123

22-
csv.toArrays(fixtures.arrays1_csv, { onPreParse: (csv, state) => {
23-
passedCSV = csv;
24-
passedState = state;
25-
return csv;
26-
} });
24+
csv.toArrays(fixtures.arrays1_csv, {
25+
onPreParse: (csv, state) => {
26+
passedCSV = csv;
27+
passedState = state;
28+
return csv;
29+
}
30+
});
2731

2832
t.isNot(passedCSV, null, 'data argument should not be null');
2933
t.isNot(passedState, null, 'state argument should not be null');

test/csv.parsers.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ const csv = require('../src/jquery.csv.js');
33
const fixtures = require('./fixtures/fixtures.js');
44

55
test('$.csv.parsers.splitLines() - should correctly split lines with default options', (t) => {
6-
let result = csv.parsers.splitLines(fixtures.defaults_fivelines_csv);
6+
const result = csv.parsers.splitLines(fixtures.defaults_fivelines_csv);
77
t.equal(typeof (result), 'object', 'the returned object should be an array');
88
t.true(Array.isArray(result), 'the returned object should be an array');
99
t.equal(result.length, 5, 'the returned array should contain 5 lines');
1010
t.end();
1111
});
1212

1313
test('$.csv.parsers.splitLines() - should correctly split lines with custom separator', (t) => {
14-
let options = {
14+
const options = {
1515
separator: ';'
1616
};
1717

18-
let result = csv.parsers.splitLines(fixtures.separator_fivelines_csv, options);
18+
const result = csv.parsers.splitLines(fixtures.separator_fivelines_csv, options);
1919
t.equal(typeof (result), 'object', 'the returned object should be an array');
2020
t.true(Array.isArray(result), 'the returned object should be an array');
2121
t.equal(result.length, 5, 'the returned array should contain 5 lines');
2222
t.end();
2323
});
2424

2525
test('$.csv.parsers.splitLines() - should throw an error for using the wrong separator', (t) => {
26-
let options = {
26+
const options = {
2727
separator: ';'
2828
};
2929

@@ -36,19 +36,19 @@ test('$.csv.parsers.splitLines() - should throw an error for using the wrong sep
3636
});
3737

3838
test('$.csv.parsers.splitLines() - should correctly split lines with custom delimiter', (t) => {
39-
let options = {
39+
const options = {
4040
delimiter: "'"
4141
};
4242

43-
let result = csv.parsers.splitLines(fixtures.delimiter_fivelines_csv, options);
43+
const result = csv.parsers.splitLines(fixtures.delimiter_fivelines_csv, options);
4444
t.equal(typeof (result), 'object', 'the returned object should be an array');
4545
t.true(Array.isArray(result), 'the returned object should be an array');
4646
t.equal(result.length, 5, 'the returned array should contain 5 lines');
4747
t.end();
4848
});
4949

5050
test('$.csv.parsers.splitLines() - should return undefined when csv is undefined', (t) => {
51-
let result = csv.parsers.splitLines();
51+
const result = csv.parsers.splitLines();
5252
t.equal(typeof (result), 'undefined');
5353
t.end();
5454
});

test/csv.to_array.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ const csv = require('../src/jquery.csv.js');
33
const fixtures = require('./fixtures/fixtures.js');
44

55
test('$.csv.toArray() - should be able to parse an entry containing multiple cells', (t) => {
6-
let result = csv.toArray(fixtures.array_csv);
7-
let expect = fixtures.array_obj;
6+
const result = csv.toArray(fixtures.array_csv);
7+
const expect = fixtures.array_obj;
88
t.deepEqual(result, expect);
99
t.end();
1010
});
1111

1212
test('$.csv.toArray() - should return [""] when input is empty', (t) => {
13-
let result = csv.toArray('');
13+
const result = csv.toArray('');
1414
t.equal(result.length, 1);
1515
t.end();
1616
});
1717

1818
test('$.csv.toArray() - should return ["a1"] when input is "a1"', (t) => {
19-
let result = csv.toArray('a1');
19+
const result = csv.toArray('a1');
2020
t.equal(result.length, 1);
2121
t.equal(result[0], 'a1');
2222
t.end();

test/csv.to_arrays.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ const csv = require('../src/jquery.csv.js');
33
const fixtures = require('./fixtures/fixtures.js');
44

55
test('$.csv.toArrays() - should be able to parse multi-entry/multi-cell input', (t) => {
6-
let result = csv.toArrays(fixtures.arrays1_csv);
7-
let expect = fixtures.arrays1_obj;
6+
const result = csv.toArrays(fixtures.arrays1_csv);
7+
const expect = fixtures.arrays1_obj;
88
t.deepEqual(result, expect);
99
t.end();
1010
});
1111

1212
test('$.csv.toArrays() - should be able to parse multi-entry/multi-cell input with escaped delimiters', (t) => {
13-
let result = csv.toArrays(fixtures.arrays2_csv);
14-
let expect = fixtures.arrays2_obj;
13+
const result = csv.toArrays(fixtures.arrays2_csv);
14+
const expect = fixtures.arrays2_obj;
1515
t.deepEqual(result, expect);
1616
t.end();
1717
});

0 commit comments

Comments
 (0)