eslint-plugin-budapestian
Advanced tools
Comparing version 4.0.0 to 5.0.0
@@ -1,12 +0,8 @@ | ||
const _get = require("lodash.get"); | ||
function getVariableDeclaratorName(pDeclarator) { | ||
return _get(pDeclarator, "id.name", "OK_ANYWAY"); | ||
return pDeclarator?.id?.name ?? "OK_ANYWAY"; | ||
} | ||
function getParameterDeclaratorName(pParameterDeclarator) { | ||
return _get( | ||
pParameterDeclarator, | ||
"name", | ||
_get(pParameterDeclarator, "left.name", "pOK") | ||
return ( | ||
pParameterDeclarator?.name ?? pParameterDeclarator?.left?.name ?? "pOK" | ||
); | ||
@@ -13,0 +9,0 @@ } |
const decamelize = require("decamelize"); | ||
const _get = require("lodash.get"); | ||
const { | ||
@@ -121,6 +120,6 @@ getVariableDeclaratorName, | ||
Program(pNode) { | ||
const EXCEPTIONS = _get(pContext, "options[0].exceptions", []); | ||
const lExceptions = pContext?.options[0]?.exceptions ?? []; | ||
const lProblematicConstants = getProblematicGlobalConstantsFromBody( | ||
pNode.body, | ||
EXCEPTIONS | ||
lExceptions | ||
); | ||
@@ -127,0 +126,0 @@ |
@@ -1,2 +0,1 @@ | ||
const _get = require("lodash.get"); | ||
const { | ||
@@ -46,3 +45,3 @@ getVariableDeclaratorName, | ||
Program(pNode) { | ||
const lExceptions = _get(pContext, "options[0].exceptions", []); | ||
const lExceptions = pContext?.options[0]?.exceptions ?? []; | ||
const lPrefix = "g"; | ||
@@ -49,0 +48,0 @@ |
@@ -1,2 +0,1 @@ | ||
const _get = require("lodash.get"); | ||
const { | ||
@@ -55,3 +54,3 @@ getVariableDeclaratorName, | ||
create: (pContext) => { | ||
const lExceptions = _get(pContext, "options[0].exceptions", []); | ||
const lExceptions = pContext?.options[0]?.exceptions ?? []; | ||
const lPrefix = "l"; | ||
@@ -58,0 +57,0 @@ |
@@ -1,2 +0,1 @@ | ||
const _get = require("lodash.get"); | ||
const { getParameterDeclaratorName } = require("./ast-utl"); | ||
@@ -19,6 +18,12 @@ const { reportProblemIdentifiers } = require("./prefixed-pascalcase-utl"); | ||
function getProblemParameterNames(pNode, pExceptions, pPrefix) { | ||
return _get(pNode, "params", []) | ||
.map(getParameterDeclaratorName) | ||
.filter((pParameterName) => !parameterNameIsValid(pParameterName, pPrefix)) | ||
.filter(isNotAnException(pExceptions)); | ||
/* c8 ignore start */ | ||
return ( | ||
(pNode?.params ?? []) | ||
/* c8 ignore stop */ | ||
.map(getParameterDeclaratorName) | ||
.filter( | ||
(pParameterName) => !parameterNameIsValid(pParameterName, pPrefix) | ||
) | ||
.filter(isNotAnException(pExceptions)) | ||
); | ||
} | ||
@@ -39,3 +44,3 @@ | ||
create: (pContext) => { | ||
const lExceptions = _get(pContext, "options[0].exceptions", []); | ||
const lExceptions = pContext?.options[0]?.exceptions ?? []; | ||
const lPrefix = "p"; | ||
@@ -42,0 +47,0 @@ |
@@ -1,3 +0,1 @@ | ||
const _get = require("lodash.get"); | ||
const { | ||
@@ -33,3 +31,3 @@ getIdentifierReplacementPattern, | ||
return (pFixer) => { | ||
let lBetterized = pProblemVariableNames.reduce( | ||
let lImproved = pProblemVariableNames.reduce( | ||
(pSource, pProblemVariableName) => | ||
@@ -43,3 +41,3 @@ pSource.replace( | ||
return pFixer.replaceText(pNode, lBetterized); | ||
return pFixer.replaceText(pNode, lImproved); | ||
}; | ||
@@ -55,7 +53,4 @@ } | ||
data: { | ||
variableType: _get( | ||
NODE_TYPE2IDENTIFIER_TYPE, | ||
pNode.type, | ||
"local variable" | ||
), | ||
variableType: | ||
NODE_TYPE2IDENTIFIER_TYPE[pNode.type] || "local variable", | ||
identifier: pProblemVariableName, | ||
@@ -62,0 +57,0 @@ betterIdentifier: normalizePrefixedIdentifier( |
{ | ||
"name": "eslint-plugin-budapestian", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "enforce budapestian style rules", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"upem:install": "npm install", | ||
"upem:update": "npm outdated --json | upem", | ||
"upem:update": "npm outdated --json --long | upem | pbcopy && pbpaste", | ||
"version": "npm-run-all check depcruise:graph scm:stage" | ||
@@ -42,17 +42,16 @@ }, | ||
"camelcase": "^6.3.0", | ||
"decamelize": "^4.0.0", | ||
"lodash.get": "4.4.2" | ||
"decamelize": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"c8": "7.11.3", | ||
"c8": "7.12.0", | ||
"chai": "4.3.6", | ||
"dependency-cruiser": "11.10.0", | ||
"eslint": "8.18.0", | ||
"dependency-cruiser": "11.15.0", | ||
"eslint": "8.22.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-budapestian": "file:./lib", | ||
"eslint-plugin-eslint-plugin": "4.3.0", | ||
"eslint-plugin-eslint-plugin": "5.0.5", | ||
"mocha": "10.0.0", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.7.1", | ||
"upem": "^7.0.0" | ||
"upem": "7.2.0" | ||
}, | ||
@@ -84,3 +83,3 @@ "peerDependencies": { | ||
"engines": { | ||
"node": "^12.20||^14||>=16" | ||
"node": "^14||^16||>=18" | ||
}, | ||
@@ -87,0 +86,0 @@ "license": "MIT", |
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
3
23892
485
- Removedlodash.get@4.4.2
- Removedlodash.get@4.4.2(transitive)