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

Sewing-kit bump #2369

Merged
merged 6 commits into from Nov 8, 2019
Merged

Sewing-kit bump #2369

merged 6 commits into from Nov 8, 2019

Conversation

BPScott
Copy link
Member

@BPScott BPScott commented Oct 26, 2019

WHY are these changes introduced?

This updates our eslint version to 6 and our eslint-plugin-shopify
version to v31, which includes support for the new @typescript-eslint
parser so we can get rid of that resolution hack.

WHAT is this pull request doing?

Updates sewing-kit and updates code to adhere to updated rules.

This also changes our vscode config so that the prettier extension no longer formats our {js,ts}x? files on save and instead this is handled by the eslint extension, this is because the prettier extension doesn't play nice with eslint 6 (as it uses prettier-eslint under the hood which doesn't like eslint6: prettier/prettier-eslint#236) and its future roadmap will remove support for running eslint formatting (prettier/prettier-vscode#958).

How to 🎩

linting and tests pass

After doing a yarn install restart VSCode and ensure that format on save still works for various file types:

  • JS files
  • JSX files (don't think we have any of these but whatevs)
  • TS files
  • TSX files (these 4 have changes to their behaviour as they're now using the eslint extension to format rather than the prettier extension
  • scss files (this has no changes but nice to regression test)
  • md files (this has no changes but nice to regression test)

@github-actions
Copy link
Contributor

github-actions bot commented Oct 26, 2019

💦 Potential splash zone of changes introduced to src/**/*.tsx in this pull request:

Files modified30
Files potentially affected85

Details

All files potentially affected (total: 85)
📄 .eslintrc (total: 0)

Files potentially affected (total: 0)

📄 .vscode/settings.json (total: 0)

Files potentially affected (total: 0)

📄 UNRELEASED.md (total: 0)

Files potentially affected (total: 0)

📄 package.json (total: 0)

Files potentially affected (total: 0)

📄 scripts/pa11y.js (total: 0)

Files potentially affected (total: 0)

🧩 scripts/splash/index.tsx (total: 0)

Files potentially affected (total: 0)

🧩 scripts/splash/treebuilder.ts (total: 0)

Files potentially affected (total: 0)

🧩 src/components/AccountConnection/tests/AccountConnection.test.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/AppProvider/AppProvider.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/AppProvider/tests/AppProvider.test.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Autocomplete/Autocomplete.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Autocomplete/components/ComboBox/ComboBox.tsx (total: 1)

Files potentially affected (total: 1)

🧩 src/components/Banner/tests/Banner.test.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Breadcrumbs/Breadcrumbs.tsx (total: 2)

Files potentially affected (total: 2)

🧩 src/components/Choice/Choice.tsx (total: 7)

Files potentially affected (total: 7)

🧩 src/components/Choice/tests/Choice.test.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/ChoiceList/ChoiceList.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Connected/tests/Connected.test.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/ContextualSaveBar/ContextualSaveBar.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/DatePicker/components/Month/Month.tsx (total: 6)

Files potentially affected (total: 6)

🧩 src/components/DropZone/DropZone.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/DropZone/tests/DropZone.test.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/DropZone/utils/index.ts (total: 1)

Files potentially affected (total: 1)

🧩 src/components/ExceptionList/ExceptionList.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Filters/components/ConnectedFilterControl/ConnectedFilterControl.tsx (total: 1)

Files potentially affected (total: 1)

🧩 src/components/Frame/components/ToastManager/ToastManager.tsx (total: 2)

Files potentially affected (total: 2)

🧩 src/components/Icon/Icon.tsx (total: 85)

Files potentially affected (total: 85)

🧩 src/components/Loading/Loading.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Loading/tests/Loading.test.tsx (total: 0)

Files potentially affected (total: 0)

🧩 src/components/Modal/Modal.tsx (total: 4)

Files potentially affected (total: 4)


This comment automatically updates as changes are made to this pull request.
Feedback, troubleshooting: open an issue or reach out on Slack in #polaris-tooling.

"error",
{
"allow": [
"UNSTABLE_Color",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a bit nicer than sprinkling single-line ignores throughout the codebase

{
"files": ["**/*.test.{ts,tsx}"],
"rules": {
"jest/no-truthy-falsy": "off",
"shopify/jsx-no-hardcoded-content": "off",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now turned off in tests by default

},
"overrides": [
{
"files": ["src/**/*.{ts,tsx}"],
Copy link
Member Author

Choose a reason for hiding this comment

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

Because some of our ts files aren't included in our tsconfig's files list we can't set this stuff at the global level, which is a little annoying but not the end of the world.

@@ -16,7 +16,7 @@ describe('<AppProvider />', () => {
});

it('updates context when props change', () => {
const Child: React.SFC<{}> = () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

A lot of the changes in this PR are "that's the default value for the generic, you don't need to specify that"

@@ -5,9 +5,6 @@ import {useAppBridge} from '../../utilities/app-bridge';

export interface LoadingProps {}

// This does have a display name, but the linting has a bug in it
// https://github.com/yannickcr/eslint-plugin-react/issues/2324
// eslint-disable-next-line react/display-name
Copy link
Member Author

Choose a reason for hiding this comment

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

We've updated the version of eslint-plugin-react to a version that fixes this false positive


// Wrapping forwardRef in a memo means the component does not get a name set
// So we have to do it ourselves
// https://github.com/facebook/react/issues/16722
Copy link
Member Author

Choose a reason for hiding this comment

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

Bug whack-a-mole. I'm not convinced we should be wrapping this in memo in the first place: #2330

@@ -11,6 +11,7 @@ export function get<T>(

const keys = Array.isArray(keypath) ? keypath : getKeypath(keypath);
let acc = obj;
// eslint-disable-next-line @typescript-eslint/prefer-for-of
Copy link
Member Author

Choose a reason for hiding this comment

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

fixing this causes some other error so gonna ignore it

This updates our eslint version to 6 and our eslint-plugin-shopify
version to v31, which includes support for the new @typescript-eslint
parser.

Enable just the basic typescript rules for now
The prettier plugin is going to remove eslint integration soon, let's
get ahead of the curve while sidestepping the problem that
prettier-eslint doesn't work with eslint 6
@BPScott BPScott requested a review from kaelig November 8, 2019 23:25
Copy link
Contributor

@kaelig kaelig left a comment

Choose a reason for hiding this comment

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

Format on save works! I found a small regression in yarn splash but other than that it's good to go.

@@ -202,7 +202,7 @@ const App = () => {
<Color dim>
<Box width={3}>💡</Box>
<Box>
Tip: to disable these reports, run{' '}
Copy link
Contributor

Choose a reason for hiding this comment

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

This causes a regression where a space is missing between run and DISABLE_SPLASH:

Screen Shot 2019-11-08 at 3 20 51 PM

@@ -81,7 +81,7 @@ const Components = ({components, status}) => (
<React.Fragment>
{status === 'loading' && (
<Box marginLeft={4} marginBottom={1}>
{' '}Please wait during compilation… Beep boop beep 🤖
Please wait during compilation… Beep boop beep 🤖
Copy link
Contributor

Choose a reason for hiding this comment

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

No regression here – all good.

@@ -17,9 +17,6 @@ export interface ToastManagerProps {
toastMessages: (ToastPropsWithID)[];
}

// This does have a display name, but the linting has a bug in it
// https://github.com/yannickcr/eslint-plugin-react/issues/2324
// eslint-disable-next-line react/display-name
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉 🔥

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

Successfully merging this pull request may close these issues.

None yet

2 participants