I am looking to be educated on this issue as I have spent a few days trying to resolve it on my own, to no avail.
I am using csv-parse to parse a CSV file.
I am using ESLint as my Linter
I am using the Airbnb JavaScript Style Guide plugin for ESLint
I am running this on the backend using NodeJS
My function is:
const { parse } = require('csv-parse');
const fs = require('fs');
const csvFile = 'myCsvFile.csv';
async function parseCsv(csvFile) {
const records = [];
const parser = fs.createReadStream(csvFile).pipe(parse({ delimiter: ',', columns: true }));
for await (const record of parser) {
records.push(record);
}
return records;
The function works well, however I am trying to abide by Airbnb's Style Guide, which does not like the for await...of
loop as it is hitting me with the no-restricted-syntax
violation.
I am curious on if there is a better way to write this to fall in line with Airbnb's Style Guide or, if this is one of those situations where it's OK to ignore the violation?