-
Notifications
You must be signed in to change notification settings - Fork 1.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
Update sewing-kit #532
Update sewing-kit #532
Conversation
Prior to this version of eslint-plugin-shopify some rules were inadvertently disabled due to ordering of plugins causing prior plugins to be disabled. This has now been fixed so we can see errors for things that were problematic.
Fixes issues relating to import order and useless path segments
@@ -26,9 +28,12 @@ | |||
"allowBlockStart": false | |||
} | |||
], | |||
"import/no-cycle": "off", |
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.
Initially disabled rules!
import/no-cycle
shall be enabled in a follow-up PR as this one is already noisy enough as-is, and fixing it will require a lot of changes and there's potential for weirdness as I unpick the cycles.import/no-named-as-default
I'm not really sure what to do with. This currently has lots of errors and fixing it may require rethinking how we we write imports/exports. It doesn't help that I think the rule itself might be a bit buggy.shopify/jsx-no-complex-expressions
we probably want to keep disabled, This has 10 violations currently and in those cases we can't avoid it without some small rewrites that are more complex than I am comfortable putting in this PR that is mostly brainless changes.
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.
All sounds good 👍 I think we might wanna create follow up issues for all of these so we don't forget about them.
@@ -38,9 +38,6 @@ rm('-rf', resolvePath(root, 'types/src')); | |||
|
|||
mv(resolvePath(intermediateBuild, 'src/*'), intermediateBuild); | |||
|
|||
const srcReadme = resolvePath(root, './src/components/README.md'); |
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.
These variables were never used
@@ -62,7 +61,7 @@ async function runPa11y() { | |||
), | |||
); | |||
|
|||
urls.map((path) => { | |||
urls.forEach((path) => { |
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 stops eslint complaining that there is no return value as in this case we don't care about the return value
@@ -139,6 +138,7 @@ export function withSticky() { | |||
| React.ComponentClass<OwnProps & WithAppProviderProps> & C | |||
| React.SFC<OwnProps & WithAppProviderProps> & C, | |||
): any & C { | |||
// eslint-disable-next-line shopify/react-initialize-state |
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 really sure what the correct fix is here so I hand waved it away as this is deep dark typescript magic that I didn't want to mess with
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 think there is an issue with the order of the generics here. <{}, OwnProps & WithAppProviderProps>
would mean {}
is the props and OwnProps & WithAppProviderProps
is the state which is probably why you're getting this error. Try changing it to <OwnProps & WithAppProviderProps, never>
.
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 scared, and @AndrewMusgrave was poking around this area in https://github.com/Shopify/polaris-react-deprecated/pull/2274.
I think that PR might solve this, and then because we've got the eslint-comments plugin it'll remind us to delete the ignore line if it is not needed
@@ -42,7 +42,6 @@ export default class ColorPicker extends React.PureComponent<Props, State> { | |||
return; | |||
} | |||
|
|||
// eslint-disable-next-line react/no-did-mount-set-state |
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.
calling setState in componentDidMount shouldn't happen that often but it is a legitimate use according to the react docs. See jsx-eslint/eslint-plugin-react#1754 for context.
@@ -5,7 +5,9 @@ import {Page, DisplayText, Card} from 'components'; | |||
import {noop} from '../../../utilities/other'; | |||
import {LinkAction} from '../../../types'; | |||
import {Header} from '../components'; | |||
// eslint-disable-next-line shopify/strict-component-boundaries |
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 100% sure what the right fix for this is, I think it might be pulling these types up into a higher level, as they're referenced in some other places too. But that's a fix more complex than what I want to do in this PR
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.
Makes sense and I agree if we need them outside of the component they should probably be available through components/Header
. Maybe create a follow up issue?
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.
💯
WHY are these changes introduced?
WHAT is this pull request doing?
Updates to the latest version of sewing-kit
Updates files to comply with linting rules.
Review this PR one commit at a time as about half the size of this pr comes from 7f835d3 which is the result of running
yarn format
rather than any manual changes.How to 🎩
yarn lint
andyarn test
should both pass.Change around the ordering of imports so sibling imports come before parent imports and see
yarn lint
complain