eslint-plugin-uilib
Advanced tools
Comparing version 1.0.15 to 1.0.16
@@ -11,2 +11,3 @@ const _ = require('lodash'); | ||
PROP_NAME: 'propName', | ||
COMPONENT_NAME: 'componentName' | ||
}; | ||
@@ -44,2 +45,3 @@ | ||
const fix = Object.values(options.fix)[0]; | ||
switch (type) { | ||
@@ -49,2 +51,8 @@ case FIX_TYPES.PROP_NAME: | ||
return fixer.replaceText(node.name, fix); | ||
case FIX_TYPES.COMPONENT_NAME: | ||
if (node.type === 'ImportDeclaration') { | ||
const index = getSpecifierIndex(node, options.name); | ||
return fixer.replaceText(node.specifiers[index], fix); | ||
} | ||
return fixer.replaceText(node.name, fix); | ||
default: | ||
@@ -61,2 +69,15 @@ break; | ||
function getSpecifierIndex(node, name) { | ||
let matchIndex; | ||
if (node && node.specifiers) { | ||
_.forEach(node.specifiers, (s, index) => { | ||
const x = _.get(s, 'imported.name'); | ||
if (x === name) { | ||
matchIndex = index; | ||
} | ||
}); | ||
} | ||
return matchIndex; | ||
} | ||
function checkPropDeprecation(node, propName, deprecatedPropList, componentName) { | ||
@@ -79,3 +100,2 @@ const deprecatedProp = _.find(deprecatedPropList, {prop: propName}); | ||
} | ||
if (component) { | ||
@@ -82,0 +102,0 @@ if (isComponentDeprecated(component)) { |
{ | ||
"name": "eslint-plugin-uilib", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"description": "uilib set of eslint rules", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
32839
893