diff --git a/lib/rules/button-has-type.js b/lib/rules/button-has-type.js index 32089e76ee..bcf3bcc115 100644 --- a/lib/rules/button-has-type.js +++ b/lib/rules/button-has-type.js @@ -28,7 +28,7 @@ const messages = { forbiddenValue: '"{{value}}" is an invalid value for button type attribute', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/checked-requires-onchange-or-readonly.js b/lib/rules/checked-requires-onchange-or-readonly.js index cd1c6c9909..d67449ea51 100644 --- a/lib/rules/checked-requires-onchange-or-readonly.js +++ b/lib/rules/checked-requires-onchange-or-readonly.js @@ -41,7 +41,7 @@ function extractTargetProps(properties, keyName) { ); } -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/forbid-elements.js b/lib/rules/forbid-elements.js index 5a41577f7b..f08ef1d1e7 100644 --- a/lib/rules/forbid-elements.js +++ b/lib/rules/forbid-elements.js @@ -20,7 +20,7 @@ const messages = { forbiddenElement_message: '<{{element}}> is forbidden, {{message}}', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/forbid-foreign-prop-types.js b/lib/rules/forbid-foreign-prop-types.js index 4a2524c59e..0af7b703fe 100644 --- a/lib/rules/forbid-foreign-prop-types.js +++ b/lib/rules/forbid-foreign-prop-types.js @@ -13,7 +13,7 @@ const messages = { forbiddenPropType: 'Using propTypes from another component is not safe because they may be removed in production builds', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/forbid-prop-types.js b/lib/rules/forbid-prop-types.js index 466d37763d..ae8985fe78 100644 --- a/lib/rules/forbid-prop-types.js +++ b/lib/rules/forbid-prop-types.js @@ -26,7 +26,7 @@ const messages = { forbiddenPropType: 'Prop type "{{target}}" is forbidden', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/hook-use-state.js b/lib/rules/hook-use-state.js index ea0c5e808e..2d1cf681cd 100644 --- a/lib/rules/hook-use-state.js +++ b/lib/rules/hook-use-state.js @@ -26,7 +26,7 @@ const messages = { suggestMemo: 'Replace useState call with useMemo', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/jsx-closing-bracket-location.js b/lib/rules/jsx-closing-bracket-location.js index eef8f6eac1..1dca7bb0d8 100644 --- a/lib/rules/jsx-closing-bracket-location.js +++ b/lib/rules/jsx-closing-bracket-location.js @@ -20,7 +20,7 @@ const messages = { bracketLocation: 'The closing bracket must be {{location}}{{details}}', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/jsx-curly-spacing.js b/lib/rules/jsx-curly-spacing.js index f60bf641e0..b9d4c94a9d 100644 --- a/lib/rules/jsx-curly-spacing.js +++ b/lib/rules/jsx-curly-spacing.js @@ -35,7 +35,7 @@ const messages = { spaceNeededBefore: 'A space is required before \'{{token}}\'', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/jsx-equals-spacing.js b/lib/rules/jsx-equals-spacing.js index 0dfa7218b2..6920fb24bf 100644 --- a/lib/rules/jsx-equals-spacing.js +++ b/lib/rules/jsx-equals-spacing.js @@ -20,7 +20,7 @@ const messages = { needSpaceAfter: 'A space is required after \'=\'', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/jsx-fragments.js b/lib/rules/jsx-fragments.js index dc0444b220..27234f7de6 100644 --- a/lib/rules/jsx-fragments.js +++ b/lib/rules/jsx-fragments.js @@ -28,7 +28,7 @@ const messages = { preferFragment: 'Prefer fragment shorthand over {{react}}.{{fragment}}', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { @@ -171,7 +171,7 @@ module.exports = { ImportDeclaration(node) { if (node.source && node.source.value === 'react') { node.specifiers.forEach((spec) => { - if (spec.type === "ImportSpecifier" && spec.imported && spec.imported.name === fragmentPragma) { + if (spec.type === 'ImportSpecifier' && spec.imported && spec.imported.name === fragmentPragma) { if (spec.local) { fragmentNames.add(spec.local.name); } diff --git a/lib/rules/jsx-indent-props.js b/lib/rules/jsx-indent-props.js index c4e52c66be..2f820b8c64 100644 --- a/lib/rules/jsx-indent-props.js +++ b/lib/rules/jsx-indent-props.js @@ -45,7 +45,7 @@ const messages = { wrongIndent: 'Expected indentation of {{needed}} {{type}} {{characters}} but found {{gotten}}.', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index fcc0ec42c9..72f5f6c47d 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -50,7 +50,7 @@ const messages = { wrongIndent: 'Expected indentation of {{needed}} {{type}} {{characters}} but found {{gotten}}.', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/jsx-no-bind.js b/lib/rules/jsx-no-bind.js index c6f9667b03..2942971018 100644 --- a/lib/rules/jsx-no-bind.js +++ b/lib/rules/jsx-no-bind.js @@ -24,7 +24,7 @@ const messages = { func: 'JSX props should not use functions', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/jsx-no-leaked-render.js b/lib/rules/jsx-no-leaked-render.js index 71c44e7b29..1e271b2a68 100644 --- a/lib/rules/jsx-no-leaked-render.js +++ b/lib/rules/jsx-no-leaked-render.js @@ -109,9 +109,6 @@ function ruleFixer(context, fixStrategy, fixer, reportedNode, leftNode, rightNod throw new TypeError('Invalid value for "validStrategies" option'); } -/** - * @type {import('eslint').Rule.RuleModule} - */ /** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { diff --git a/lib/rules/jsx-sort-default-props.js b/lib/rules/jsx-sort-default-props.js index b0160e498d..ea05418bf8 100644 --- a/lib/rules/jsx-sort-default-props.js +++ b/lib/rules/jsx-sort-default-props.js @@ -25,7 +25,7 @@ const messages = { propsNotSorted: 'Default prop types declarations should be sorted alphabetically', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { deprecated: true, diff --git a/lib/rules/jsx-space-before-closing.js b/lib/rules/jsx-space-before-closing.js index 82076147e0..ffcc357d8b 100644 --- a/lib/rules/jsx-space-before-closing.js +++ b/lib/rules/jsx-space-before-closing.js @@ -23,7 +23,7 @@ const messages = { needSpaceBeforeClose: 'A space is required before closing bracket', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { deprecated: true, diff --git a/lib/rules/no-access-state-in-setstate.js b/lib/rules/no-access-state-in-setstate.js index 7ca0dd6b5c..f4841d8d25 100644 --- a/lib/rules/no-access-state-in-setstate.js +++ b/lib/rules/no-access-state-in-setstate.js @@ -18,7 +18,7 @@ const messages = { useCallback: 'Use callback in setState when referencing the previous state.', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { @@ -76,7 +76,7 @@ module.exports = { if (node.callee.type === 'Identifier' && node.callee.name === method.methodName) { let current = node.parent; while (current.type !== 'Program') { - if (current.type === 'MethodDefinition' && current.key.type === 'PrivateIdentifier') { + if (current.type === 'MethodDefinition' && current.key.type === 'Identifier') { methods.push({ methodName: current.key.name, node: method.node, diff --git a/lib/rules/no-adjacent-inline-elements.js b/lib/rules/no-adjacent-inline-elements.js index d842c376f6..87d7a3bc43 100644 --- a/lib/rules/no-adjacent-inline-elements.js +++ b/lib/rules/no-adjacent-inline-elements.js @@ -76,7 +76,7 @@ const messages = { inlineElement: 'Child elements which render as inline HTML elements should be separated by a space or wrapped in block level elements.', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { @@ -118,8 +118,8 @@ module.exports = { if (node.arguments.length < 2 || !node.arguments[2]) { return; } - if(node.arguments[2].type !== "ArrayExpression") { - return + if (node.arguments[2].type !== 'ArrayExpression') { + return; } const children = node.arguments[2].elements; validate(node, children); diff --git a/lib/rules/no-children-prop.js b/lib/rules/no-children-prop.js index c66f9c18b6..10dd653aa8 100644 --- a/lib/rules/no-children-prop.js +++ b/lib/rules/no-children-prop.js @@ -37,7 +37,7 @@ const messages = { passFunctionAsArgs: 'Do not pass a function as an additional argument to React.createElement. Instead, pass it as a prop.', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/no-danger-with-children.js b/lib/rules/no-danger-with-children.js index c0a0a840bc..728eb81d1f 100644 --- a/lib/rules/no-danger-with-children.js +++ b/lib/rules/no-danger-with-children.js @@ -17,7 +17,7 @@ const messages = { dangerWithChildren: 'Only set one of `children` or `props.dangerouslySetInnerHTML`', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/no-deprecated.js b/lib/rules/no-deprecated.js index 1f5f20249f..60801d32a3 100644 --- a/lib/rules/no-deprecated.js +++ b/lib/rules/no-deprecated.js @@ -115,7 +115,7 @@ const messages = { deprecated: '{{oldMethod}} is deprecated since React {{version}}{{newMethod}}{{refs}}', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/no-find-dom-node.js b/lib/rules/no-find-dom-node.js index a61038fa30..bd7f86ec4b 100644 --- a/lib/rules/no-find-dom-node.js +++ b/lib/rules/no-find-dom-node.js @@ -16,7 +16,7 @@ const messages = { noFindDOMNode: 'Do not use findDOMNode. It doesn’t work with function components and is deprecated in StrictMode. See https://reactjs.org/docs/react-dom.html#finddomnode', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/no-invalid-html-attribute.js b/lib/rules/no-invalid-html-attribute.js index 840b13afb8..a2878f93f0 100644 --- a/lib/rules/no-invalid-html-attribute.js +++ b/lib/rules/no-invalid-html-attribute.js @@ -589,7 +589,7 @@ function checkCreateProps(context, node, attribute) { } } -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/no-is-mounted.js b/lib/rules/no-is-mounted.js index 3ad6eab9b9..6cf65e93a5 100644 --- a/lib/rules/no-is-mounted.js +++ b/lib/rules/no-is-mounted.js @@ -17,7 +17,7 @@ const messages = { noIsMounted: 'Do not use isMounted', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { @@ -41,7 +41,7 @@ module.exports = { } if ( callee.object.type !== 'ThisExpression' - || (callee.property.type === 'PrivateIdentifier' || callee.property.type === 'Identifier') + && callee.property.type === 'Identifier' && callee.property.name !== 'isMounted') { return; } diff --git a/lib/rules/no-render-return-value.js b/lib/rules/no-render-return-value.js index 2b7a87f712..6e9399f51b 100644 --- a/lib/rules/no-render-return-value.js +++ b/lib/rules/no-render-return-value.js @@ -17,7 +17,7 @@ const messages = { noReturnValue: 'Do not depend on the return value from {{node}}.render', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index dc9170432c..ea8397dc4c 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -483,6 +483,7 @@ function tagNameHasDot(node) { ); } +// eslint-disable-next-line valid-jsdoc /** * Get the standard name of the attribute. * @param {String} name - Name of the attribute. @@ -512,7 +513,7 @@ const messages = { dataLowercaseRequired: 'React does not recognize data-* props with uppercase characters on a DOM element. Found \'{{name}}\', use \'{{lowerCaseName}}\' instead', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/no-unused-class-component-methods.js b/lib/rules/no-unused-class-component-methods.js index 433464496e..402c39619f 100644 --- a/lib/rules/no-unused-class-component-methods.js +++ b/lib/rules/no-unused-class-component-methods.js @@ -98,7 +98,7 @@ const messages = { unusedWithClass: 'Unused method or property "{{name}}" of class "{{className}}"', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/no-unused-state.js b/lib/rules/no-unused-state.js index 5f21f37ddd..5468675a9b 100644 --- a/lib/rules/no-unused-state.js +++ b/lib/rules/no-unused-state.js @@ -78,7 +78,7 @@ const messages = { unusedStateField: 'Unused state field: \'{{name}}\'', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/sort-default-props.js b/lib/rules/sort-default-props.js index faaf227c8e..10f980ee5e 100644 --- a/lib/rules/sort-default-props.js +++ b/lib/rules/sort-default-props.js @@ -22,7 +22,7 @@ const messages = { propsNotSorted: 'Default prop types declarations should be sorted alphabetically', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/style-prop-object.js b/lib/rules/style-prop-object.js index 4135b02690..b8a5697986 100644 --- a/lib/rules/style-prop-object.js +++ b/lib/rules/style-prop-object.js @@ -18,7 +18,7 @@ const messages = { stylePropNotObject: 'Style prop value must be an object', }; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: { diff --git a/lib/rules/void-dom-elements-no-children.js b/lib/rules/void-dom-elements-no-children.js index 3de2e5adea..ff1ff56067 100644 --- a/lib/rules/void-dom-elements-no-children.js +++ b/lib/rules/void-dom-elements-no-children.js @@ -47,7 +47,7 @@ function isVoidDOMElement(elementName) { const noChildrenInVoidEl = 'Void DOM element <{{element}} /> cannot receive children.'; -/** @type { import('eslint').Rule.RuleModule } */ +/** @type {import('eslint').Rule.RuleModule} */ module.exports = { meta: { docs: {