Skip to content

Instantly share code, notes, and snippets.

@vkbansal
Created February 6, 2017 16:54
Show Gist options
  • Save vkbansal/38ee7259f2b3d77525c67fd3fcae2555 to your computer and use it in GitHub Desktop.
Save vkbansal/38ee7259f2b3d77525c67fd3fcae2555 to your computer and use it in GitHub Desktop.
// run this before
// npm run eslint > lint.log
const fs = require('fs');
let data = fs.readFileSync('./lint.log', 'utf8');
let output = {};
for (let line of data.split('\n')) {
if (line.length === 0 || line.startsWith('/') || line.startsWith('>') || line.startsWith('✖')) continue;
const words = line.trim().split(/\s+/);
const rule = words.pop();
if (rule in output) {
output[rule]++;
} else {
output[rule] = 1;
}
}
console.log(output);
/*
master => postorder
no-warning-comments': 52,
'react/no-unused-prop-types': 11,
'react/prefer-stateless-function': 9, + 1
'react/sort-prop-types': 37,
'react/no-string-refs': 38,
'react/jsx-no-bind': 65, + 2
'react/jsx-handler-names': 35,
'react/no-multi-comp': 3, + 1
'react/no-did-mount-set-state': 1, + 2
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment