Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-budapestian

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-budapestian - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0

2

lib/index.js

@@ -16,3 +16,3 @@ /**

"parameter-pattern": require("./rules/parameter-pattern"),
"global-constant-pattern": require("./rules/global-constant-pattern")
"global-constant-pattern": require("./rules/global-constant-pattern"),
};

@@ -5,3 +5,3 @@ const _get = require("lodash.get");

getValidConstantPattern,
getIdentifierReplacementPattern
getIdentifierReplacementPattern,
} = require("./pattern-utl");

@@ -31,3 +31,3 @@ /**

if (pFire) {
return pFixer => {
return (pFixer) => {
let lBetterized = pProblematicConstantNames.reduce(

@@ -53,3 +53,3 @@ (pSource, pProblematicConstantName) =>

return ["Literal", "ObjectExpression", "ArrayExpression"].some(
pType =>
(pType) =>
pType === pConstantDeclarator.init.type &&

@@ -69,8 +69,8 @@ !constantNameIsValid(getConstantName(pConstantDeclarator))

url:
"https://sverweij.github.io/eslint-plugin-budapestian/rules/global-constant-pattern"
"https://sverweij.github.io/eslint-plugin-budapestian/rules/global-constant-pattern",
},
fixable: "code"
fixable: "code",
},
create: pContext => {
create: (pContext) => {
//----------------------------------------------------------------------

@@ -103,3 +103,3 @@ // Helpers

identifier: pProblematicConstantName,
betterIdentifier: normalizeConstantName(pProblematicConstantName)
betterIdentifier: normalizeConstantName(pProblematicConstantName),
},

@@ -111,3 +111,3 @@ fix: getFixes(

pIndex === 0
)
),
});

@@ -125,5 +125,5 @@ }

checkConstantPatternValidity(pNode, pContext);
}
},
};
}
},
};

@@ -5,3 +5,3 @@ const _get = require("lodash.get");

getIdentifierReplacementPattern,
getValidConstantPattern
getValidConstantPattern,
} = require("./pattern-utl");

@@ -33,6 +33,3 @@ /**

function toPascalCase(pString) {
return pString
.split("_")
.map(toInitCaps)
.join("");
return pString.split("_").map(toInitCaps).join("");
}

@@ -54,3 +51,3 @@

if (pFire) {
return pFixer => {
return (pFixer) => {
let lBetterized = pProblematicParameterNames.reduce(

@@ -78,12 +75,12 @@ (pSource, pProblematicParameterName) =>

url:
"https://sverweij.github.io/eslint-plugin-budapestian/rules/parameter-pattern"
"https://sverweij.github.io/eslint-plugin-budapestian/rules/parameter-pattern",
},
fixable: "code"
fixable: "code",
},
create: pContext => {
create: (pContext) => {
function checkParameters(pNode, pContext) {
const lProblematicParameterNames = _get(pNode, "params", [])
.map(getParameterName)
.filter(pParameterName => !parameterNameIsValid(pParameterName));
.filter((pParameterName) => !parameterNameIsValid(pParameterName));

@@ -99,3 +96,3 @@ lProblematicParameterNames.forEach(

pProblematicParameterName
)
),
},

@@ -107,3 +104,3 @@ fix: getFixes(

pIndex === 0
)
),
});

@@ -124,5 +121,5 @@ }

checkParameters(pNode, pContext);
}
},
};
}
},
};

@@ -1,30 +0,20 @@

const nodeVersionIsRecentEnough = require("../utl/node-version-is-recent-enough");
function getValidParameterPattern(pMajorNodeVersion) {
// unicode pattern matching is only available from node 10
return nodeVersionIsRecentEnough(pMajorNodeVersion)
? /^(p[\p{Lu}]|_)\S*/u
: /^(p[A-Z]|_)\S*/;
function getValidParameterPattern() {
return /^(p[\p{Lu}]|_)\S*/u;
}
function getIdentifierReplacementPattern(pParameterName, pMajorNodeVersion) {
return nodeVersionIsRecentEnough(pMajorNodeVersion)
? new RegExp(
`([^\\p{L}\\p{N}]|^)${pParameterName}([^\\p{L}\\p{N}]|$)`,
"gu"
)
: new RegExp(`(\\W|^)${pParameterName}(\\W|$)`, "g");
function getIdentifierReplacementPattern(pParameterName) {
return new RegExp(
`([^\\p{L}\\p{N}]|^)${pParameterName}([^\\p{L}\\p{N}]|$)`,
"gu"
);
}
function getValidConstantPattern(pMajorNodeVersion) {
// unicode pattern matching is only available from node 10
return nodeVersionIsRecentEnough(pMajorNodeVersion)
? /^[\p{Lu}_][\p{Lu}\p{N}_]*$/u
: /^[A-Z_][A-Z0-9_]*$/;
function getValidConstantPattern() {
return /^[\p{Lu}_][\p{Lu}\p{N}_]*$/u;
}
module.exports = {
getValidParameterPattern,
getIdentifierReplacementPattern,
getValidConstantPattern
}
getValidParameterPattern,
getIdentifierReplacementPattern,
getValidConstantPattern,
};
{
"name": "eslint-plugin-budapestian",
"version": "1.2.0",
"version": "2.0.0",
"description": "enforce budapestian style rules",

@@ -28,4 +28,4 @@ "keywords": [

"lint:eslint:fix": "eslint --fix lib test",
"lint:prettier": "prettier --loglevel warn --check {src,test}/\\*\\*/\\*.{js,json} *.js *.json .github",
"lint:prettier:fix": "prettier --loglevel warn --write {src,test}/\\*\\*/\\*.{js,json} *.js *.json .github/\\*\\*/\\*",
"lint:prettier": "prettier --loglevel log --check lib test *.js *.json .github",
"lint:prettier:fix": "prettier --loglevel log --write lib test *.js *.json .github",
"scm:stage": "git add .",

@@ -40,3 +40,3 @@ "test": "mocha test --recursive",

"dependencies": {
"decamelize": "3.2.0",
"decamelize": "4.0.0",
"lodash.get": "4.4.2"

@@ -46,10 +46,10 @@ },

"chai": "4.2.0",
"dependency-cruiser": "8.1.0",
"dependency-cruiser": "9.0.0",
"eslint": "6.8.0",
"eslint-config-prettier": "6.10.1",
"eslint-plugin-unicorn": "15.0.1",
"mocha": "7.1.1",
"eslint-config-prettier": "6.11.0",
"eslint-plugin-unicorn": "19.0.1",
"mocha": "7.1.2",
"npm-run-all": "4.1.5",
"nyc": "15.0.0",
"prettier": "1.19.1",
"nyc": "15.0.1",
"prettier": "2.0.5",
"upem": "3.1.2"

@@ -60,18 +60,2 @@ },

},
"upem": {
"donotup": [
{
"package": "decamelize",
"because": "decamelize 4 doesn't support node 8 anymore, while eslint-plugin-budapestian still does."
},
{
"package": "eslint-plugin-unicorn",
"because": "eslint-plugin-unicorn 16+ don't support node 8 anymore, while eslint-plugin-budapestian still does."
},
{
"package": "prettier",
"because": "prettier 2 doesn't support node 8 anymore, while eslint-plugin-budapestian still does."
}
]
},
"nyc": {

@@ -103,3 +87,3 @@ "statements": 100,

"engines": {
"node": "^8.10||^10||^12||>=13"
"node": "^10||^12||>=13"
},

@@ -106,0 +90,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc