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 | configure: function(options) {
|
33 | assert(
|
34 | options === true,
|
35 | this.getOptionName() + ' option requires a true value or should be removed'
|
36 | );
|
37 | },
|
38 |
|
39 | getOptionName: function() {
|
40 | return 'requireSpacesInCallExpression';
|
41 | },
|
42 |
|
43 | check: function(file, errors) {
|
44 | file.iterateNodesByType('CallExpression', function(node) {
|
45 | var lastCalleeToken = file.getLastNodeToken(node.callee);
|
46 | var roundBraceToken = file.findNextToken(lastCalleeToken, 'Punctuator', '(');
|
47 |
|
48 | errors.assert.whitespaceBetween({
|
49 | token: file.getPrevToken(roundBraceToken),
|
50 | nextToken: roundBraceToken,
|
51 | message: 'Missing space before opening round brace'
|
52 | });
|
53 | });
|
54 | }
|
55 | };
|