Created
August 16, 2019 22:38
-
-
Save cstumph/7d143e6ed803e91b2614aee6d08ea9e8 to your computer and use it in GitHub Desktop.
linting_report.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const text = fs.readFileSync('./lint errors').toString() | |
const txtArray = text.split('*') | |
function renderUniques (array) { | |
const set = new Set(array) | |
console.log(set) | |
return Array.from(set) | |
} | |
function renderCounts () { | |
const map = {} | |
txtArray.forEach((item) => { | |
const ruleName = item.split(' ').pop() | |
console.log('Rule:', ruleName) | |
!map[ruleName] ? map[ruleName] = 1 : map[ruleName]++ | |
}) | |
console.log(map) | |
} | |
function writeToFile (array, filename) { | |
const out = new Uint8Array(Buffer.from(array.join('\r\n'))) | |
fs.writeFileSync(`./${filename}`, out) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment