eslint-plugin-unicorn
Advanced tools
Comparing version 2.0.1 to 2.1.0
{ | ||
"name": "eslint-plugin-unicorn", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Various awesome ESLint rules", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
'use strict'; | ||
const escapeWithLowercase = /\\(x[a-f0-9]{2}|u[a-f0-9]{4}|u\{([0-9a-f]{1,})\}|c[a-z])/; | ||
const hasLowercaseCharacter = /[a-z].*?[a-z]/; | ||
const message = 'Use uppercase characters for the value of the escape sequence.'; | ||
@@ -19,3 +20,3 @@ | ||
Literal(node) { | ||
if (typeof node.value === 'string' && node.raw.match(escapeWithLowercase)) { | ||
if (typeof node.value === 'string' && node.raw.match(escapeWithLowercase) && node.raw.match(hasLowercaseCharacter)) { | ||
context.report({ | ||
@@ -29,3 +30,3 @@ node, | ||
TemplateElement(node) { | ||
if (typeof node.value.raw === 'string' && node.value.raw.match(escapeWithLowercase)) { | ||
if (typeof node.value.raw === 'string' && node.value.raw.match(escapeWithLowercase) && node.value.raw.match(hasLowercaseCharacter)) { | ||
context.report({ | ||
@@ -32,0 +33,0 @@ node, |
'use strict'; | ||
const errorTypes = [ | ||
'Error', | ||
'EvalError', | ||
'RangeError', | ||
'ReferenceError', | ||
'SyntaxError', | ||
'TypeError', | ||
'URIError' | ||
]; | ||
const customError = /^(?:[A-Z][a-z0-9]*)*Error$/; | ||
@@ -18,3 +10,3 @@ const create = context => ({ | ||
if (arg.type === 'CallExpression' && errorTypes.indexOf(error.name) !== -1) { | ||
if (arg.type === 'CallExpression' && customError.test(error.name)) { | ||
context.report({ | ||
@@ -21,0 +13,0 @@ node, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25730
720