Skip to content

Commit 4e39a46

Browse files
requireDictionaryWords: Rename options
1 parent e6552a3 commit 4e39a46

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

lib/rules/require-dictionary-words.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
* - `Object`:
1313
* - `dictionaries`: (default `["english"]`) array of dictionary names including
1414
* `"english"`, `"american"`, `"british"` and `"canadian"`
15-
* - `allowWordsInIdentifiersAndProperties`: additional words allowed anywhere
15+
* - `allowWords`: additional words allowed anywhere
1616
* - `allowWordsInProperties`: additional words allowed only as properties
17-
* - `allowNamesForIdentifiersAndProperties`: names ignored by spellcheck
18-
* - `allowNamesForProperties`: names ignored by spellcheck when used as properties
19-
* - `excluded`: words to exclude from the dictionaries
17+
* - `allowNames`: names ignored by spellcheck
18+
* - `allowNamesAsProperties`: names ignored by spellcheck when used as properties
19+
* - `excludeWords`: words to exclude from the dictionaries
2020
*
2121
* #### Example
2222
*
@@ -25,11 +25,11 @@
2525
*
2626
* "requireDictionaryWords": {
2727
* "dictionaries": [ "english", "american" ],
28-
* "allowWordsInIdentifiersAndProperties": [ "transclude" ],
28+
* "allowWords": [ "transclude" ],
2929
* "allowWordsInProperties": [ "chmod" ],
30-
* "allowNamesForIdentifiersAndProperties": [ "$stateParams", "util" ],
31-
* "allowNamesForProperties": [ "src" ],
32-
* "excluded": [ "i" ]
30+
* "allowNames": [ "$stateParams", "util" ],
31+
* "allowNamesAsProperties": [ "src" ],
32+
* "excludeWords": [ "i" ]
3333
* }
3434
* ```
3535
*
@@ -63,7 +63,7 @@
6363
* var colour = 'papayawhip';
6464
* ```
6565
*
66-
* ##### Valid for mode `"allowWordsInIdentifiersAndProperties": [ "transclude" ]`
66+
* ##### Valid for mode `"allowWords": [ "transclude" ]`
6767
*
6868
* ```js
6969
* var transclude = function() {};
@@ -85,33 +85,33 @@
8585
* var chmod = 0777;
8686
* ```
8787
*
88-
* ##### Valid for mode `"allowNamesForIdentifiersAndProperties": [ "$stateParams", "util" ]`
88+
* ##### Valid for mode `"allowNames": [ "$stateParams", "util" ]`
8989
*
9090
* ```js
9191
* var util = require('util');
9292
* function Controller($stateParams) {}
9393
* ```
9494
*
95-
* ##### Invalid for mode `"allowNamesForIdentifiersAndProperties": [ "$stateParams", "util" ]`
95+
* ##### Invalid for mode `"allowNames": [ "$stateParams", "util" ]`
9696
*
9797
* ```js
9898
* var stringUtil = {};
9999
* var params = {};
100100
* ```
101101
*
102-
* ##### Valid for mode `"allowNamesForProperties": [ "src" ]`
102+
* ##### Valid for mode `"allowNamesAsProperties": [ "src" ]`
103103
*
104104
* ```js
105105
* element.src = 'https://youtu.be/dQw4w9WgXcQ';
106106
* ```
107107
*
108-
* ##### Invalid for mode `"allowNamesForProperties": [ "src" ]`
108+
* ##### Invalid for mode `"allowNamesAsProperties": [ "src" ]`
109109
*
110110
* ```js
111111
* var data = { videoSrc: 'youtube' };
112112
* ```
113113
*
114-
* ##### Invalid for mode `"excluded": [ "i" ]`
114+
* ##### Invalid for mode `"excludeWords": [ "i" ]`
115115
*
116116
* ```js
117117
* for (var i = 0; i < array.length; i++) {}
@@ -205,11 +205,11 @@ module.exports.prototype = {
205205
);
206206

207207
var wordDictionaries = ['english'];
208-
var identifierAndPropertyWords;
209-
var propertyWords;
210-
var identifierAndPropertyNames;
211-
var propertyNames;
212-
var excluded;
208+
var allowedWords;
209+
var allowedPropertyWords;
210+
var allowedNames;
211+
var allowedPropertyNames;
212+
var excludedWords;
213213

214214
function arrayOption(option) {
215215
var value = options[option];
@@ -225,11 +225,11 @@ module.exports.prototype = {
225225

226226
if (wasObject) {
227227
wordDictionaries = arrayOption('dictionaries') || wordDictionaries;
228-
identifierAndPropertyWords = arrayOption('allowWordsInIdentifiersAndProperties');
229-
propertyWords = arrayOption('allowWordsInProperties');
230-
identifierAndPropertyNames = arrayOption('allowNamesForIdentifiersAndProperties');
231-
propertyNames = arrayOption('allowNamesForProperties');
232-
excluded = arrayOption('excluded');
228+
allowedWords = arrayOption('allowWords');
229+
allowedPropertyWords = arrayOption('allowWordsInProperties');
230+
allowedNames = arrayOption('allowNames');
231+
allowedPropertyNames = arrayOption('allowNamesAsProperties');
232+
excludedWords = arrayOption('excludeWords');
233233
}
234234

235235
this._wordDictionaries = wordDictionaries.map(function(language) {
@@ -251,26 +251,26 @@ module.exports.prototype = {
251251
}
252252
return wordlist[language];
253253
});
254-
if (identifierAndPropertyWords) {
255-
this._wordDictionaries.push(identifierAndPropertyWords);
254+
if (allowedWords) {
255+
this._wordDictionaries.push(allowedWords);
256256
}
257257

258258
this._propertyWordDictionaries = this._wordDictionaries.slice();
259-
if (propertyWords) {
260-
this._propertyWordDictionaries.push(propertyWords);
259+
if (allowedPropertyWords) {
260+
this._propertyWordDictionaries.push(allowedPropertyWords);
261261
}
262262

263263
this._nameDictionaries = [];
264-
if (identifierAndPropertyNames) {
265-
this._nameDictionaries.push(identifierAndPropertyNames);
264+
if (allowedNames) {
265+
this._nameDictionaries.push(allowedNames);
266266
}
267267

268268
this._propertyNameDictionaries = this._nameDictionaries.slice();
269-
if (propertyNames) {
270-
this._propertyNameDictionaries.push(propertyNames);
269+
if (allowedPropertyNames) {
270+
this._propertyNameDictionaries.push(allowedPropertyNames);
271271
}
272272

273-
this._excluded = excluded;
273+
this._excludedWords = excludedWords;
274274
},
275275

276276
getOptionName: function() {
@@ -284,7 +284,7 @@ module.exports.prototype = {
284284
if (!dictionariesHaveWord(nameDictionaries, name)) {
285285
checkWords(
286286
wordDictionaries,
287-
_this._excluded,
287+
_this._excludedWords,
288288
errors,
289289
name,
290290
start

test/specs/rules/require-dictionary-words.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ describe('rules/require-dictionary-words', function() {
8383
});
8484
});
8585

86-
describe('allowWordsInIdentifiersAndProperties', function() {
86+
describe('allowWords', function() {
8787
beforeEach(function() {
8888
checker.configure({
8989
requireDictionaryWords: {
90-
allowWordsInIdentifiersAndProperties: ['asdf', 'jkl']
90+
allowWords: ['asdf', 'jkl']
9191
}
9292
});
9393
});
@@ -100,11 +100,11 @@ describe('rules/require-dictionary-words', function() {
100100
});
101101
});
102102

103-
describe('allowNamesForIdentifiersAndProperties', function() {
103+
describe('allowNames', function() {
104104
beforeEach(function() {
105105
checker.configure({
106106
requireDictionaryWords: {
107-
allowNamesForIdentifiersAndProperties: ['asdf', 'jkl']
107+
allowNames: ['asdf', 'jkl']
108108
}
109109
});
110110
});
@@ -140,11 +140,11 @@ describe('rules/require-dictionary-words', function() {
140140
});
141141
});
142142

143-
describe('allowNamesForProperties', function() {
143+
describe('allowNamesAsProperties', function() {
144144
beforeEach(function() {
145145
checker.configure({
146146
requireDictionaryWords: {
147-
allowNamesForProperties: ['asdf', 'jkl']
147+
allowNamesAsProperties: ['asdf', 'jkl']
148148
}
149149
});
150150
});
@@ -163,11 +163,11 @@ describe('rules/require-dictionary-words', function() {
163163
});
164164
});
165165

166-
describe('excluded', function() {
166+
describe('excludeWords', function() {
167167
beforeEach(function() {
168168
checker.configure({
169169
requireDictionaryWords: {
170-
excluded: ['good']
170+
excludeWords: ['good']
171171
}
172172
});
173173
});

0 commit comments

Comments
 (0)