Skip to content

Commit bab7e5a

Browse files
requireDictionaryWords: Support multiline comments
1 parent c8318c9 commit bab7e5a

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

lib/rules/require-dictionary-words.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ module.exports.prototype = {
327327
'NamesAsIdentifiers',
328328
'NamesAsProperties'
329329
].join('|'),
330-
'))\\s+(.*)',
330+
'))\\s+([\\s\\S]*)',
331331
].join(''));
332332

333333
comments.forEach(function(comment) {

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,42 @@ describe('rules/require-dictionary-words', function() {
264264
checker.configure({ requireDictionaryWords: true });
265265
});
266266

267+
it('should split', function() {
268+
assert(checker.checkString([
269+
'// jscs:allowWords',
270+
'asdf = 1',
271+
'jkl = 1'
272+
].join('\n')).getErrorCount() === 2);
273+
assert(checker.checkString([
274+
'// jscs:allowWords asdf',
275+
'asdf = 1',
276+
'jkl = 1'
277+
].join('\n')).getErrorCount() === 1);
278+
assert(checker.checkString([
279+
'// jscs:allowWords asdf, jkl',
280+
'asdf = 1',
281+
'jkl = 1'
282+
].join('\n')).isEmpty());
283+
assert(checker.checkString([
284+
'// jscs:allowWords asdf, jkl,',
285+
'asdf = 1',
286+
'jkl = 1'
287+
].join('\n')).isEmpty());
288+
assert(checker.checkString([
289+
'/* jscs:allowWords',
290+
' asdf, jkl */',
291+
'asdf = 1',
292+
'jkl = 1'
293+
].join('\n')).isEmpty());
294+
assert(checker.checkString([
295+
'/* jscs:allowWords',
296+
' asdf,',
297+
' jkl */',
298+
'asdf = 1',
299+
'jkl = 1'
300+
].join('\n')).isEmpty());
301+
});
302+
267303
it('should later allow and later disallow inline', function() {
268304
assert(checker.checkString([
269305
'asdf = 1',

0 commit comments

Comments
 (0)