Skip to content

Commit 5919660

Browse files
caroline223ljharb
authored andcommitted
[Refactor] boolean-prop-naming, jsx-indent: avoid assigning to arguments
1 parent 5769b53 commit 5919660

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
1616
### Changed
1717
* [Refactor] [`jsx-indent-props`]: improved readability of the checkNodesIndent function ([#3315][] @caroline223)
1818
* [Tests] [`jsx-indent`], [`jsx-one-expression-per-line`]: add passing test cases ([#3314][] @ROSSROSALES)
19+
* [Refactor] `boolean-prop-naming`, `jsx-indent`: avoid assigning to arguments ([#3316][] @caroline223)
1920

2021
[#3321]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3321
2122
[#3320]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3320
2223
[#3317]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3317
24+
[#3316]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3316
2325
[#3315]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3315
2426
[#3314]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3314
2527
[#3311]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3311

lib/rules/boolean-prop-naming.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,7 @@ module.exports = {
172172
* @param {Function} addInvalidProp callback to run for each error
173173
*/
174174
function runCheck(proptypes, addInvalidProp) {
175-
proptypes = proptypes || [];
176-
177-
proptypes.forEach((prop) => {
175+
(proptypes || []).forEach((prop) => {
178176
if (config.validateNested && nestedPropTypes(prop)) {
179177
runCheck(prop.value.arguments[0].properties, addInvalidProp);
180178
return;

lib/rules/jsx-indent.js

-3
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@ module.exports = {
168168
* @return {Number} Indent
169169
*/
170170
function getNodeIndent(node, byLastLine, excludeCommas) {
171-
byLastLine = byLastLine || false;
172-
excludeCommas = excludeCommas || false;
173-
174171
let src = context.getSourceCode().getText(node, node.loc.start.column + extraColumnStart);
175172
const lines = src.split('\n');
176173
if (byLastLine) {

0 commit comments

Comments
 (0)