Skip to content

Commit c804dbf

Browse files
committed
build: lint all packages
1 parent 66006cf commit c804dbf

15 files changed

+97
-97
lines changed

packages/csv-generate/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@
6464
"build": "npm run build:rollup && npm run build:ts",
6565
"build:rollup": "npx rollup -c",
6666
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
67-
"lint": "npm run lint:coffee && npm run lint:js",
68-
"lint:coffee": "coffeelint test/*.coffee",
69-
"lint:js": "eslint lib/*.js",
67+
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
68+
"lint:lib": "eslint --fix lib/*.js",
69+
"lint:samples": "eslint --fix samples/*.js",
70+
"lint:test": "coffeelint --fix test/*.coffee",
7071
"preversion": "npm run build && git add dist",
7172
"pretest": "npm run build",
7273
"test": "mocha 'test/**/*.{coffee,ts}'"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
import { generate } from 'csv-generate'
3-
import assert from 'assert'
2+
import { generate } from 'csv-generate';
3+
import assert from 'assert';
44

55
generate({
66
seed: 1,
@@ -11,5 +11,5 @@ generate({
1111
assert.deepEqual(records, [
1212
[ 'OMH', 'ONKCHhJmjadoA' ],
1313
[ 'D', 'GeACHiN' ]
14-
])
15-
})
14+
]);
15+
});
+17-18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
import { generate } from 'csv-generate'
3-
import assert from 'assert'
2+
import { generate } from 'csv-generate';
3+
import assert from 'assert';
44

5-
const records = []
5+
const records = [];
66
// Initialize the generator
77
generate({
88
seed: 1,
@@ -11,20 +11,19 @@ generate({
1111
length: 2
1212
})
1313
// Use the readable stream api to consume generated records
14-
.on('readable', function(){
15-
let record
16-
while(record = this.read()){
17-
records.push(record)
18-
}
19-
})
14+
.on('readable', function(){
15+
let record; while((record = this.read()) !== null){
16+
records.push(record);
17+
}
18+
})
2019
// Catch any error
21-
.on('error', function(err){
22-
console.error(err)
23-
})
20+
.on('error', function(err){
21+
console.error(err);
22+
})
2423
// Test that the generated records matched the expected records
25-
.on('end', function(){
26-
assert.deepEqual(records, [
27-
[ 'OMH', 'ONKCHhJmjadoA' ],
28-
[ 'D', 'GeACHiN' ]
29-
])
30-
})
24+
.on('end', function(){
25+
assert.deepEqual(records, [
26+
[ 'OMH', 'ONKCHhJmjadoA' ],
27+
[ 'D', 'GeACHiN' ]
28+
]);
29+
});
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

2-
import { generate } from 'csv-generate/sync'
3-
import assert from 'assert'
2+
import { generate } from 'csv-generate/sync';
3+
import assert from 'assert';
44

55
const records = generate({
66
seed: 1,
77
objectMode: true,
88
columns: 2,
99
length: 2
10-
})
10+
});
1111
assert.deepEqual(records, [
1212
[ 'OMH', 'ONKCHhJmjadoA' ],
1313
[ 'D', 'GeACHiN' ]
14-
])
14+
]);
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
import { generate } from 'csv-generate'
3-
import assert from 'assert'
2+
import { generate } from 'csv-generate';
3+
import assert from 'assert';
44

55
generate({
66
seed: 1,
@@ -11,5 +11,5 @@ generate({
1111
assert.deepEqual(records, [
1212
[ 'OMH', 'ONKCHhJmjadoA' ],
1313
[ 'D', 'GeACHiN' ]
14-
])
15-
})
14+
]);
15+
});
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11

2-
import { generate } from 'csv-generate'
3-
import assert from 'assert'
2+
import { generate } from 'csv-generate';
3+
import assert from 'assert';
44

