Skip to content

Upgrade to XO v2#1393

Merged
sindresorhus merged 1 commit intomainfrom
chore/migrate-to-xo-2
Mar 29, 2026
Merged

Upgrade to XO v2#1393
sindresorhus merged 1 commit intomainfrom
chore/migrate-to-xo-2

Conversation

@som-sm
Copy link
Copy Markdown
Collaborator

@som-sm som-sm commented Mar 29, 2026

Update to XO v2 & ESLint v10.

Majority of the changes in this PR are styling-related. The ones which are not are also pretty simple, like:

  • Replacing .sort with .toSorted.
  • Replacing BigInt constructor calls to bigint literals.
  • Adding v flag to regular expression.

@som-sm som-sm force-pushed the chore/migrate-to-xo-2 branch 2 times, most recently from c680bb4 to 1f34c53 Compare March 29, 2026 08:26
'@stylistic/function-paren-newline': 'off',
'@stylistic/object-curly-newline': 'off',
'@stylistic/curly-newline': 'off',
'@stylistic/operator-linebreak': ['error', 'before', {overrides: {'=': 'after'}}],
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

'@stylistic/operator-linebreak' is a useful rule, so instead of turning it off, fixed all the errors reported by this, like:

Image

Image

{overrides: {'=': 'after'}} is because I feel like it's better to have the line break after = rather than before it.

Image Image

'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/unified-signatures': 'off', // Temp
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
'@typescript-eslint/no-unsafe-type-assertion': 'off',
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Can't have this because we have assertions like {} as ... everywhere in tests. And in source files, there's no scope for assertions.

'@stylistic/quote-props': 'off',
'@stylistic/function-paren-newline': 'off',
'@stylistic/object-curly-newline': 'off',
'@stylistic/curly-newline': 'off',
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Turned this off because it seems to have conflicts with other rules. And also there's no good default for this rule for our codebase.

xo.config.js Outdated
'@stylistic/curly-newline': 'off',
'@stylistic/operator-linebreak': ['error', 'before', {overrides: {'=': 'after'}}],
'n/file-extension-in-import': 'off',
'unicorn/require-module-specifiers': 'off',
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Turned this off because source files have export {}.

Repository owner deleted a comment from claude bot Mar 29, 2026
Repository owner deleted a comment from claude bot Mar 29, 2026
@som-sm som-sm force-pushed the chore/migrate-to-xo-2 branch from 1f34c53 to a30b733 Compare March 29, 2026 10:01
@som-sm som-sm force-pushed the chore/migrate-to-xo-2 branch from a30b733 to 8da93e0 Compare March 29, 2026 10:11
Repository owner deleted a comment from claude bot Mar 29, 2026
Repository owner deleted a comment from claude bot Mar 29, 2026
Repository owner deleted a comment from claude bot Mar 29, 2026
Repository owner deleted a comment from claude bot Mar 29, 2026
Repository owner deleted a comment from claude bot Mar 29, 2026
paths: ['tsd', 'expect-type'],
},
],
'unicorn/require-module-specifiers': 'off',
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Can't have this in .d.ts files because there we have export {}.

Comment on lines 61 to 125
@@ -110,6 +121,7 @@ const xoConfig = [
'@stylistic/eol-last': 'off',
'capitalized-comments': 'off',
'unicorn/prefer-structured-clone': 'off',
'unicorn/no-immediate-mutation': 'off',
},
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Can't have unicorn/no-immediate-mutation enabled in tests and JSDoc codeblocks because we need this at times.

@som-sm som-sm marked this pull request as ready for review March 29, 2026 12:26
@som-sm som-sm requested a review from sindresorhus March 29, 2026 12:26
@sindresorhus sindresorhus merged commit 7373aba into main Mar 29, 2026
9 checks passed
@sindresorhus sindresorhus deleted the chore/migrate-to-xo-2 branch March 29, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants