1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | var assert = require('assert');
|
24 |
|
25 | module.exports = function() {};
|
26 |
|
27 | module.exports.prototype = {
|
28 |
|
29 | configure: function(keywords) {
|
30 | assert(Array.isArray(keywords), this.getOptionName() + ' option requires array value');
|
31 | this._keywords = keywords;
|
32 | },
|
33 |
|
34 | getOptionName: function() {
|
35 | return 'disallowKeywords';
|
36 | },
|
37 |
|
38 | check: function(file, errors) {
|
39 | file.iterateTokensByTypeAndValue('Keyword', this._keywords, function(token) {
|
40 | errors.add('Illegal keyword: ' + token.value, token);
|
41 | });
|
42 | }
|
43 |
|
44 | };
|