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

[Fix] order: codify invariants from docs into config schema #3152

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Xunnamius
Copy link
Contributor

@Xunnamius Xunnamius commented Jan 26, 2025

Updating schema wrt #3127 (comment)

EDIT: depends on #3129 for its added tests

@ljharb
Copy link
Member

ljharb commented Jan 26, 2025

This PR seems to have too much stuff in it - but either way, if a rule or option is already released, its schema can’t be tightened further.

@Xunnamius
Copy link
Contributor Author

Xunnamius commented Jan 27, 2025

@ljharb It seems like it has a lot because it's on top of the consolidateIslands PR (rather than main so the schema changes can run against the latest tests), but the two new commits are tiny and only touch the schema and two tests. I can pull the lines around dependencies/consolidateIslands one commit up into the consolidateIslands PR if desired :)

EDIT: I can also rebase onto main and decouple from the other PRs, but not hitting all the new tests plus no direct tests of the schema makes me a bit nervous.

As for the tightening of existing options, I assume you're talking about lines 865 and 866 for pathGroupsExcludedImportTypes? I can revert those. I did add a comment to the groups schema warning that additional validation happens elsewhere, and added two newlines to the named schema for consistency, but those changes should be just cosmetic.

@ljharb
Copy link
Member

ljharb commented Jan 27, 2025

In that case, I'll wait to review this since it needs to wait on #3129

@ljharb ljharb marked this pull request as draft January 27, 2025 05:49
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

these changes are non-breaking iff they exclude things that the rule already checks.

… which would also imply there's some code that can be removed, since the checks are not guaranteed to be done by eslint?

@@ -858,9 +858,12 @@ module.exports = {
properties: {
groups: {
type: 'array',
// Verified manually in the convertGroupsToRanks function
Copy link
Member

Choose a reason for hiding this comment

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

no need for the comment. but this can be verified to have numbers in it, and no duplicates, yes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The secondary validation has its own error messages. I believe you're saying to move the duplicates/existence validation logic up to the schema? That would change the error messages and perhaps other behavior. For instance, there are currently unit tests that check for the current error messages.

Would that count as tightening the schema of a released option?

Copy link
Member

Choose a reason for hiding this comment

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

Changed error messages are fine; test cases that always error, changing to "removed test cases because it's now unreachable" is also fine, I think.

src/rules/order.js Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.19%. Comparing base (4f145a2) to head (30b4dcf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3152      +/-   ##
==========================================
- Coverage   95.17%   92.19%   -2.98%     
==========================================
  Files          83       83              
  Lines        3688     3690       +2     
  Branches     1331     1331              
==========================================
- Hits         3510     3402     -108     
- Misses        178      288     +110     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants