Skip to content

Commit

Permalink
Use key.value for string literal
Browse files Browse the repository at this point in the history
  • Loading branch information
metreniuk committed Sep 10, 2018
1 parent 5680a2b commit 7bf5911
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/rules/sort-prop-types.js
Expand Up @@ -57,9 +57,10 @@ module.exports = {
const propWrapperFunctions = new Set(context.settings.propWrapperFunctions || []);

function getKey(node) {
const key = sourceCode.getText(node.key || node.argument);
const hasLeadingQuote = /['"]/.test(key[0]);
return hasLeadingQuote ? key.substring(1, key.length - 1) : key;
if (node.key && node.key.value) {
return node.key.value;
}
return sourceCode.getText(node.key || node.argument);
}

function getValueName(node) {
Expand Down

0 comments on commit 7bf5911

Please sign in to comment.