eslint-plugin-budapestian
Advanced tools
Comparing version 2.1.0 to 2.2.0
const decamelize = require("decamelize"); | ||
const { getVariableDeclaratorName, isConstDeclaration } = require("./ast-utl"); | ||
const { | ||
getIdentifierReplacementPattern, | ||
VALID_GLOBAL_CONSTANT_PATTERN, | ||
getIdentifierReplacementPattern, | ||
VALID_PARAMETER_PATTERN, | ||
VALID_LOCAL_VARIABLE_PATTERN, | ||
VALID_GLOBAL_VARIABLE_PATTERN, | ||
} = require("./pattern-utl"); | ||
@@ -17,3 +20,13 @@ /** | ||
function normalizeConstantName(pString) { | ||
return decamelize(pString).toLocaleUpperCase(); | ||
let lReturnValue = pString; | ||
if ( | ||
pString.match(VALID_PARAMETER_PATTERN) || | ||
pString.match(VALID_LOCAL_VARIABLE_PATTERN) || | ||
pString.match(VALID_GLOBAL_VARIABLE_PATTERN) | ||
) { | ||
lReturnValue = pString.substring(1); | ||
} | ||
return decamelize(lReturnValue).toLocaleUpperCase(); | ||
} | ||
@@ -20,0 +33,0 @@ |
@@ -7,2 +7,4 @@ const { | ||
VALID_GLOBAL_VARIABLE_PATTERN, | ||
VALID_PARAMETER_PATTERN, | ||
VALID_LOCAL_VARIABLE_PATTERN, | ||
getIdentifierReplacementPattern, | ||
@@ -22,2 +24,8 @@ prefixPascalCaseIdentifier, | ||
function normalizeGlobalVariableName(pString) { | ||
if ( | ||
pString.match(VALID_PARAMETER_PATTERN) || | ||
pString.match(VALID_LOCAL_VARIABLE_PATTERN) | ||
) { | ||
return "g" + pString.substring(1); | ||
} | ||
return prefixPascalCaseIdentifier(pString, "g"); | ||
@@ -24,0 +32,0 @@ } |
@@ -5,2 +5,4 @@ const _get = require("lodash.get"); | ||
VALID_PARAMETER_PATTERN, | ||
VALID_GLOBAL_VARIABLE_PATTERN, | ||
VALID_LOCAL_VARIABLE_PATTERN, | ||
getIdentifierReplacementPattern, | ||
@@ -15,2 +17,8 @@ prefixPascalCaseIdentifier, | ||
function normalizeParameterName(pString) { | ||
if ( | ||
pString.match(VALID_GLOBAL_VARIABLE_PATTERN) || | ||
pString.match(VALID_LOCAL_VARIABLE_PATTERN) | ||
) { | ||
return "p" + pString.substring(1); | ||
} | ||
return prefixPascalCaseIdentifier(pString, "p"); | ||
@@ -17,0 +25,0 @@ } |
@@ -6,2 +6,3 @@ const camelcase = require("camelcase"); | ||
const VALID_GLOBAL_VARIABLE_PATTERN = /^(g[\p{Lu}]|_)\S*/u; | ||
const VALID_LOCAL_VARIABLE_PATTERN = /^(l[\p{Lu}])\S*/u; | ||
@@ -23,4 +24,5 @@ function getIdentifierReplacementPattern(pIdentifier) { | ||
VALID_GLOBAL_VARIABLE_PATTERN, | ||
VALID_LOCAL_VARIABLE_PATTERN, | ||
getIdentifierReplacementPattern, | ||
prefixPascalCaseIdentifier, | ||
}; |
{ | ||
"name": "eslint-plugin-budapestian", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "enforce budapestian style rules", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
19889
385