@locker/eslint-rule-maker
Advanced tools
Comparing version 0.13.5 to 0.13.6
@@ -8,4 +8,4 @@ /** | ||
var astLibMaker = require('@locker/ast-lib-maker'); | ||
var shared = require('@locker/shared'); | ||
var astLibMaker = require('@locker/ast-lib-maker'); | ||
@@ -15,3 +15,3 @@ const NO_FIX_OVERRIDE = { | ||
}; | ||
const ast = astLibMaker.createLib(); | ||
const astLib = astLibMaker.createLib(); | ||
const defaultConfig = { | ||
@@ -21,3 +21,3 @@ create: undefined, | ||
fixable: undefined, | ||
type: 'problem', | ||
type: 'suggestion', | ||
}, | ||
@@ -102,3 +102,3 @@ rule: { | ||
} | ||
currentNode = ast.getParentNode(currentNode); | ||
currentNode = astLib.getParentNode(currentNode); | ||
} | ||
@@ -108,7 +108,7 @@ return false; | ||
function matchAsNonReadableNonWritable({ node }) { | ||
return ast.isNodeOfType(node, 'MemberExpression') && NO_FIX_OVERRIDE; | ||
return astLib.isNodeOfType(node, 'MemberExpression') && NO_FIX_OVERRIDE; | ||
} | ||
function matchAsNonWritable({ node }) { | ||
const parentNode = ast.getParentNode(node); | ||
return (ast.isNodeOfType(parentNode, 'AssignmentExpression') && | ||
const parentNode = astLib.getParentNode(node); | ||
return (astLib.isNodeOfType(parentNode, 'AssignmentExpression') && | ||
parentNode.left === node && | ||
@@ -119,3 +119,3 @@ NO_FIX_OVERRIDE); | ||
const { node } = data; | ||
const parentNode = ast.getParentNode(node); | ||
const parentNode = astLib.getParentNode(node); | ||
// If `parentNode` is a MemberExpression then its AST represents a child | ||
@@ -126,3 +126,3 @@ // property access. For example, with a `pattern` of 'window.top' the | ||
// treated as nullish. | ||
return ast.isNodeOfType(parentNode, 'MemberExpression') || matchAsNonWritable(data); | ||
return astLib.isNodeOfType(parentNode, 'MemberExpression') || matchAsNonWritable(data); | ||
} | ||
@@ -143,3 +143,3 @@ const matchers = { | ||
function detect(detectableIdentifiers, detectablePatterns, callback) { | ||
const matches = ast.matchAll(detectableIdentifiers, detectablePatterns); | ||
const matches = astLib.matchAll(detectableIdentifiers, detectablePatterns); | ||
// eslint-disable-next-line no-restricted-syntax | ||
@@ -226,3 +226,3 @@ for (const matchData of matches) { | ||
// Populate third level default properties. | ||
configClone.rule.search = ast.expandPatterns(configClone.rule.search); | ||
configClone.rule.search = astLib.expandPatterns(configClone.rule.search); | ||
if (configClone.meta.fixable === undefined && configClone.rule.fix !== undefined) { | ||
@@ -241,5 +241,5 @@ configClone.meta.fixable = 'code'; | ||
exports.ast = ast; | ||
exports.astLib = astLib; | ||
exports.createRule = createRule; | ||
exports.matchers = matchers; | ||
/** version: 0.13.5 */ | ||
/** version: 0.13.6 */ |
/** | ||
* Copyright (C) 2020 salesforce.com, inc. | ||
*/ | ||
import { createLib } from '@locker/ast-lib-maker'; | ||
import { isObject, ReflectOwnKeys, ObjectHasOwnProperty } from '@locker/shared'; | ||
import { createLib } from '@locker/ast-lib-maker'; | ||
@@ -10,3 +10,3 @@ const NO_FIX_OVERRIDE = { | ||
}; | ||
const ast = createLib(); | ||
const astLib = createLib(); | ||
const defaultConfig = { | ||
@@ -16,3 +16,3 @@ create: undefined, | ||
fixable: undefined, | ||
type: 'problem', | ||
type: 'suggestion', | ||
}, | ||
@@ -97,3 +97,3 @@ rule: { | ||
} | ||
currentNode = ast.getParentNode(currentNode); | ||
currentNode = astLib.getParentNode(currentNode); | ||
} | ||
@@ -103,7 +103,7 @@ return false; | ||
function matchAsNonReadableNonWritable({ node }) { | ||
return ast.isNodeOfType(node, 'MemberExpression') && NO_FIX_OVERRIDE; | ||
return astLib.isNodeOfType(node, 'MemberExpression') && NO_FIX_OVERRIDE; | ||
} | ||
function matchAsNonWritable({ node }) { | ||
const parentNode = ast.getParentNode(node); | ||
return (ast.isNodeOfType(parentNode, 'AssignmentExpression') && | ||
const parentNode = astLib.getParentNode(node); | ||
return (astLib.isNodeOfType(parentNode, 'AssignmentExpression') && | ||
parentNode.left === node && | ||
@@ -114,3 +114,3 @@ NO_FIX_OVERRIDE); | ||
const { node } = data; | ||
const parentNode = ast.getParentNode(node); | ||
const parentNode = astLib.getParentNode(node); | ||
// If `parentNode` is a MemberExpression then its AST represents a child | ||
@@ -121,3 +121,3 @@ // property access. For example, with a `pattern` of 'window.top' the | ||
// treated as nullish. | ||
return ast.isNodeOfType(parentNode, 'MemberExpression') || matchAsNonWritable(data); | ||
return astLib.isNodeOfType(parentNode, 'MemberExpression') || matchAsNonWritable(data); | ||
} | ||
@@ -138,3 +138,3 @@ const matchers = { | ||
function detect(detectableIdentifiers, detectablePatterns, callback) { | ||
const matches = ast.matchAll(detectableIdentifiers, detectablePatterns); | ||
const matches = astLib.matchAll(detectableIdentifiers, detectablePatterns); | ||
// eslint-disable-next-line no-restricted-syntax | ||
@@ -221,3 +221,3 @@ for (const matchData of matches) { | ||
// Populate third level default properties. | ||
configClone.rule.search = ast.expandPatterns(configClone.rule.search); | ||
configClone.rule.search = astLib.expandPatterns(configClone.rule.search); | ||
if (configClone.meta.fixable === undefined && configClone.rule.fix !== undefined) { | ||
@@ -236,3 +236,3 @@ configClone.meta.fixable = 'code'; | ||
export { ast, createRule, matchers }; | ||
/** version: 0.13.5 */ | ||
export { astLib, createRule, matchers }; | ||
/** version: 0.13.6 */ |
{ | ||
"name": "@locker/eslint-rule-maker", | ||
"version": "0.13.5", | ||
"version": "0.13.6", | ||
"license": "Salesforce Developer Agreement", | ||
@@ -15,2 +15,5 @@ "author": "Salesforce UI Security Team", | ||
"typings": "types/index.d.ts", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
@@ -21,13 +24,11 @@ "build": "tsc --project tsconfig.types.json && rollup --config .rolluprc.cjs", | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@locker/ast-lib-maker": "0.13.5", | ||
"@locker/shared": "0.13.5" | ||
"@locker/ast-lib-maker": "0.13.6", | ||
"@locker/shared": "0.13.6" | ||
}, | ||
"files": [ | ||
"dist" | ||
"dist/", | ||
"types/" | ||
], | ||
"gitHead": "213b7ea798dd4a01891a5b5ead2cff46f6db5600" | ||
"gitHead": "c323e27d3a3d5767725b338c81f9e24cb59cbc6f" | ||
} |
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
26581
9
508
+ Added@locker/ast-lib-maker@0.13.6(transitive)
+ Added@locker/shared@0.13.6(transitive)
- Removed@locker/ast-lib-maker@0.13.5(transitive)
- Removed@locker/shared@0.13.5(transitive)
Updated@locker/ast-lib-maker@0.13.6
Updated@locker/shared@0.13.6