Permalink
Jump to Line
Branch:
master
Switch branches/tags
dollar-ignores
feature/new-rule-require-new-lines-in-array
gh-pages
issues/1242
issues/1271-related
master
mdevils/cst
Nothing to show
Nothing to show
Fetching contributors…
![]()
Cannot retrieve contributors at this time
| /** | |
| * Requires the file to be at most the number of lines specified | |
| * | |
| * Type: `Integer` | |
| * | |
| * Values: | |
| * - `Integer`: file should be at most the number of lines specified | |
| * | |
| * #### Example | |
| * | |
| * ```js | |
| * "maximumNumberOfLines": 100 | |
| * ``` | |
| */ | |
| var assert = require('assert'); | |
| module.exports = function() {}; | |
| module.exports.prototype = { | |
| configure: function(options) { | |
| assert( | |
| typeof options === 'number', | |
| this.getOptionName() + ' option requires number value or should be removed' | |
| ); | |
| this._maximumNumberOfLines = options; | |
| }, | |
| getOptionName: function() { | |
| return 'maximumNumberOfLines'; | |
| }, | |
| check: function(file, errors) { | |
| var firstToken = file.getFirstToken(); | |
| var lastToken = file.getLastToken(); | |
| errors.assert.linesBetween({ | |
| token: firstToken, | |
| nextToken: lastToken, | |
| atMost: this._maximumNumberOfLines - 1, | |
| message: 'File must be at most ' + this._maximumNumberOfLines + ' lines long' | |
| }); | |
| } | |
| }; |