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

Prefer JSX fragment shorthand syntax #3075

Merged

Conversation

vojtechszocs
Copy link
Contributor

@vojtechszocs vojtechszocs commented Oct 23, 2019

Just another step towards updating common ESLint stack & associated rule changes.

Related ESLint rule: react/jsx-fragments (should be turned on by default in future)

Note: this excludes cases where the fragment receives props, like <React.Fragment key="key">

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. component/ceph Related to ceph-storage-plugin component/core Related to console core functionality component/dashboard Related to dashboard component/dev-console Related to dev-console component/knative Related to knative-plugin component/kubevirt Related to kubevirt-plugin component/metal3 Related to metal3-plugin component/monitoring Related to monitoring component/noobaa Related to noobaa-storage-plugin component/olm Related to OLM component/shared Related to console-shared approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 23, 2019
@vojtechszocs
Copy link
Contributor Author

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 23, 2019
@vojtechszocs
Copy link
Contributor Author

/hold cancel

@vojtechszocs
Copy link
Contributor Author

vojtechszocs commented Oct 23, 2019

@spadgett @christianvogt Updating our ESLint stack to latest component versions turns on the react/jsx-fragments rule by default, hence this change.

If you prefer the classic <React.Fragment> syntax, let me know and we can turn above mentioned rule off by default as part of ESLint stack bump.

) : (
<LoadingBox className="loading-box loading-box__loading" />
);
return skeleton ? <>{skeleton}</> : <LoadingBox className="loading-box loading-box__loading" />;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only non-trivial replacement change.

@vojtechszocs
Copy link
Contributor Author

/hold cancel

@spadgett
Copy link
Member

If you prefer the classic <React.Fragment> syntax, let me know and we can turn above mentioned rule off by default as part of ESLint stack bump.

I prefer the shorthand 👍

@christianvogt
Copy link
Contributor

Same.

@vojtechszocs
Copy link
Contributor Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 24, 2019
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 24, 2019
@vojtechszocs
Copy link
Contributor Author

Rebased & ensured that all <React.Fragment> occurences are covered.

Updated packages/eslint-plugin-console/lib/config/react.js to auto-detect React version. This aligns with equivalent setting in root .eslintrc file.

Now enforcing react/jsx-fragments for both public and packages code.

@vojtechszocs
Copy link
Contributor Author

@christianvogt ESLint config changes extracted into a separate commit.

@vojtechszocs
Copy link
Contributor Author

/retest

@christianvogt
Copy link
Contributor

/lgtm

you'll be up against the queue with rebasing

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 25, 2019
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@spadgett
Copy link
Member

/lgtm cancel

needs rebase :/ we might hold other PRs after this is rebased

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 25, 2019
@vojtechszocs
Copy link
Contributor Author

needs rebase :/ we might hold other PRs after this is rebased

Rebasing now.

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 25, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, spadgett, vojtechszocs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Oct 25, 2019

@vojtechszocs: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
ci/prow/e2e-gcp 62ace81 link /test e2e-gcp

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@vojtechszocs
Copy link
Contributor Author

Hmm, yarn test __tests__/components/utils/promise-component.spec.tsx works for me.

/retest

@openshift-merge-robot openshift-merge-robot merged commit b1d9ea4 into openshift:master Oct 25, 2019
@spadgett spadgett added this to the v4.3 milestone Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/ceph Related to ceph-storage-plugin component/core Related to console core functionality component/dashboard Related to dashboard component/dev-console Related to dev-console component/knative Related to knative-plugin component/kubevirt Related to kubevirt-plugin component/metal3 Related to metal3-plugin component/monitoring Related to monitoring component/noobaa Related to noobaa-storage-plugin component/olm Related to OLM component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged. queue/multiple-rebases size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants