8000 feat(eslint-plugin): [sort-type-constituents] support case sensitive sorting by jsfm01 · Pull Request #8760 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
8000

feat(eslint-plugin): [sort-type-constituents] support case sensitive sorting #8760

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

Conversation

jsfm01
Copy link
Contributor
@jsfm01 jsfm01 commented Mar 24, 2024

PR Checklist

Overview

New case sensitive sorting option:

{ "rules": { "@typescript-eslint/sort-type-constituents": [ "error", { "caseSensitive": true } ] } }

New option will help make this rule consistent with other sorting-related rules.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @jsfm01!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

Copy link
netlify bot commented Mar 24, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 7c3e4b6
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/662ab9d3de480e0008fc36bb
😎 Deploy Preview https://deploy-preview-8760--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 5 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@JoshuaKGoldberg
Copy link
Member

Note that we're feature-freezing sort-type-constituents and other naming & sorting stylistic rules: #8792. Since this PR was sent before #8792 was filed, we'll still accept it. We'd hate to mark work as accepted, then pull it out from under you after you've done the work. 🙂

@jsfm01 jsfm01 marked this pull request as ready for review March 31, 2024 21:16
@jsfm01
Copy link
Contributor Author
jsfm01 commented Apr 1, 2024

Hi @JoshuaKGoldberg
This PR is ready for review :)

Copy link
Member
@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Pretty sweet change, very clean. Nicely done! 👏

A couple of requests that I hope won't be too painful to either implement or disagree with?

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Apr 8, 2024
Copy link
codecov bot commented Apr 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.37%. Comparing base (3fd666f) to head (0543689).

❗ Current head 0543689 differs from pull request most recent head 7c3e4b6. Consider uploading reports for the commit 7c3e4b6 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8760      +/-   ##
==========================================
- Coverage   88.04%   87.37%   -0.67%     
==========================================
  Files         410      255     -155     
  Lines       14183    12505    -1678     
  Branches     4135     3926     -209     
==========================================
- Hits        12487    10926    -1561     
+ Misses       1391     1304      -87     
+ Partials      305      275      -30     
Flag Coverage Δ
unittest 87.37% <100.00%> (-0.67%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
.../eslint-plugin/src/rules/sort-type-constituents.ts 93.10% <100.00%> (-1.02%) ⬇️

... and 184 files with indirect coverage changes

@jsfm01 jsfm01 requested a review from JoshuaKGoldberg April 23, 2024 11:01
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Apr 23, 2024
Copy link
Member
@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 🙌

Leaving with 1 approval in case anyone else wants to take a look.

Guy looking through binoculars and saying 'this is the good stuff'

create(
context,
[{ checkIntersections, checkUnions, caseSensitive, groupOrder }],
) {
const collator = new Intl.Collator('en', {
sensitivity: 'base',
Copy link
Member

Choose a reason for hiding this comment

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

[Non-actionable] I tried switching this to 'accent', 'case', and 'variant' instead of the manual caseSensitiveSort function. Nothing passed all the tests. 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When the sensitive case is true, it follows the Unicode code points, no matter the collator sensitivity. If the collator sensitivity is set to 'case', for instance, the sorting would still be case-sensitive, but diacritics and accents would be treated as insignificant. The “accent”, doesn’t distinguish the capital letters, for instance, a = A. I believe we should keep as ‘base’.

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Apr 23, 2024
@JoshuaKGoldberg JoshuaKGoldberg merged commit 987a96e into typescript-eslint:main May 16, 2024
58 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[sort-type-constituents] Feature request: support case sensitive sorting
3 participants
0