Last active
July 4, 2016 07:32
Revisions
-
peterreisz revised this gist
Jul 4, 2016 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ function u(i) { ] } }).filter(function(item) { return i < item.column && item.column <= j && item.line == 1; }).map(function(item) { return (s.substring(i + 1, item.column).match(/,/g) || []).length }); @@ -32,7 +32,6 @@ function fn() { if ('constant' != i[1] && 'value' != i[1] && d && d[d.length - 1] && !listed[m.name + n]) { listed[m.name + n] = true var e = u(d[d.length - 1].toString()); if (e.length > 0) { -
peterreisz created this gist
Apr 26, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ function u(i) { var s = 'function fn'+ i.substring(9), i = s.indexOf('('), j = s.indexOf(')'); return eslint.verify(s, { rules: { 'no-unused-vars': [ 'error', { vars: 'all', args: 'all' } ] } }).filter(function(item) { return i < item.column && item.column <= j; }).map(function(item) { return (s.substring(i + 1, item.column).match(/,/g) || []).length }); } function fn() { var p = []; var listed = {}; (function ud(m) { var m = angular.module(m), q = m._invokeQueue; m._invokeQueue.forEach(function(i) { var d = i[2][1], n = i[2][0]; if ('constant' != i[1] && 'value' != i[1] && d && d[d.length - 1] && !listed[m.name + n]) { listed[m.name + n] = true var e = u(d[d.length - 1].toString()); if (e.length > 0) { p.push({ module: m.name, name: n, unused: e.map(function(w) { return i[2][1][w]; }).join(', ') }); } } }); m.requires.forEach(ud); })(document.querySelector('[ng-app]').attributes.getNamedItem('ng-app').value) console.table(p); } if (window.eslint) { fn(); } else { var s=document.createElement('script'); s.setAttribute('src','http://eslint.org/js/app/eslint.js'); s.addEventListener('load', fn); document.body.appendChild(s); }