diff --git a/lib/rules/jsx-no-literals.js b/lib/rules/jsx-no-literals.js index 1d4a30835f..230d33a18d 100644 --- a/lib/rules/jsx-no-literals.js +++ b/lib/rules/jsx-no-literals.js @@ -182,9 +182,8 @@ const elementOverrides = { }, }; -/** @type {import('eslint').Rule.RuleModule} */ module.exports = { - meta: { + meta: /** @type {import('eslint').Rule.RuleModule["meta"]} */ ({ docs: { description: 'Disallow usage of string literals in JSX', category: 'Stylistic Issues', @@ -202,7 +201,7 @@ module.exports = { ), additionalProperties: false, }], - }, + }), create(context) { /** @type {RawConfig} */ diff --git a/lib/util/makeNoMethodSetStateRule.js b/lib/util/makeNoMethodSetStateRule.js index faee6de163..292c6f6c8e 100644 --- a/lib/util/makeNoMethodSetStateRule.js +++ b/lib/util/makeNoMethodSetStateRule.js @@ -44,6 +44,12 @@ function shouldBeNoop(context, methodName) { && !testReactVersion(context, '999.999.999'); // for when the version is not specified } +// eslint-disable-next-line valid-jsdoc +/** + * @param {string} methodName Yay + * @param {(context: import('eslint').Rule.RuleContext) => boolean} [shouldCheckUnsafeCb] Yay + * @returns {import('eslint').Rule.RuleModule} + */ module.exports = function makeNoMethodSetStateRule(methodName, shouldCheckUnsafeCb) { return { meta: { @@ -90,6 +96,7 @@ module.exports = function makeNoMethodSetStateRule(methodName, shouldCheckUnsafe if ( callee.type !== 'MemberExpression' || callee.object.type !== 'ThisExpression' + || !('name' in callee.property) || callee.property.name !== 'setState' ) { return;