1 | module.exports = function (context) {
|
2 | ;
|
3 |
|
4 | // TODO use context.getSourceLines()
|
5 | var src = require('fs').readFileSync(context.getFilename(), 'utf-8');
|
6 | var linesN = src.split(require('os').EOL).length;
|
7 | // console.log(context.getFilename(), 'has', linesN, 'lines');
|
8 |
|
9 | var limit = parseInt(context.options[0]);
|
10 | if (limit > 0 && linesN > limit) {
|
11 | context.report({
|
12 | loc: {
|
13 | start: { line: 0 }
|
14 | }
|
15 | }, 'file line count ' + linesN + ' exceeded line limit ' + limit);
|
16 | }
|
17 |
|
18 | return {};
|
19 | };
|