-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Store: Fix ESLint errors in WCS, tests, lib, and components directories #24571
Conversation
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.
Just a few tweaks requested, but otherwise looks good 🙂
@@ -98,6 +98,20 @@ class FormCountrySelectFromApi extends Component { | |||
} | |||
} | |||
|
|||
const getLocationsListFromContinents = ( state, continents, siteId ) => { |
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 don't think this is the PR for it, but this should probably be moved to a selector in sites/data/locations
, maybe called getContinentsWithCountries
.
@@ -127,12 +127,15 @@ const overlayShippingZoneMethods = ( state, zone, siteId, extraEdits ) => { | |||
enabled = getShippingZoneMethod( state, method._originalId, siteId ).enabled; | |||
} | |||
|
|||
// Prettier formatting indents the schema line in a way eslint doesn't like. |
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.
Prettier seems to format it as following, which isn't super intuitive IMO but is valid for the linter. I think we should either update this comment, or use the prettier/eslint format
const defaultValues = startsWith( method.methodType, 'wc_services' )
? getDefaultSettingsValues(
getShippingMethodSchema( state, method.methodType, siteId ).formSchema
)
: {};
@@ -42,12 +43,13 @@ const PackageList = ( props ) => { | |||
const onOpenClick = () => props.openPackage( orderId, siteId, pckgId ); | |||
return ( | |||
<div className="packages-step__list-item" key={ pckgId }> | |||
<div | |||
<Button | |||
borderless |
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.
e1aabf7
to
749a1dc
Compare
@ryelle Thanks for the review. I updated the text color for the packages dialog. I also added a TODO to make that a proper selector which I can handle in a follow-up PR. For the indent/linter one -- I've tried formatting that line a few different ways. Prettier keeps updating it on commit to:
which is slightly different from what you pasted above. The linter will complain "Expected indentation of 4 tabs but found 5" without disabling the line there. I've at least updated the comment to be a bit clearer. |
@justinshreve I wonder if #24551 would help there at all.. /cc @jsnajdr |
// https://github.com/Automattic/wp-calypso/pull/24571#discussion_r185268996 | ||
const getContinentsWithCountries = ( state, continents, siteId ) => { | ||
const locationsList = []; | ||
continents.forEach( continent => { |
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.
this could be a map
instead a forEach
with pushes
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.
Thanks! In this PR I'm just going to move it out of connect
, but I plan on making this a proper selector + add some tests in a follow-up, so I can do some code cleanup there.
@justinshreve #24635 should help with the weird formatting cases. |
The indenting of ternaries isn't a bug, it's a difference of opinion between Prettier and ESLint. The ESLint |
@justinshreve apparently I had a setting on in my editor that ran |
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.
LGTM!
See #24504.
This fixes the eslint issues in the following files:
Some of these are around duplicate test descriptions, indentation, and buttons vs links. No functionality should be changed so testing can just be spot checking.
To Test:
npm run test-client client/extensions/woocommerce