@locker/eslint-rule-maker
Advanced tools
@@ -30,3 +30,3 @@ /** | ||
| const configClone = JSON.parse(JSON.stringify(config)); | ||
| if (shared.isFunction(config.create)) { | ||
| if (typeof config.create === 'function') { | ||
| configClone.create = config.create; | ||
@@ -36,9 +36,9 @@ } | ||
| const rule = config.rule; | ||
| if (shared.isFunction(rule.fix)) { | ||
| if (typeof rule.fix === 'function') { | ||
| configClone.rule.fix = rule.fix; | ||
| } | ||
| if (shared.isFunction(rule.message)) { | ||
| if (typeof rule.message === 'function') { | ||
| configClone.rule.message = rule.message; | ||
| } | ||
| if (shared.isFunction(rule.onMatch)) { | ||
| if (typeof rule.onMatch === 'function') { | ||
| configClone.rule.onMatch = rule.onMatch; | ||
@@ -144,3 +144,3 @@ } | ||
| const { onMatch } = configClone.rule; | ||
| const matcherData = !shared.isFunction(onMatch) || onMatch.call(config.rule, matchedData); | ||
| const matcherData = typeof onMatch !== 'function' || onMatch.call(config.rule, matchedData); | ||
| if (!matcherData) { | ||
@@ -166,3 +166,3 @@ return; | ||
| } | ||
| else if (shared.isFunction(fix)) { | ||
| else if (typeof fix === 'function') { | ||
| const oldFix = fix; | ||
@@ -174,3 +174,3 @@ fix = (fixer) => oldFix.call(config.rule, fixer, matchedData); | ||
| } | ||
| if (shared.isFunction(message)) { | ||
| if (typeof message === 'function') { | ||
| message = message.call(config.rule, matchedData); | ||
@@ -215,3 +215,3 @@ } | ||
| } | ||
| if (shared.isObject(config.rule) && !shared.isFunction(configClone.rule.onMatch)) { | ||
| if (shared.isObject(config.rule) && typeof configClone.rule.onMatch !== 'function') { | ||
| configClone.rule.onMatch = matchers.matchAsNonReadableNonWritable; | ||
@@ -229,2 +229,2 @@ } | ||
| exports.matchers = matchers; | ||
| /** version: 0.12.12 */ | ||
| /** version: 0.12.13 */ |
+10
-10
| /** | ||
| * Copyright (C) 2020 salesforce.com, inc. | ||
| */ | ||
| import { defaults, isObject, isFunction, ObjectHasOwnProperty } from '@locker/shared'; | ||
| import { defaults, isObject, ObjectHasOwnProperty } from '@locker/shared'; | ||
| import { createLib } from '@locker/ast-lib-maker'; | ||
@@ -26,3 +26,3 @@ | ||
| const configClone = JSON.parse(JSON.stringify(config)); | ||
| if (isFunction(config.create)) { | ||
| if (typeof config.create === 'function') { | ||
| configClone.create = config.create; | ||
@@ -32,9 +32,9 @@ } | ||
| const rule = config.rule; | ||
| if (isFunction(rule.fix)) { | ||
| if (typeof rule.fix === 'function') { | ||
| configClone.rule.fix = rule.fix; | ||
| } | ||
| if (isFunction(rule.message)) { | ||
| if (typeof rule.message === 'function') { | ||
| configClone.rule.message = rule.message; | ||
| } | ||
| if (isFunction(rule.onMatch)) { | ||
| if (typeof rule.onMatch === 'function') { | ||
| configClone.rule.onMatch = rule.onMatch; | ||
@@ -140,3 +140,3 @@ } | ||
| const { onMatch } = configClone.rule; | ||
| const matcherData = !isFunction(onMatch) || onMatch.call(config.rule, matchedData); | ||
| const matcherData = typeof onMatch !== 'function' || onMatch.call(config.rule, matchedData); | ||
| if (!matcherData) { | ||
@@ -162,3 +162,3 @@ return; | ||
| } | ||
| else if (isFunction(fix)) { | ||
| else if (typeof fix === 'function') { | ||
| const oldFix = fix; | ||
@@ -170,3 +170,3 @@ fix = (fixer) => oldFix.call(config.rule, fixer, matchedData); | ||
| } | ||
| if (isFunction(message)) { | ||
| if (typeof message === 'function') { | ||
| message = message.call(config.rule, matchedData); | ||
@@ -211,3 +211,3 @@ } | ||
| } | ||
| if (isObject(config.rule) && !isFunction(configClone.rule.onMatch)) { | ||
| if (isObject(config.rule) && typeof configClone.rule.onMatch !== 'function') { | ||
| configClone.rule.onMatch = matchers.matchAsNonReadableNonWritable; | ||
@@ -223,2 +223,2 @@ } | ||
| export { ast, createRule, matchers }; | ||
| /** version: 0.12.12 */ | ||
| /** version: 0.12.13 */ |
+4
-4
| { | ||
| "name": "@locker/eslint-rule-maker", | ||
| "version": "0.12.12", | ||
| "version": "0.12.13", | ||
| "license": "Salesforce Developer Agreement", | ||
@@ -24,4 +24,4 @@ "author": "Salesforce UI Security Team", | ||
| "dependencies": { | ||
| "@locker/ast-lib-maker": "0.12.12", | ||
| "@locker/shared": "0.12.12" | ||
| "@locker/ast-lib-maker": "0.12.13", | ||
| "@locker/shared": "0.12.13" | ||
| }, | ||
@@ -31,3 +31,3 @@ "files": [ | ||
| ], | ||
| "gitHead": "70462b15cdef106c1a55b77e5c48d3a023004f0b" | ||
| "gitHead": "773c88ecf9df8aae0fb438aba23605f10950dff0" | ||
| } |
21749
0.41%+ Added
+ Added
- Removed
- Removed
Updated