55
generate({
66
seed: 1,
77
objectMode: true,
88
columns: 2,
99
length: 1
1010
})
11-
.on('readable', function(){
12-
let record
13-
while(record = this.read()){
14-
assert.deepEqual(record, [
15-
'OMH', 'ONKCHhJmjadoA'
16-
])
17-
}
18-
})
11+
.on('readable', function(){
12+
let record; while((record = this.read()) !== null){
13+
assert.deepEqual(record, [
14+
'OMH', 'ONKCHhJmjadoA'
15+
]);
16+
}
17+
});

packages/csv-generate/samples/pipe.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
import { generate } from 'csv-generate'
2+
import { generate } from 'csv-generate';
33

44
generate({
55
columns: ['int', 'bool'],
66
length: 2
77
})
8-
.pipe(process.stdout)
8+
.pipe(process.stdout);

packages/csv-parse/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@
8888
"build": "npm run build:rollup && npm run build:ts",
8989
"build:rollup": "npx rollup -c",
9090
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
91-
"lint": "npm run lint:test && npm run lint:lib && npm run lint:samples",
92-
"lint:test": "coffeelint test/*.coffee",
93-
"lint:lib": "eslint lib/*.js",
94-
"lint:samples": "eslint samples/*.js",
91+
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
92+
"lint:lib": "eslint --fix lib/*.js",
93+
"lint:samples": "eslint --fix samples/*.js",
94+
"lint:test": "coffeelint --fix test/*.coffee",
9595
"preversion": "npm run build && git add dist",
9696
"pretest": "npm run build",
9797
"test": "mocha 'test/**/*.{coffee,ts}'"

packages/csv-stringify/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
"build": "npm run build:rollup && npm run build:ts",
6565
"build:rollup": "npx rollup -c",
6666
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
67-
"lint": "npm run lint:test && npm run lint:lib && npm run lint:samples",
68-
"lint:test": "coffeelint test/*.coffee",
69-
"lint:lib": "eslint lib/*.js",
70-
"lint:samples": "eslint samples/*.js",
67+
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
68+
"lint:lib": "eslint --fix lib/*.js",
69+
"lint:samples": "eslint --fix samples/*.js",
70+
"lint:test": "coffeelint --fix test/*.coffee",
7171
"preversion": "npm run build && git add dist",
7272
"pretest": "npm run build",
7373
"test": "mocha 'test/**/*.{coffee,ts}'"

packages/csv/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@
8282
"build": "npm run build:rollup && npm run build:ts",
8383
"build:rollup": "npx rollup -c",
8484
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
85-
"lint": "npm run lint:coffee && npm run lint:js",
86-
"lint:coffee": "coffeelint test/*.coffee",
87-
"lint:js": "eslint lib/*.js",
85+
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
86+
"lint:lib": "eslint --fix lib/*.js",
87+
"lint:samples": "eslint --fix samples/*.js",
88+
"lint:test": "coffeelint --fix test/*.coffee",
8889
"preversion": "npm run build && git add dist",
8990
"pretest": "npm run build",
9091
"test": "mocha 'test/**/*.{coffee,ts}'"

packages/csv/samples/callback.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

2-
import * as csv from '../lib/index.js'
2+
import * as csv from '../lib/index.js';
33

