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

add fixer for first #1046

Merged
merged 6 commits into from
Mar 30, 2018
Merged

add fixer for first #1046

merged 6 commits into from
Mar 30, 2018

Conversation

fnknzzz
Copy link
Contributor

@fnknzzz fnknzzz commented Mar 14, 2018

Add autofixer for rule first. Refer issue #1040.

@coveralls
Copy link

coveralls commented Mar 14, 2018

Coverage Status

Coverage increased (+0.2%) to 96.458% when pulling 2429205 on fengkfengk:dev into 158f4e8 on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.2%) to 95.011% when pulling c638fdd on fengkfengk:dev into 158f4e8 on benmosher:master.

, output: "import { x } from './foo';\
import { y } from './bar';\
import { z } from './baz';\
export { x };"
})
, test({ code: "import { x } from './foo'; import { y } from 'bar'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nbd but could this use a continuation instead of a literal \n?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it must be a seperator here. I thought a line-breaker is suitable, or may be another option?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@ljharb
Copy link
Member

ljharb commented Mar 16, 2018

Are you no longer interested in completing this PR?

(If so, please reopen this one instead of opening another)

@fnknzzz fnknzzz reopened this Mar 24, 2018
@fnknzzz
Copy link
Contributor Author

fnknzzz commented Mar 24, 2018

now if a specifier is referenced before the import, it won't be reordered.

Copy link
Member

@benmosher benmosher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know anything about fixers but the tests look good 👍

@ljharb
Copy link
Member

ljharb commented Mar 28, 2018

@fengkfengk now we just need to get coverage metrics back up, and we can merge this!

@fnknzzz
Copy link
Contributor Author

fnknzzz commented Mar 30, 2018

now the coverage improved, some unreachable lines are fixed.

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.

None yet

4 participants