Repository navigation
fix: state how the alphabetical function compares elements - #27
Open
joostfarla wants to merge 1 commit into
Open
joostfarla wants to merge 1 commit into
joostfarla wants to merge 1 commit into
Conversation
The requirement said numbers are compared by value and two values of different types count as in order. That did not match Spectral and OpenLint. The section now states the comparison in full. A table says when a compared value is out of order with the next one, for every pair of types. A numeric string is defined by the StringNumericLiteral grammar of ECMAScript. String order follows the Unicode Collation Algorithm and the locale data of CLDR, and the reference to ECMA-402 is removed. The requirement covers values with fewer than two elements and keyedBy on an element that is not an object. A note replaces the inline issue on locale-dependent order. Two statements describe intended behavior that the linters do not have yet, and no test covers them: a number is out of order before any smaller number, where both linters only report a difference of 1 or more, and an array is not an object under keyedBy. Seven tests are added, and alphabetical-numbers and alphabetical-case are adjusted. Refs #13
This was referenced Nov 18, 2026
alphabetical: a number less than 1 greater than the next one counts as in order
openlint/openlint#49
Open
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The requirement for
alphabeticalsaid numbers are compared by value and two values of different types count as in order. That did not match Spectral and OpenLint. The section now states the comparison in full.StringNumericLiteralgrammar of ECMAScript, with a link to the exact production.keyedByon an element that is not an object or lacks the property, and says that the function fails with one problem.Two statements describe intended behavior that Spectral and OpenLint do not have yet. No test covers them until the toolbox is fixed:
[1.5, 1]passes.keyedBy. Both linters accept an index orlengthas the property of an array.Seven tests are added, and two existing ones are adjusted:
alphabetical-numbersgains a pair of equal numbers, and the purpose ofalphabetical-caseno longer names a method.Refs #13