Skip to content

Commit

Permalink
build: lint all packages
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Oct 22, 2021
1 parent 66006cf commit c804dbf
Show file tree
Hide file tree
Showing 15 changed files with 97 additions and 97 deletions.
7 changes: 4 additions & 3 deletions packages/csv-generate/package.json
Expand Up @@ -64,9 +64,10 @@
"build": "npm run build:rollup && npm run build:ts",
"build:rollup": "npx rollup -c",
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
"lint": "npm run lint:coffee && npm run lint:js",
"lint:coffee": "coffeelint test/*.coffee",
"lint:js": "eslint lib/*.js",
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
"lint:lib": "eslint --fix lib/*.js",
"lint:samples": "eslint --fix samples/*.js",
"lint:test": "coffeelint --fix test/*.coffee",
"preversion": "npm run build && git add dist",
"pretest": "npm run build",
"test": "mocha 'test/**/*.{coffee,ts}'"
Expand Down
8 changes: 4 additions & 4 deletions packages/csv-generate/samples/api.callback.js
@@ -1,6 +1,6 @@

import { generate } from 'csv-generate'
import assert from 'assert'
import { generate } from 'csv-generate';
import assert from 'assert';

generate({
seed: 1,
Expand All @@ -11,5 +11,5 @@ generate({
assert.deepEqual(records, [
[ 'OMH', 'ONKCHhJmjadoA' ],
[ 'D', 'GeACHiN' ]
])
})
]);
});
35 changes: 17 additions & 18 deletions packages/csv-generate/samples/api.stream.js
@@ -1,8 +1,8 @@

import { generate } from 'csv-generate'
import assert from 'assert'
import { generate } from 'csv-generate';
import assert from 'assert';

const records = []
const records = [];
// Initialize the generator
generate({
seed: 1,
Expand All @@ -11,20 +11,19 @@ generate({
length: 2
})
// Use the readable stream api to consume generated records
.on('readable', function(){
let record
while(record = this.read()){
records.push(record)
}
})
.on('readable', function(){
let record; while((record = this.read()) !== null){
records.push(record);
}
})
// Catch any error
.on('error', function(err){
console.error(err)
})
.on('error', function(err){
console.error(err);
})
// Test that the generated records matched the expected records
.on('end', function(){
assert.deepEqual(records, [
[ 'OMH', 'ONKCHhJmjadoA' ],
[ 'D', 'GeACHiN' ]
])
})
.on('end', function(){
assert.deepEqual(records, [
[ 'OMH', 'ONKCHhJmjadoA' ],
[ 'D', 'GeACHiN' ]
]);
});
8 changes: 4 additions & 4 deletions packages/csv-generate/samples/api.sync.js
@@ -1,14 +1,14 @@

import { generate } from 'csv-generate/sync'
import assert from 'assert'
import { generate } from 'csv-generate/sync';
import assert from 'assert';

const records = generate({
seed: 1,
objectMode: true,
columns: 2,
length: 2
})
});
assert.deepEqual(records, [
[ 'OMH', 'ONKCHhJmjadoA' ],
[ 'D', 'GeACHiN' ]
])
]);
8 changes: 4 additions & 4 deletions packages/csv-generate/samples/options.objectmode.callback.js
@@ -1,6 +1,6 @@

import { generate } from 'csv-generate'
import assert from 'assert'
import { generate } from 'csv-generate';
import assert from 'assert';

generate({
seed: 1,
Expand All @@ -11,5 +11,5 @@ generate({
assert.deepEqual(records, [
[ 'OMH', 'ONKCHhJmjadoA' ],
[ 'D', 'GeACHiN' ]
])
})
]);
});
19 changes: 9 additions & 10 deletions packages/csv-generate/samples/options.objectmode.stream.js
@@ -1,18 +1,17 @@

import { generate } from 'csv-generate'
import assert from 'assert'
import { generate } from 'csv-generate';
import assert from 'assert';

generate({
seed: 1,
objectMode: true,
columns: 2,
length: 1
})
.on('readable', function(){
let record
while(record = this.read()){
assert.deepEqual(record, [
'OMH', 'ONKCHhJmjadoA'
])
}
})
.on('readable', function(){
let record; while((record = this.read()) !== null){
assert.deepEqual(record, [
'OMH', 'ONKCHhJmjadoA'
]);
}
});
4 changes: 2 additions & 2 deletions packages/csv-generate/samples/pipe.js
@@ -1,8 +1,8 @@

import { generate } from 'csv-generate'
import { generate } from 'csv-generate';

