Skip to content

Commit

Permalink
Fix escape-case missing cases (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Feb 12, 2020
1 parent eb1923d commit 892f054
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rules/escape-case.js
Expand Up @@ -7,8 +7,8 @@ const {
const getDocumentationUrl = require('./utils/get-documentation-url');
const replaceTemplateElement = require('./utils/replace-template-element');

const escapeWithLowercase = /(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\da-f]{2}|u[\da-f]{4}|u{[\da-f]+})/;
const escapePatternWithLowercase = /(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\da-f]{2}|u[\da-f]{4}|u{[\da-f]+}|c[a-z])/;
const escapeWithLowercase = /(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+})/;
const escapePatternWithLowercase = /(?<=(?:^|[^\\])(?:\\\\)*\\)(?<data>x[\dA-Fa-f]{2}|u[\dA-Fa-f]{4}|u{[\dA-Fa-f]+}|c[a-z])/;
const hasLowercaseCharacter = /[a-z]+/;
const message = 'Use uppercase characters for the value of the escape sequence.';

Expand Down
16 changes: 16 additions & 0 deletions test/escape-case.js
Expand Up @@ -72,6 +72,22 @@ ruleTester.run('escape-case', rule, {
errors,
output: 'const foo = "\\xA9";'
},
// Mixed cases
{
code: 'const foo = "\\xAa";',
errors,
output: 'const foo = "\\xAA";'
},
{
code: 'const foo = "\\uAaAa";',
errors,
output: 'const foo = "\\uAAAA";'
},
{
code: 'const foo = "\\u{AaAa}";',
errors,
output: 'const foo = "\\u{AAAA}";'
},
{
code: 'const foo = "\\ud834";',
errors,
Expand Down

0 comments on commit 892f054

Please sign in to comment.