Wk-notes-01-06-eslint-finalise
Correctly write json to file
fs.writeFile(outputFilename, JSON.stringify(myData, null, 4), function(err) {
if(err) {
console.log(err);
} else {
console.log("JSON saved to " + outputFilename);
}
});eslint pitfall in custom CLI tool:
yargs.command(
"eslint",
"run the linter",
yargs => {
yargs
.option("fix", {
describe: "enable auto fixing option in eslint",
// ------***** BELOW *****---------
default: null
// ------***** ABOVE *****---------
});
},
argv => {
const eslint = require("./eslint").default;
eslint(argv);
}
)Last updated