File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
8
8
### Added
9
9
* [ ` jsx-newline ` ] : add ` allowMultiline ` option when prevent option is true ([ #3311 ] [ ] @TildaDares )
10
10
11
+ ### Fixed
12
+ * [ Refactor] [ ` jsx-indent-props ` ] : improved readability of the checkNodesIndent function ([ #3315 ] [ ] @caroline223 )
13
+
14
+ [ #3315 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3315
11
15
[ #3311 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3311
12
16
13
17
## [ 7.30.1] - 2022.06.23
Original file line number Diff line number Diff line change @@ -172,17 +172,23 @@ module.exports = {
172
172
* @param {Number } indent needed indent
173
173
*/
174
174
function checkNodesIndent ( nodes , indent ) {
175
+ let nestedIndent = indent ;
175
176
nodes . forEach ( ( node ) => {
176
177
const nodeIndent = getNodeIndent ( node ) ;
177
- if ( line . isUsingOperator && ! line . currentOperator && indentSize !== 'first' && ! ignoreTernaryOperator ) {
178
- indent += indentSize ;
178
+ if (
179
+ line . isUsingOperator
180
+ && ! line . currentOperator
181
+ && indentSize !== 'first'
182
+ && ! ignoreTernaryOperator
183
+ ) {
184
+ nestedIndent += indentSize ;
179
185
line . isUsingOperator = false ;
180
186
}
181
187
if (
182
188
node . type !== 'ArrayExpression' && node . type !== 'ObjectExpression'
183
- && nodeIndent !== indent && astUtil . isNodeFirstInLine ( context , node )
189
+ && nodeIndent !== nestedIndent && astUtil . isNodeFirstInLine ( context , node )
184
190
) {
185
- report ( node , indent , nodeIndent ) ;
191
+ report ( node , nestedIndent , nodeIndent ) ;
186
192
}
187
193
} ) ;
188
194
}
You can’t perform that action at this time.
0 commit comments