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
88### Added
99* [ ` jsx-newline ` ] : add ` allowMultiline ` option when prevent option is true ([ #3311 ] [ ] @TildaDares )
1010
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
1115[ #3311 ] : https://github.com/jsx-eslint/eslint-plugin-react/pull/3311
1216
1317## [ 7.30.1] - 2022.06.23
Original file line number Diff line number Diff line change @@ -173,16 +173,22 @@ module.exports = {
173173 */
174174 function checkNodesIndent ( nodes , indent ) {
175175 nodes . forEach ( ( node ) => {
176+ let nestedIndent = indent ;
176177 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 ;
179185 line . isUsingOperator = false ;
180186 }
181187 if (
182188 node . type !== 'ArrayExpression' && node . type !== 'ObjectExpression'
183- && nodeIndent !== indent && astUtil . isNodeFirstInLine ( context , node )
189+ && nodeIndent !== nestedIndent && astUtil . isNodeFirstInLine ( context , node )
184190 ) {
185- report ( node , indent , nodeIndent ) ;
191+ report ( node , nestedIndent , nodeIndent ) ;
186192 }
187193 } ) ;
188194 }
You can’t perform that action at this time.
0 commit comments