diff --git a/CHANGELOG.md b/CHANGELOG.md index ecb9789788..ca44284b72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,10 +16,12 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange ### Changed * [Refactor] [`jsx-indent-props`]: improved readability of the checkNodesIndent function ([#3315][] @caroline223) * [Tests] [`jsx-indent`], [`jsx-one-expression-per-line`]: add passing test cases ([#3314][] @ROSSROSALES) +* [Refactor] `boolean-prop-naming`, `jsx-indent`: avoid assigning to arguments ([#3316][] @caroline223) [#3321]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3321 [#3320]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3320 [#3317]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3317 +[#3316]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3316 [#3315]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3315 [#3314]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3314 [#3311]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3311 diff --git a/lib/rules/boolean-prop-naming.js b/lib/rules/boolean-prop-naming.js index b4cd5a790f..0d00c051e2 100644 --- a/lib/rules/boolean-prop-naming.js +++ b/lib/rules/boolean-prop-naming.js @@ -172,9 +172,7 @@ module.exports = { * @param {Function} addInvalidProp callback to run for each error */ function runCheck(proptypes, addInvalidProp) { - proptypes = proptypes || []; - - proptypes.forEach((prop) => { + (proptypes || []).forEach((prop) => { if (config.validateNested && nestedPropTypes(prop)) { runCheck(prop.value.arguments[0].properties, addInvalidProp); return; diff --git a/lib/rules/jsx-indent.js b/lib/rules/jsx-indent.js index ad14fa6a34..6946e35f6b 100644 --- a/lib/rules/jsx-indent.js +++ b/lib/rules/jsx-indent.js @@ -168,9 +168,6 @@ module.exports = { * @return {Number} Indent */ function getNodeIndent(node, byLastLine, excludeCommas) { - byLastLine = byLastLine || false; - excludeCommas = excludeCommas || false; - let src = context.getSourceCode().getText(node, node.loc.start.column + extraColumnStart); const lines = src.split('\n'); if (byLastLine) {