diff options
Diffstat (limited to 'tools/eslint/lib/rules/jsx-quotes.js')
-rw-r--r-- | tools/eslint/lib/rules/jsx-quotes.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/eslint/lib/rules/jsx-quotes.js b/tools/eslint/lib/rules/jsx-quotes.js index 99dfda76a2..4a9de7acef 100644 --- a/tools/eslint/lib/rules/jsx-quotes.js +++ b/tools/eslint/lib/rules/jsx-quotes.js @@ -19,14 +19,14 @@ const QUOTE_SETTINGS = { "prefer-double": { quote: "\"", description: "singlequote", - convert: function(str) { + convert(str) { return str.replace(/'/g, "\""); } }, "prefer-single": { quote: "'", description: "doublequote", - convert: function(str) { + convert(str) { return str.replace(/"/g, "'"); } } @@ -53,7 +53,7 @@ module.exports = { ] }, - create: function(context) { + create(context) { const quoteOption = context.options[0] || "prefer-double", setting = QUOTE_SETTINGS[quoteOption]; @@ -68,14 +68,14 @@ module.exports = { } return { - JSXAttribute: function(node) { + JSXAttribute(node) { const attributeValue = node.value; if (attributeValue && astUtils.isStringLiteral(attributeValue) && !usesExpectedQuotes(attributeValue)) { context.report({ node: attributeValue, message: "Unexpected usage of " + setting.description + ".", - fix: function(fixer) { + fix(fixer) { return fixer.replaceText(attributeValue, setting.convert(attributeValue.raw)); } }); |