diff --git a/lib/rules/function-component-definition.js b/lib/rules/function-component-definition.js index 4832a8f68b..4d616ef248 100644 --- a/lib/rules/function-component-definition.js +++ b/lib/rules/function-component-definition.js @@ -118,16 +118,16 @@ module.exports = { const namedConfig = configuration.namedComponents || 'function-declaration'; const unnamedConfig = configuration.unnamedComponents || 'function-expression'; - function getFixer(node, {type, template, range}) { + function getFixer(node, options) { const sourceCode = context.getSourceCode(); const source = sourceCode.getText(); const typeAnnotation = getTypeAnnotation(node, source); - if (type === 'function-declaration' && typeAnnotation) return; - if (type === 'arrow-function' && hasOneUnconstrainedTypeParam(node)) return; + if (options.type === 'function-declaration' && typeAnnotation) return; + if (options.type === 'arrow-function' && hasOneUnconstrainedTypeParam(node)) return; - return fixer => fixer.replaceTextRange(range, buildFunction(template, { + return fixer => fixer.replaceTextRange(options.range, buildFunction(options.template, { typeAnnotation, typeParams: getNodeText(node.typeParameters, source), params: getParams(node, source), @@ -137,11 +137,11 @@ module.exports = { })); } - function report(node, {message, fixerOptions}) { + function report(node, options) { context.report({ node, - message, - fix: getFixer(node, fixerOptions) + message: options.message, + fix: getFixer(node, options.fixerOptions) }); }