Skip to content

jsx-sort-props regression breaks callbacksLast option. #1175

Closed
@phyllisstein

Description

I noticed after upgrading to v7.0.0 of this package that the jsx-sort-props rule is no longer honoring my callbacksLast flag. Given this hunk of my ESLint configuration...

  react/jsx-sort-props:
    - warn
    -
      callbacksLast: true
      ignoreCase: true
      reservedFirst: false
      shorthandFirst: true

...a line like this...

<AppBar showLogo={ showLogo } onLogoClick={ this.handleNavigateHome } onToggleMenu={ this.handleToggleMenu } />

...will yield the following warnings:

warning: Props should be sorted alphabetically (react/jsx-sort-props) at src/app/views/app/index.jsx:118:39:
  116 |           <AppMenu />
  117 |         </Popover>
> 118 |         <AppBar showLogo={ showLogo } onLogoClick={ this.handleNavigateHome } onToggleMenu={ this.handleToggleMenu } />
      |                                       ^
  119 |         <main className={ styles.main }>
  120 |           <div className={ styles.mainWrapper } ref={ node => this.scroller = node }>
  121 |             <Switch>


warning: Props should be sorted alphabetically (react/jsx-sort-props) at src/app/views/app/index.jsx:118:79:
  116 |           <AppMenu />
  117 |         </Popover>
> 118 |         <AppBar showLogo={ showLogo } onLogoClick={ this.handleNavigateHome } onToggleMenu={ this.handleToggleMenu } />
      |                                                                               ^
  119 |         <main className={ styles.main }>
  120 |           <div className={ styles.mainWrapper } ref={ node => this.scroller = node }>
  121 |             <Switch>

My expectation would be that with callbacksLast enabled, the showLogo prop should appear before the on... props, which latter should be sorted alphabetically at the end into onLogoClick then onToggleMenu. Though I could certainly be misunderstanding some change to the rule.

Thanks in advance for your help, and let me know if I can furnish any more debugging information!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions