Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: object-curly-newline for flow code (#9458)
* Fix: object-curly-newline for flow code (fixes babel-eslint/513) The `object-curly-newline` rule made the assumption that the last token is always `}`. However, when an object is typed with flow this is not the case. This causes false positives, as described in babel/babel-eslint#513. By adding a filter to the `getLastToken` function we skip over the flow types, and get the actual closing brace. For symmetry the same filter is added for the open brace, though I'm not aware of any issues it would fix. * Fix object-curly-newline for flow type literals & added tests - Added tests for `object-curly-newline` in code annotated with flow types - Fixed incorrect behaviour of object-curly-newline for literal object types * Replace brace counting to find matching brace with direct lookup As per #9458 (comment)
- Loading branch information