-
Notifications
You must be signed in to change notification settings - Fork 11
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
[ARGG-741]: Add rule to set alphabetical order of imports #623
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* eslint-disable no-unused-vars,import/no-unresolved,import/extensions */ | ||
// import/order | ||
import ReactDom from 'react-dom'; | ||
import PropTypes from 'prop-types'; | ||
import { Component, Fragment } from 'react'; | ||
|
||
import { fontSizeSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6'; | ||
import ArrowUpIcon from '@skyscanner/backpack-web/bpk-component-icon/sm/long-arrow-up'; | ||
import BpkButton from '@skyscanner/backpack-web/bpk-component-button'; | ||
import BpkButtonLink from '@skyscanner/backpack-web/bpk-component-link'; | ||
|
||
import Component1 from '../Component1'; | ||
import Component2 from '../../Component2'; | ||
/* eslint-enable no-unused-vars,import/no-unresolved,import/extensions */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not against this conceptually - but I do remember feedback we got the last time we adjusted import order rules.
It was very disruptive for people for two reasons:
--fix
to make a PR passSo while the exact rule itself isn't breaking, its possible that the side effects of meeting it would count as such? I can argue either way here, just one to consider.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do decide on a breaking release, it's worth considering what else to put in it:
'import/prefer-default-export': 'off',
-- turning this off, since the large codebases internally override this, and some invert it to add'import/no-default-export': 'error',
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only concern with making it major is that people might feel more inclined to postpone the update, I think since there are quick fixes we can make it minor, but don't feel very strongly about either option 😄
How is it related to
'import/prefer-default-export': 'off'
and'import/no-default-export': 'error',
? 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey folks thanks for the review, understand that this makes big changes across large codebases and this was something that I raised within the web enablement team around just do it locally or benefit everyone.
Whilst it would make a big change it as mentioned is auto fixable so whilst looks disruptive isn't a heavy hitter, but would require a little checking in case it did have an effect or actually fixes warnings folks have ignored and turned off in webpack for css ordering.
I would avoid adding more rules and scope to this ticket because it's not an impact and or might cause impact to the result of the current work, which is currently based on just this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this current ticket, but if we decide to release this as a major then we should pause to think what else to include in the major (maybe nothing).
To argue for a major: The side effects of moving imports around are not autofixable.
If someone has:
and the imports move, the comment will not.
We got very poor feedback from squads the last time we released an import order change - people definitely considered it a major. They definitely considered it a heavy hitter, having to manually update 100s of suppressions inside import groups.
I do not think we should ever shy away from a major to effectively hide how much work something would be - if we think it is, then it is.
To argue against a major:
The lint rule itself is autofixable, so not major. From e-c-s's point of view side effects are out of scope for determining the semver of a change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 But I believe for most projects this will not be a big change worthy of a major release and those projects will be postponing the update seeing it as a potential time consuming task. I might be wrong though actually given we already have feedback from squads seeing this as a major 😅 not sure how long ago that was and if it still applies.
I think we tested this already in a project (can't remember where), what was the impact on that project?
I agree with this. Also completely agree that the side effects can have a big impact making it a bigger task, but I'm not too sure how many projects will be impacted by that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unknown! And can change at any time.
I think we decide conceptually holistically - then apply that thinking, rather than in this case trying to guess which projects - there are non-Skyscanner projects too, and while they're not our primary customers they do get impacted.
I'm happy with either (can really argue either side to be devil's advocate) - just wanted to make sure we considered it, since last time it did make people unhappy.
However while its worth taking that into account, when it is a change that fixes a problem then its not at all to say not to do it, just to make sure the semver matches whichever mindset from the two (or more) arguments above.