fix: lint parse.js + sync.js
This commit is contained in:
14
parse.js
14
parse.js
@@ -1,10 +1,8 @@
|
||||
import { parse } from 'csv-parse';
|
||||
import fs from 'node:fs';
|
||||
import zlib from 'zlib';
|
||||
import zlib from 'node:zlib';
|
||||
import mysql from 'mysql2';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
import './lib/dotenv.js';
|
||||
|
||||
if (process.argv.length != 3) {
|
||||
throw new Error('You should give a project dir');
|
||||
@@ -43,8 +41,8 @@ const flushBatch = (batch) => {
|
||||
};
|
||||
|
||||
// quand quelques ligne de csv sont parsées on les assemble puis on genere le sql
|
||||
parser.on('readable', function(){
|
||||
let record;
|
||||
parser.on('readable', () =>{
|
||||
let record = null;
|
||||
const batch = [];
|
||||
|
||||
while ((record = parser.read()) !== null) {
|
||||
@@ -60,10 +58,10 @@ parser.on('readable', function(){
|
||||
|
||||
flushBatch(batch);
|
||||
});
|
||||
parser.on('error', function(err){
|
||||
parser.on('error', (err) =>{
|
||||
console.error(err.message);
|
||||
});
|
||||
parser.on('end', function(){
|
||||
parser.on('end', () =>{
|
||||
connection.end();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user