1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 | var assert = require('assert');
|
28 |
|
29 | module.exports = function() {};
|
30 |
|
31 | module.exports.prototype = {
|
32 |
|
33 | configure: function(options) {
|
34 | assert(
|
35 | options === true,
|
36 | this.getOptionName() + ' option requires a true value or should be removed'
|
37 | );
|
38 | },
|
39 |
|
40 | getOptionName: function() {
|
41 | return 'disallowSpaceBetweenArguments';
|
42 | },
|
43 |
|
44 | check: function(file, errors) {
|
45 | file.iterateNodesByType(['CallExpression'], function(node) {
|
46 | node.arguments.forEach(function(param) {
|
47 | var token = file.getFirstNodeToken(param);
|
48 | var punctuatorToken = file.getPrevToken(token);
|
49 |
|
50 | if (punctuatorToken.value === ',') {
|
51 | errors.assert.noWhitespaceBetween({
|
52 | token: punctuatorToken,
|
53 | nextToken: file.getNextToken(punctuatorToken),
|
54 | message: 'Illegal space between arguments'
|
55 | });
|
56 | }
|
57 | });
|
58 | });
|
59 | }
|
60 | };
|