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

Allow specifying locale for react/jsx-sort-props #3002

Closed
nizamiza opened this issue Jun 15, 2021 · 2 comments
Closed

Allow specifying locale for react/jsx-sort-props #3002

nizamiza opened this issue Jun 15, 2021 · 2 comments

Comments

@nizamiza
Copy link

We work in a team where people have systems with different locales. When we add react/jsx-sort-props to our eslint config, it behaves differently for each system.

For example, on a en-US system, props for the component below are sorted like this:

<RawFileField
  onChange={handleChange}
  onFileRemove={asMedia ? null : handleRemove}
  {...props}
/>

But on a sk-SK system, they're sorted like this:

<RawFileField
  onFileRemove={asMedia ? null : handleRemove}
  onChange={handleChange}
  {...props}
/>

This results in eslint tests passing locally, but failing during CI/CD pipelines. Ability to specify which locale to use for sorting would be nice.

@ljharb
Copy link
Member

ljharb commented Jun 15, 2021

That seems like a reasonable option - it would default to the current locale, and you could specify whatever value you wanted in the config.

ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Feb 22, 2022
ljharb added a commit to ljharb/eslint-plugin-react that referenced this issue Feb 22, 2022
@ljharb ljharb closed this as completed in 6d6f5bd Feb 23, 2022
@ljharb
Copy link
Member

ljharb commented Feb 23, 2022

Note that in node < 13, the sk-SK locale doesn't exist, so we should probably add some test cases for a locale that sorts differently than en-US, that's present in older versions of node.

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