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

♻️ Use alias imports instead of local in src/ #35589

Merged
merged 3 commits into from
Aug 10, 2021

Conversation

rcebulko
Copy link
Contributor

The lint autofix handles most imports automatically, but imports from flatfiles in src are still able to use relative ./* imports of aliased paths. This updates src/*.js to use aliased importrs.
Excludes src/3p-frame-messaging.js to avoid merge conflicts with #35563

@samouri
Copy link
Member

samouri commented Aug 10, 2021

How did you run this? Are you also modifying lint settings anywhere?

@rcebulko
Copy link
Contributor Author

How did you run this? Are you also modifying lint settings anywhere?

Normally amp lint --fix --local_changes; that's how the imports everywhere else were updated. These wouldn't be autofixed though because they are the only files with the ability to reference aliased dirs as submodules via ./*, which is allowed. These were fixed manually (regex replace)

@samouri
Copy link
Member

samouri commented Aug 10, 2021

How did you run this? Are you also modifying lint settings anywhere?

Normally amp lint --fix --local_changes; that's how the imports everywhere else were updated. These wouldn't be autofixed though because they are the only files with the ability to reference aliased dirs as submodules via ./*, which is allowed. These were fixed manually (regex replace)

In that case, as long as tests pass I'm happy. that said, theres nothing stopping this from heading back to relative imports right?

@rcebulko
Copy link
Contributor Author

How did you run this? Are you also modifying lint settings anywhere?

Normally amp lint --fix --local_changes; that's how the imports everywhere else were updated. These wouldn't be autofixed though because they are the only files with the ability to reference aliased dirs as submodules via ./*, which is allowed. These were fixed manually (regex replace)

In that case, as long as tests pass I'm happy. that said, theres nothing stopping this from heading back to relative imports right?

Not without writing a custom lint plugin. Once the rest of the flatfiles here are cleared out/moved elsewhere, it'll no longer be possible, so the extra lint rule doesn't feel worthwhile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants