add fixer for first - #1046
add fixer for first#1046
first#1046Conversation
| import { z } from './baz';\ | ||
| export { x };" | ||
| }) | ||
| , test({ code: "import { x } from './foo'; import { y } from 'bar'" |
There was a problem hiding this comment.
can we validate that the output matches the input here?
| , errors: 3 | ||
| , output: "import { x } from './foo';\ | ||
| import { y } from './bar';\ | ||
| import { z } from './baz';\nvar foo = bar;" |
There was a problem hiding this comment.
nbd but could this use a continuation instead of a literal \n?
There was a problem hiding this comment.
it must be a seperator here. I thought a line-breaker is suitable, or may be another option?
There was a problem hiding this comment.
It just looks odd to see the previous lines using \ but this one using \n
| import { z } from './baz';" | ||
| , errors: 2 | ||
| , output: "import { y } from './bar';\ | ||
| import { z } from './baz';\nvar a = x;\ |
There was a problem hiding this comment.
this is actually incorrect; because foo might depend on side effects from bar and baz - this example can't be reordered at all.
| import { y } from './bar';\ | ||
| import { z } from './baz';" | ||
| , errors: 3 | ||
| , output: "import { x } from './foo';\ |
|
Are you no longer interested in completing this PR? (If so, please reopen this one instead of opening another) |
|
now if a specifier is referenced before the import, it won't be reordered. |
benmosher
left a comment
There was a problem hiding this comment.
I don't know anything about fixers but the tests look good 👍
|
@fengkfengk now we just need to get coverage metrics back up, and we can merge this! |
|
now the coverage improved, some unreachable lines are fixed. |
Add autofixer for rule
first. Refer issue #1040.