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

@locker/eslint-rule-maker

Package Overview
Dependencies
Maintainers
7
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@locker/eslint-rule-maker - npm Package Compare versions

Comparing version 0.14.5 to 0.14.6

75

dist/index.cjs.js

@@ -104,15 +104,18 @@ /*!

function matchAsNonReadableNonWritable(_ref) {
let {
node
} = _ref;
return astLib.isNodeOfType(node, 'MemberExpression') && NO_FIX_OVERRIDE;
function matchAsNonReadableNonWritable({
node
}) {
return astLib.getType(node) === 'MemberExpression' && NO_FIX_OVERRIDE;
}
function matchAsNonWritable(_ref2) {
let {
node
} = _ref2;
const parentNode = astLib.getParentNode(node);
return astLib.isNodeOfType(parentNode, 'AssignmentExpression') && parentNode.left === node && NO_FIX_OVERRIDE;
function matchAsNonWritable({
node
}) {
const parent = astLib.getParent(node);
if (parent && astLib.getType(parent) === 'AssignmentExpression' && parent.left === node) {
return NO_FIX_OVERRIDE;
}
return false;
}

@@ -124,9 +127,14 @@

} = data;
const parentNode = astLib.getParentNode(node); // If `parentNode` is a MemberExpression then its AST represents a child
// property access. For example, with a `pattern` of 'window.top' the
// matched `node` represents `window.top` and `parentNode` represents
// `window.top.pageXOffset` which is a lint error since `window.top` is
// treated as nullish.
const parent = astLib.getParent(node);
return astLib.isNodeOfType(parentNode, 'MemberExpression') || matchAsNonWritable(data);
if (parent) {
// If `parent` is a MemberExpression then its AST represents a child
// property access. For example, with a `pattern` of 'window.top' the
// matched `node` represents `window.top` and `parent` represents
// `window.top.pageXOffset` which is a lint error since `window.top` is
// treated as nullish.
return astLib.getType(parent) === 'MemberExpression' || matchAsNonWritable(data);
}
return false;
}

@@ -145,4 +153,4 @@

defaultConfigClone.create = function create(context) {
const globals = getGlobalIdentifiersByContext(context);
const checkedNodes = new Set(globals);
let globals;
let checkedNodes;
const detectedNodes = new Set();

@@ -225,4 +233,14 @@ const {

return {
MemberExpression(node) {
const visitor = {
'Program:exit': function ProgramExit() {
if (!globals) {
globals = getGlobalIdentifiersByContext(context);
}
detect(globals, searchPatterns, report);
}
};
if (searchPatternsWithAsterisks.length) {
visitor.MemberExpression = node => {
let currentNode = node;

@@ -234,2 +252,7 @@

if (!checkedNodes) {
globals = getGlobalIdentifiersByContext(context);
checkedNodes = new Set(globals);
}
if (!checkedNodes.has(currentNode)) {

@@ -239,8 +262,6 @@ checkedNodes.add(currentNode);

}
},
};
}
'Program:exit': function ProgramExit() {
detect(globals, searchPatterns, report);
}
};
return visitor;
}; // Populate first level default properties.

@@ -274,2 +295,2 @@

exports.matchers = matchers;
/*! version: 0.14.5 */
/*! version: 0.14.6 */