generate({
columns: ['int', 'bool'],
length: 2
})
.pipe(process.stdout)
.pipe(process.stdout);
8 changes: 4 additions & 4 deletions packages/csv-parse/package.json
Expand Up @@ -88,10 +88,10 @@
"build": "npm run build:rollup && npm run build:ts",
"build:rollup": "npx rollup -c",
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
"lint": "npm run lint:test && npm run lint:lib && npm run lint:samples",
"lint:test": "coffeelint test/*.coffee",
"lint:lib": "eslint lib/*.js",
"lint:samples": "eslint samples/*.js",
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
"lint:lib": "eslint --fix lib/*.js",
"lint:samples": "eslint --fix samples/*.js",
"lint:test": "coffeelint --fix test/*.coffee",
"preversion": "npm run build && git add dist",
"pretest": "npm run build",
"test": "mocha 'test/**/*.{coffee,ts}'"
Expand Down
8 changes: 4 additions & 4 deletions packages/csv-stringify/package.json
Expand Up @@ -64,10 +64,10 @@
"build": "npm run build:rollup && npm run build:ts",
"build:rollup": "npx rollup -c",
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
"lint": "npm run lint:test && npm run lint:lib && npm run lint:samples",
"lint:test": "coffeelint test/*.coffee",
"lint:lib": "eslint lib/*.js",
"lint:samples": "eslint samples/*.js",
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
"lint:lib": "eslint --fix lib/*.js",
"lint:samples": "eslint --fix samples/*.js",
"lint:test": "coffeelint --fix test/*.coffee",
"preversion": "npm run build && git add dist",
"pretest": "npm run build",
"test": "mocha 'test/**/*.{coffee,ts}'"
Expand Down
7 changes: 4 additions & 3 deletions packages/csv/package.json
Expand Up @@ -82,9 +82,10 @@
"build": "npm run build:rollup && npm run build:ts",
"build:rollup": "npx rollup -c",
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
"lint": "npm run lint:coffee && npm run lint:js",
"lint:coffee": "coffeelint test/*.coffee",
"lint:js": "eslint lib/*.js",
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
"lint:lib": "eslint --fix lib/*.js",
"lint:samples": "eslint --fix samples/*.js",
"lint:test": "coffeelint --fix test/*.coffee",
"preversion": "npm run build && git add dist",
"pretest": "npm run build",
"test": "mocha 'test/**/*.{coffee,ts}'"
Expand Down
4 changes: 2 additions & 2 deletions packages/csv/samples/callback.js
@@ -1,10 +1,10 @@

import * as csv from '../lib/index.js'
import * as csv from '../lib/index.js';

csv.generate({seed: 1, columns: 2, length: 20}, function(err, data){
csv.parse(data, function(err, data){
csv.transform(data, function(data){
return data.map(function(value){return value.toUpperCase()});
return data.map(function(value){return value.toUpperCase();});
}, function(err, data){
csv.stringify(data, function(err, data){
process.stdout.write(data);
Expand Down
34 changes: 17 additions & 17 deletions packages/csv/samples/pipe.js
@@ -1,27 +1,27 @@

// Import the package main module
import * as csv from '../lib/index.js'
import * as csv from '../lib/index.js';

// Run the pipeline
csv
// Generate 20 records
.generate({
delimiter: '|',
length: 20
})
.generate({
delimiter: '|',
length: 20
})
// Transform CSV data into records
.pipe(csv.parse({
delimiter: '|'
}))
.pipe(csv.parse({
delimiter: '|'
}))
// Transform each value into uppercase
.pipe(csv.transform((record) => {
return record.map((value) => {
return value.toUpperCase()
});
}))
.pipe(csv.transform((record) => {
return record.map((value) => {
return value.toUpperCase();
});
}))
// Convert objects into a stream
.pipe(csv.stringify({
quoted: true
}))
.pipe(csv.stringify({
quoted: true
}))
// Print the CSV stream to stdout
.pipe(process.stdout)
.pipe(process.stdout);
16 changes: 8 additions & 8 deletions packages/csv/samples/pipe_funny.js
@@ -1,11 +1,11 @@

// Import the package main module
import * as csv from '../lib/index.js'
import * as csv from '../lib/index.js';
// Use the module
csv.generate ({seed: 1, length: 20}).pipe(
csv.parse ()).pipe(
csv.transform (function(record){
return record.map(function(value){
return value.toUpperCase()
})})).pipe(
csv.stringify ()).pipe(process.stdout)
csv.generate ({seed: 1, length: 20}).pipe(
csv.parse ()).pipe(
csv.transform (function(record){
return record.map(function(value){
return value.toUpperCase();
});})).pipe(
csv.stringify ()).pipe(process.stdout);
20 changes: 10 additions & 10 deletions packages/csv/samples/stream.js
@@ -1,41 +1,41 @@

import * as csv from '../lib/index.js'
import * as csv from '../lib/index.js';

let i = 0
let i = 0;

const generator = csv.generate({seed: 1, columns: 2, length: 20});
const parser = csv.parse();
const transformer = csv.transform(function(data){
i++
return data.map(function(value){return value.toUpperCase()});
i++;
return data.map(function(value){return value.toUpperCase();});
});
const stringifier = csv.stringify();

// Read generated CSV data and send it to the parser
generator.on('readable', function(){
let data; while(data = generator.read()){
let data; while((data = generator.read()) !== null){
parser.write(data);
}
});
// When generation is over, close the parser
generator.on('end', function(){
parser.end()
parser.end();
});

// Read parsed records and send them to the transformer
parser.on('readable', function(){
let data; while(data = parser.read()){
let data; while((data = parser.read()) !== null){
transformer.write(data);
}
});
// When parsing is over, close the transformer
parser.on('end', function(){
transformer.end()
transformer.end();
});

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

// Read CSV data and print it to stdout
stringifier.on('readable', function(){
let data; while(data = stringifier.read()){
let data; while((data = stringifier.read()) !== null){
process.stdout.write(data);
}
});
Expand Down
8 changes: 4 additions & 4 deletions packages/stream-transform/package.json
Expand Up @@ -64,10 +64,10 @@
"build": "npm run build:rollup && npm run build:ts",
"build:rollup": "npx rollup -c",
"build:ts": "cp lib/*.ts dist/cjs && cp lib/*.ts dist/esm",
"lint": "npm run lint:test && npm run lint:lib && npm run lint:samples",
"lint:test": "coffeelint test/*.coffee",
"lint:lib": "eslint lib/*.js",
"lint:samples": "eslint samples/*.js",
"lint": "npm run lint:lib && npm run lint:samples && npm run lint:test",
"lint:lib": "eslint --fix lib/*.js",
"lint:samples": "eslint --fix samples/*.js",
"lint:test": "coffeelint --fix test/*.coffee",
"preversion": "npm run build && git add dist",
"pretest": "npm run build",
"test": "mocha 'test/**/*.{coffee,ts}'"
Expand Down

0 comments on commit c804dbf

Please sign in to comment.