44
csv.generate({seed: 1, columns: 2, length: 20}, function(err, data){
55
csv.parse(data, function(err, data){
66
csv.transform(data, function(data){
7-
return data.map(function(value){return value.toUpperCase()});
7+
return data.map(function(value){return value.toUpperCase();});
88
}, function(err, data){
99
csv.stringify(data, function(err, data){
1010
process.stdout.write(data);

packages/csv/samples/pipe.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11

22
// Import the package main module
3-
import * as csv from '../lib/index.js'
3+
import * as csv from '../lib/index.js';
44

55
// Run the pipeline
66
csv
77
// Generate 20 records
8-
.generate({
9-
delimiter: '|',
10-
length: 20
11-
})
8+
.generate({
9+
delimiter: '|',
10+
length: 20
11+
})
1212
// Transform CSV data into records
13-
.pipe(csv.parse({
14-
delimiter: '|'
15-
}))
13+
.pipe(csv.parse({
14+
delimiter: '|'
15+
}))
1616
// Transform each value into uppercase
17-
.pipe(csv.transform((record) => {
18-
return record.map((value) => {
19-
return value.toUpperCase()
20-
});
21-
}))
17+
.pipe(csv.transform((record) => {
18+
return record.map((value) => {
19+
return value.toUpperCase();
20+
});
21+
}))
2222
// Convert objects into a stream
23-
.pipe(csv.stringify({
24-
quoted: true
25-
}))
23+
.pipe(csv.stringify({
24+
quoted: true
25+
}))
2626
// Print the CSV stream to stdout
27-
.pipe(process.stdout)
27+
.pipe(process.stdout);

packages/csv/samples/pipe_funny.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
// Import the package main module
3-
import * as csv from '../lib/index.js'
3+
import * as csv from '../lib/index.js';
44
// Use the module
5-
csv.generate ({seed: 1, length: 20}).pipe(
6-
csv.parse ()).pipe(
7-
csv.transform (function(record){
8-
return record.map(function(value){
9-
return value.toUpperCase()
10-
})})).pipe(
11-
csv.stringify ()).pipe(process.stdout)
5+
csv.generate ({seed: 1, length: 20}).pipe(
6+
csv.parse ()).pipe(
7+
csv.transform (function(record){
8+
return record.map(function(value){
9+
return value.toUpperCase();
10+
});})).pipe(
11+
csv.stringify ()).pipe(process.stdout);

packages/csv/samples/stream.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11

2-
import * as csv from '../lib/index.js'
2+
import * as csv from '../lib/index.js';
33

4-
let i = 0
4+
let i = 0;
55

66
const generator = csv.generate({seed: 1, columns: 2, length: 20});
77
const parser = csv.parse();
88
const transformer = csv.transform(function(data){
9-
i++
10-
return data.map(function(value){return value.toUpperCase()});
9+
i++;
10+
return data.map(function(value){return value.toUpperCase();});
1111
});
1212
const stringifier = csv.stringify();
1313

1414
// Read generated CSV data and send it to the parser
1515
generator.on('readable', function(){
16-
let data; while(data = generator.read()){
16+
let data; while((data = generator.read()) !== null){
1717
parser.write(data);
1818
}
1919
});
2020
// When generation is over, close the parser
2121
generator.on('end', function(){
22-
parser.end()
22+
parser.end();
2323
});
2424

2525
// Read parsed records and send them to the transformer
2626
parser.on('readable', function(){
27-
let data; while(data = parser.read()){
27+
let data; while((data = parser.read()) !== null){
2828
transformer.write(data);
2929
}
3030
});
3131
// When parsing is over, close the transformer
3232
parser.on('end', function(){
33-
transformer.end()
33+
transformer.end();
3434
});
3535

3636
// Read transformed records and send them to the stringifier
3737
transformer.on('readable', function(){
38-
let data; while(data = transformer.read()){
38+
let data; while((data = transformer.read()) !== null){
3939
stringifier.write(data);
4040
}
4141
});
@@ -46,7 +46,7 @@ transformer.on('end', function(){
4646

4747
// Read CSV data and print it to stdout
4848
stringifier.on('readable', function(){
49-
let data; while(data = stringifier.read()){
49+
let data; while((data = stringifier.read()) !== null){
5050
process.stdout.write(data);
5151
}
5252
});

packages/stream-transform/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@
6464
"build": "npm run build:rollup && npm run build:ts",
6565
"build:rollup": "npx rollup -c",
6666
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
67-
"lint": "npm run lint:test && npm run lint:lib && npm run lint:samples",
68-
"lint:test": "coffeelint test/*.coffee",
69-
"lint:lib": "eslint lib/*.js",
70-
"lint:samples": "eslint samples/*.js",
67+
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
68+
"lint:lib": "eslint --fix lib/*.js",
69+
"lint:samples": "eslint --fix samples/*.js",
70+
"lint:test": "coffeelint --fix test/*.coffee",
7171
"preversion": "npm run build && git add dist",
7272
"pretest": "npm run build",
7373
"test": "mocha 'test/**/*.{coffee,ts}'"

0 commit comments

Comments
 (0)