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

[Bug]: autofix for sort-prop-types breaks code containing comments #3794

Open
2 tasks done
tylerlaprade opened this issue Aug 5, 2024 · 0 comments
Open
2 tasks done

Comments

@tylerlaprade
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

Starting code:

type Props = {
  onClose: () => void;
  onSave?: () => void;
  initialContractInfo?: ContractInfo; // used to pre-populate the form just for our tests
  contractVersionTraceId?: TraceId; // used when editing an existing contract
  contractContainerId: TraceId;
  wizardStartIndex?: number;
  contractStatus?: BackendContractStatus;
  contractVersion?: BackendContractVersion;
};

Auto-fixed code:

type Props = {
  initialContractInfo?: ContractInfo; // used to pre-populate the form just for our tests
  // used to pre-populate the form just for our tests
  contractVersionTraceId?: TraceId; // used when editing an existing contract
  // used when editing an existing contract
  contractContainerId: TraceId;
  dContractVersion;
  onClose: () => void;
  onSave?: () => void;
};

Component

function ContractVersionWizard(props: Props) {
  return <div />;
}

Relevant rule config:

    "react/sort-prop-types": [
      "error",
      {
        "callbacksLast": true,
        "requiredFirst": true,
        "sortShapeProp": true,
        "noSortAlphabetically": true,
        "checkTypes": true
      }
    ]

As discussed in #3783

Expected Behavior

Expected result:

type Props = {
  initialContractInfo?: ContractInfo; // used to pre-populate the form just for our tests
  contractVersionTraceId?: TraceId; // used when editing an existing contract
  contractContainerId: TraceId;
  wizardStartIndex?: number;
  contractStatus?: BackendContractStatus;
  contractVersion?: BackendContractVersion;
  onClose: () => void;
  onSave?: () => void;
};

### eslint-plugin-react version

v7.34.4

### eslint version

v8.57.0

### node version

v20.14.10
@tylerlaprade tylerlaprade changed the title [Bug]: autofix for useJsxKeyInIterable breaks code containing comments [Bug]: autofix for sort-prop-types breaks code containing comments Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants