Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import/order autofixer when using typescript-eslint-parser #1137

Merged

Conversation

justinanastos
Copy link
Contributor

@justinanastos justinanastos commented Jul 12, 2018

Addresses #1086 (comment)

Why?

When using typescript-eslint-parser, AST nodes have a range trie but not start and end. Apparently eslint prefers using range instead of .start and .end as well, see eslint/eslint#8956.

How

Replace use of .start and .end with range[0] and range[1] respectively in the order rule.

Test

I added a test to reproduce the error and then a separate commit to prove this fixes it. All other tests pass.

@coveralls
Copy link

coveralls commented Jul 12, 2018

Coverage Status

Coverage remained the same at 97.273% when pulling 8d02f32 on justinanastos:fix/typescript-import-order-1086 into 5adebd8 on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.273% when pulling 1779242 on justinanastos:fix/typescript-import-order-1086 into 5adebd8 on benmosher:master.

…ofixer

`typescript-eslint-parser` does not add `.start` and `.end` to nodes like
`babel-eslint`. They both include a `range` that can be used isntead.
@justinanastos
Copy link
Contributor Author

Closing to refire CI again

@ljharb ljharb merged commit e5ee158 into import-js:master Jul 16, 2018
@justinanastos justinanastos deleted the fix/typescript-import-order-1086 branch October 9, 2019 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants