diff --git a/src/rules/noEmptyCharacterClassRule.ts b/src/rules/noEmptyCharacterClassRule.ts index 6985987..5a8754b 100644 --- a/src/rules/noEmptyCharacterClassRule.ts +++ b/src/rules/noEmptyCharacterClassRule.ts @@ -17,7 +17,7 @@ class NoEmptyCharacterClassWalker extends Lint.RuleWalker { } private validateEmptyCharacterClass(node: ts.LiteralExpression) { - if (!(/^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gim]*$/.test(node.text))) { + if (!(/^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gimu]*$/.test(node.text))) { this.addFailure(this.createFailure(node.getStart(), node.getWidth(), Rule.FAILURE_STRING)); } } diff --git a/src/test/rules/noEmptyCharacterClassRuleTests.ts b/src/test/rules/noEmptyCharacterClassRuleTests.ts index 8ad6161..68ce377 100644 --- a/src/test/rules/noEmptyCharacterClassRuleTests.ts +++ b/src/test/rules/noEmptyCharacterClassRuleTests.ts @@ -13,7 +13,8 @@ const scripts = { 'var foo = /[[]/;', 'var foo = /[\\[a-z[]]/;', 'var foo = /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\^\\$\\|]/g;', - 'var foo = /\\s*:\\s*/gim;' + 'var foo = /\\s*:\\s*/gim;', + 'var foo = /\u{1F4A9}/u;' ], invalid: [ 'var foo = /^abc[]/;',