Skip to content

Commit

Permalink
Merge branch 'master' into invalid-update
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Dec 14, 2023
2 parents 8c60dc9 + f5e712b commit d6d6d70
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: 'Require `Array#sort` calls to always provide a `compareFunction`.'
description: 'Require `Array#sort` and `Array#toSorted` calls to always provide a `compareFunction`.'
---

> 🛑 This file is source code, not the primary documentation location! 🛑
Expand All @@ -15,11 +15,11 @@ For example, when sorting numbers, this results in a "10 before 2" order:
[1, 2, 3, 10, 20, 30].sort(); //→ [1, 10, 2, 20, 3, 30]
```

This rule reports on any call to the `Array#sort()` method that doesn't provide a `compare` argument.
This rule reports on any call to the sort methods that do not provide a `compare` argument.

## Examples

This rule aims to ensure all calls of the native `Array#sort` method provide a `compareFunction`, while ignoring calls to user-defined `sort` methods.
This rule aims to ensure all calls of the native sort methods provide a `compareFunction`, while ignoring calls to user-defined methods.

<!--tabs-->

Expand Down
2 changes: 1 addition & 1 deletion packages/rule-schema-to-typescript-types/src/printAST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function printAndMaybeParenthesise(ast: AST): CodeWithComments {
};
}
return {
code: `${printed.code}`,
code: printed.code,
commentLines: printed.commentLines,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const serializer: NewPlugin = {

const keys = Object.keys(node).filter(k => !EXCLUDED_KEYS.has(k));
if (keys.length === 0) {
return `${node.type}`;
return node.type;
}

if (SEEN_NODES.has(node)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function createSerializer<TConstructor extends ConstructorSignature>(

if (thing.$id) {
if (SEEN_THINGS.has(thing)) {
return `${name}`;
return name;
}
SEEN_THINGS.add(thing);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/website/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function Feature({ title, description }: FeatureItem): React.JSX.Element {
function Home(): React.JSX.Element {
const { siteConfig } = useDocusaurusContext();
return (
<Layout description={`${siteConfig.tagline}`}>
<Layout description={siteConfig.tagline}>
<main>
<div className={clsx('hero hero--dark', styles.hero)}>
<div className="container">
Expand Down

0 comments on commit d6d6d70

Please sign in to comment.