@@ -96,15 +96,18 @@ /*!

function matchAsNonReadableNonWritable(_ref) {
let {
node
} = _ref;
return astLib.isNodeOfType(node, 'MemberExpression') && NO_FIX_OVERRIDE;
function matchAsNonReadableNonWritable({
node
}) {
return astLib.getType(node) === 'MemberExpression' && NO_FIX_OVERRIDE;
}
function matchAsNonWritable(_ref2) {
let {
node
} = _ref2;
const parentNode = astLib.getParentNode(node);
return astLib.isNodeOfType(parentNode, 'AssignmentExpression') && parentNode.left === node && NO_FIX_OVERRIDE;
function matchAsNonWritable({
node
}) {
const parent = astLib.getParent(node);
if (parent && astLib.getType(parent) === 'AssignmentExpression' && parent.left === node) {
return NO_FIX_OVERRIDE;
}
return false;
}

@@ -116,9 +119,14 @@

} = data;
const parentNode = astLib.getParentNode(node); // If `parentNode` is a MemberExpression then its AST represents a child
// property access. For example, with a `pattern` of 'window.top' the
// matched `node` represents `window.top` and `parentNode` represents
// `window.top.pageXOffset` which is a lint error since `window.top` is
// treated as nullish.
const parent = astLib.getParent(node);
return astLib.isNodeOfType(parentNode, 'MemberExpression') || matchAsNonWritable(data);
if (parent) {
// If `parent` is a MemberExpression then its AST represents a child
// property access. For example, with a `pattern` of 'window.top' the
// matched `node` represents `window.top` and `parent` represents
// `window.top.pageXOffset` which is a lint error since `window.top` is
// treated as nullish.
return astLib.getType(parent) === 'MemberExpression' || matchAsNonWritable(data);
}
return false;
}

@@ -137,4 +145,4 @@

defaultConfigClone.create = function create(context) {
const globals = getGlobalIdentifiersByContext(context);
const checkedNodes = new Set(globals);
let globals;
let checkedNodes;
const detectedNodes = new Set();

@@ -217,4 +225,14 @@ const {

return {
MemberExpression(node) {
const visitor = {
'Program:exit': function ProgramExit() {
if (!globals) {
globals = getGlobalIdentifiersByContext(context);
}
detect(globals, searchPatterns, report);
}
};
if (searchPatternsWithAsterisks.length) {
visitor.MemberExpression = node => {
let currentNode = node;

@@ -226,2 +244,7 @@

if (!checkedNodes) {
globals = getGlobalIdentifiersByContext(context);
checkedNodes = new Set(globals);
}
if (!checkedNodes.has(currentNode)) {

@@ -231,8 +254,6 @@ checkedNodes.add(currentNode);

}
},
};
}
'Program:exit': function ProgramExit() {
detect(globals, searchPatterns, report);
}
};
return visitor;
}; // Populate first level default properties.

@@ -264,2 +285,2 @@

export { astLib, createRule, matchers };
/*! version: 0.14.5 */
/*! version: 0.14.6 */
{
"name": "@locker/eslint-rule-maker",
"version": "0.14.5",
"version": "0.14.6",
"license": "Salesforce Developer Agreement",

@@ -24,4 +24,4 @@ "author": "Salesforce UI Security Team",

"dependencies": {
"@locker/ast-lib-maker": "0.14.5",
"@locker/shared": "0.14.5"
"@locker/ast-lib-maker": "0.14.6",
"@locker/shared": "0.14.6"
},

@@ -32,3 +32,3 @@ "files": [

],
"gitHead": "257009273b0c98354e0fafd9d4e81d16664bad2e"
"gitHead": "905c78f2ced1c181b3b8c838ea045f85aaca87ce"
}

@@ -8,6 +8,6 @@ import { AST } from '@locker/ast-lib-maker/types';

getIdentifierName(node: ESTree.Identifier): string;
getParentNode(node: AST.MaybeNode): AST.MaybeNode;
getParent(node: AST.Node): AST.MaybeNode;
getType(node: AST.Node): string;
isMatchableNode(node: AST.MaybeNode): boolean;
isNodeByAsteriskOrName(node: AST.MaybeNode, name: string): boolean;
isNodeOfType(node: AST.MaybeNode, type: string): boolean;
isNonComputedMemberExpressionNode(node: AST.MaybeNode): boolean;

@@ -14,0 +14,0 @@ match(identifier: AST.IdentifierOrThisExpression, patterns: string | import("@locker/ast-lib-maker").Lib.SearchPatternArray | import("@locker/ast-lib-maker").Lib.SearchPatternArray[]): import("@locker/ast-lib-maker").Lib.MatchData | undefined;

Sorry, the diff of this file is not supported yet

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