🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-regexp

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-regexp - npm Package Compare versions

Comparing version

to
0.13.2

28

dist/rules/negation.js

@@ -19,3 +19,3 @@ "use strict";

create(context) {
function createVisitor({ node, getRegexpLocation, fixReplaceNode, }) {
function createVisitor({ node, getRegexpLocation, fixReplaceNode, toCharSet, flags, }) {
return {

@@ -27,12 +27,20 @@ onCharacterClassEnter(ccNode) {

const element = ccNode.elements[0];
if (element.type === "CharacterSet") {
const negatedCharSet = getNegationText(element);
context.report({
node,
loc: getRegexpLocation(ccNode),
messageId: "unexpected",
data: { negatedCharSet },
fix: fixReplaceNode(ccNode, negatedCharSet),
});
if (element.type !== "CharacterSet") {
return;
}
if (flags.ignoreCase && element.kind === "property") {
const ccSet = toCharSet(ccNode);
const negatedElementSet = toCharSet(Object.assign(Object.assign({}, element), { negate: !element.negate }));
if (!ccSet.equals(negatedElementSet)) {
return;
}
}
const negatedCharSet = getNegationText(element);
context.report({
node,
loc: getRegexpLocation(ccNode),
messageId: "unexpected",
data: { negatedCharSet },
fix: fixReplaceNode(ccNode, negatedCharSet),
});
},

@@ -39,0 +47,0 @@ };

{
"name": "eslint-plugin-regexp",
"version": "0.13.1",
"version": "0.13.2",
"description": "ESLint plugin for finding RegExp mistakes and RegExp style guide violations.",

@@ -91,7 +91,7 @@ "main": "dist/index.js",

"jsdoctypeparser": "^9.0.0",
"refa": "^0.8.0",
"regexp-ast-analysis": "^0.2.2",
"refa": "^0.9.0",
"regexp-ast-analysis": "^0.2.3",
"regexpp": "^3.2.0",
"scslre": "^0.1.5"
"scslre": "^0.1.6"
}
}