Skip to content

Replace antfu's eslint config with xo#8766

Merged
fregante merged 14 commits intomainfrom
copilot/replace-eslint-config-with-xo
Nov 18, 2025
Merged

Replace antfu's eslint config with xo#8766
fregante merged 14 commits intomainfrom
copilot/replace-eslint-config-with-xo

Conversation

Copy link
Contributor

Copilot AI commented Nov 12, 2025

Replaces @antfu/eslint-config with xo's xoToEslintConfig() as specified in https://github.com/xojs/xo#xotoeslintconfig. Restores baseline rules like no-else-return that were missing.

Key changes:

  • Use xo.xoToEslintConfig() with existing rule overrides
  • Add Svelte plugin manually (xo lacks built-in support)
  • Configure unassigned imports for CSS and feature modules
  • Allow anonymous exports in config files
  • Disable JSX formatting rules (@stylistic/jsx-quotes and @stylistic/function-paren-newline) to preserve original code style
  • Revert incorrect type changes: querySelector and closest correctly return | null (not | undefined) per DOM API specification
  • Auto-fixed non-JSX style violations

Remaining work:

  • Linting errors from xo's stricter ruleset (can address separately)
  • 10 pre-existing test failures (unrelated to this change)

Test URLs

Verified eslint runs successfully on entire codebase with npm run lint:js

Screenshot

N/A - Configuration change only

Original prompt

This section details on the original issue you should resolve

<issue_title>Replace antfu's eslint config with xo's</issue_title>
<issue_description>Turns out I don’t like the config and it's missing baseline issues like https://eslint.org/docs/latest/rules/no-else-return

Let's switch back to XO using https://github.com/xojs/xo#xotoeslintconfig

// eslint.config.js
import xo from 'xo';

export default xo.xoToEslintConfig(/* our config */);

Partially reverts #7752, except we're not going back to xo-config.json</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Replace antfu's eslint config with xo's Replace antfu's eslint config with xo Nov 12, 2025
Copilot AI requested a review from fregante November 12, 2025 11:42
// TODO: Integrate style better https://github.com/refined-github/refined-github/pull/8285/files#r1951911960
side.after(
<a href={actionURL.href} className="d-block mb-2">
<SearchIcon width={14} className="color-fg-default mr-2" />Usage examples
Copy link
Member

Choose a reason for hiding this comment

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

@copilot disable the JSX quotes rule and revert all of its changes.

Also don't move the JSX right next to the opening and closing parens if it's on multiple lines. This file should be reverted in full, for example

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Disabled @stylistic/jsx-quotes and @stylistic/function-paren-newline rules in eslint config and reverted all 128 TSX files to their original state. The files now preserve double-quotes in JSX and keep JSX on separate lines from parens. Commit: c050158

@github-actions
Copy link

Please add labels to this PR

Copilot AI requested a review from fregante November 12, 2025 15:27
@fregante fregante added the meta Related to Refined GitHub itself label Nov 12, 2025
Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

welcome back XO

{
"source/background.ts": {
"@typescript-eslint/naming-convention": {
"count": 1
Copy link
Member

Choose a reason for hiding this comment

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

./source/background.ts
  53:8  error  Object Literal Method name `fetchJSON` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

./source/features/action-pr-link.tsx
  20:16  error  Function name `addForPR` must match one of the following formats: strictCamelCase, StrictPascalCase       @typescript-eslint/naming-convention
  28:16  error  Function name `initForPRPage` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/action-used-by-link.tsx
   9:10  error  Function name `getActionURL` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  14:8   error  Variable name `actionURL` must match one of the following formats: strictCamelCase, StrictPascalCase     @typescript-eslint/naming-convention
  26:8   error  Variable name `actionURL` must match one of the following formats: strictCamelCase, StrictPascalCase     @typescript-eslint/naming-convention

./source/features/clean-conversation-headers.tsx
  25:16  error  Function name `highlightNonDefaultBranchPRs` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/comments-time-machine-links.tsx
  27:16  error  Function name `updateURLtoDatedSha` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/deep-reblame.tsx
  29:8  error  Variable name `associatedPR` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/embed-gist-inline.tsx
  21:19  error  Object Literal Property name `fetchJSON` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/html-preview-link.tsx
  7:7  error  Variable name `isSingleHTMLFile` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/linkify-branch-references.tsx
  11:10  error  Function name `linkifyQuickPR` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  44:16  error  Function name `quickPRInit` must match one of the following formats: strictCamelCase, StrictPascalCase     @typescript-eslint/naming-convention

./source/features/list-prs-for-branch.tsx
  14:2  error  Object Literal Property name `OPEN` must match one of the following formats: strictCamelCase, StrictPascalCase    @typescript-eslint/naming-convention
  15:2  error  Object Literal Property name `CLOSED` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  16:2  error  Object Literal Property name `MERGED` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  17:2  error  Object Literal Property name `DRAFT` must match one of the following formats: strictCamelCase, StrictPascalCase   @typescript-eslint/naming-convention

./source/features/list-prs-for-file.tsx
   17:10  error  Function name `getPRUrl` must match one of the following formats: strictCamelCase, StrictPascalCase         @typescript-eslint/naming-convention
  117:8   error  Variable name `editingPRNumber` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/mark-merge-commits-in-list.tsx
  58:8  error  Variable name `isPRConversation` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/new-repo-disable-projects-and-wikis.tsx
  22:4  error  Object Literal Property name `has_projects` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  23:4  error  Object Literal Property name `has_wiki` must match one of the following formats: strictCamelCase, StrictPascalCase      @typescript-eslint/naming-convention

./source/features/one-click-diff-options.tsx
  40:10  error  Function name `attachPRButtons` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  98:10  error  Function name `initPR` must match one of the following formats: strictCamelCase, StrictPascalCase           @typescript-eslint/naming-convention

./source/features/pagination-hotkey.tsx
  28:3  error  Object Literal Property name `→` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  29:3  error  Object Literal Property name `←` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/pr-first-commit-title.tsx
  76:10  error  Function name `hasUserAlteredThePR` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/pr-notification-link.tsx
  8:17  error  Function name `removeLinkToPRFilesTab` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/prevent-link-loss.tsx
  39:10  error  Function name `getUI` must match one of the following formats: strictCamelCase, StrictPascalCase              @typescript-eslint/naming-convention
  69:10  error  Function name `updateUI` must match one of the following formats: strictCamelCase, StrictPascalCase           @typescript-eslint/naming-convention
  83:7   error  Variable name `updateUIDebounced` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/quick-mention.tsx
  147:8  error  Variable name `isPROrOldView` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/quick-repo-deletion.tsx
  36:16  error  Function name `modifyUIAfterSuccessfulDeletion` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  39:8   error  Variable name `restoreURL` must match one of the following formats: strictCamelCase, StrictPascalCase                       @typescript-eslint/naming-convention
  42:8   error  Variable name `otherForksURL` must match one of the following formats: strictCamelCase, StrictPascalCase                    @typescript-eslint/naming-convention

./source/features/show-associated-branch-prs-on-fork.tsx
  53:2  error  Object Literal Property name `OPEN` must match one of the following formats: strictCamelCase, StrictPascalCase    @typescript-eslint/naming-convention
  54:2  error  Object Literal Property name `CLOSED` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  55:2  error  Object Literal Property name `MERGED` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  56:2  error  Object Literal Property name `DRAFT` must match one of the following formats: strictCamelCase, StrictPascalCase   @typescript-eslint/naming-convention

./source/features/show-open-prs-of-forks.tsx
  17:7   error  Variable name `countPRs` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  41:16  error  Function name `getPRs` must match one of the following formats: strictCamelCase, StrictPascalCase    @typescript-eslint/naming-convention

./source/features/sort-conversations-by-update-time.tsx
  17:8  error  Variable name `currentSearchURL` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/sync-pr-commit-title.tsx
  38:10  error  Function name `getUI` must match one of the following formats: strictCamelCase, StrictPascalCase          @typescript-eslint/naming-convention
  47:10  error  Function name `updateUI` must match one of the following formats: strictCamelCase, StrictPascalCase       @typescript-eslint/naming-convention
  55:16  error  Function name `updatePRTitle` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/update-pr-from-base-branch.tsx
  52:3  error  Object Literal Property name `ignoreHTTPStatus` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/useful-not-found-page.tsx
   46:10  error  Function name `parseCurrentURL` must match one of the following formats: strictCamelCase, StrictPascalCase   @typescript-eslint/naming-convention
  195:16  error  Function name `initPRCommitOnce` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/features/user-profile-follower-badge.tsx
  15:4  error  Object Literal Property name `ignoreHTTPStatus` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/github-helpers/api.ts
   40:6   error  Type Alias name `GraphQLResponse` must match one of the following formats: StrictPascalCase               @typescript-eslint/naming-convention
   54:14  error  Class name `RefinedGitHubAPIError` must match one of the following formats: StrictPascalCase              @typescript-eslint/naming-convention
   69:6   error  Type Alias name `GHRestApiOptions` must match one of the following formats: StrictPascalCase              @typescript-eslint/naming-convention
   77:6   error  Type Alias name `GHGraphQLApiOptions` must match one of the following formats: StrictPascalCase           @typescript-eslint/naming-convention
   83:2   error  Object Literal Property name `ignoreHTTPStatus` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention
   97:9   error  Variable name `ignoreHTTPStatus` must match one of the following formats: strictCamelCase                 @typescript-eslint/naming-convention
  111:4   error  Object Literal Property name `Accept` must match one of the following formats: strictCamelCase            @typescript-eslint/naming-convention
  113:25  error  Object Literal Property name `Authorization` must match one of the following formats: strictCamelCase     @typescript-eslint/naming-convention
  208:4   error  Object Literal Property name `Authorization` must match one of the following formats: strictCamelCase     @typescript-eslint/naming-convention

./source/github-helpers/dom-formatters.tsx
  13:14  error  Variable name `linkifiedURLClass` must match one of the following formats: strictCamelCase, StrictPascalCase     @typescript-eslint/naming-convention
  14:7   error  Variable name `linkifiedURLSelector` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention
  66:17  error  Function name `linkifyURLs` must match one of the following formats: strictCamelCase, StrictPascalCase           @typescript-eslint/naming-convention

./source/github-helpers/get-default-branch.ts
  13:16  error  Function name `fromDOM` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention
  30:16  error  Function name `fromAPI` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

./source/github-helpers/github-file-url.ts
  5:22  error  Class name `GitHubFileURL` must match one of the following formats: StrictPascalCase  @typescript-eslint/naming-convention

./source/github-helpers/github-token.ts
  25:5  error  Object Literal Property name `Accept` must match one of the following formats: strictCamelCase         @typescript-eslint/naming-convention
  26:5  error  Object Literal Property name `Authorization` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

./source/github-helpers/index.ts
   24:17  error  Function name `buildRepoURL` must match one of the following formats: strictCamelCase          @typescript-eslint/naming-convention
  128:14  error  Variable name `userCanLikelyMergePR` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

./source/github-helpers/selectors.test.ts
  44:4  error  Object Literal Property name `Accept` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

./source/globals.d.ts
  17:6  error  Type Alias name `FeatureID` must match one of the following formats: StrictPascalCase                   @typescript-eslint/naming-convention
  81:6  error  Type Alias name `HTMLFormControlsCollection` must match one of the following formats: StrictPascalCase  @typescript-eslint/naming-convention

./source/helpers/caller-id.ts
  8:25  error  Function name `getCallerID` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

./source/helpers/feature-helpers.ts
  3:14  error  Variable name `getFeatureID` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

./source/helpers/fetch-dom.ts
   8:50  error  Type Parameter name `TElement` must match one of the following formats: StrictPascalCase  @typescript-eslint/naming-convention
  11:8   error  Variable name `absoluteURL` must match one of the following formats: strictCamelCase      @typescript-eslint/naming-convention

./source/helpers/hotfix.tsx
  42:15  error  Variable name `featureID` must match one of the following formats: strictCamelCase, StrictPascalCase  @typescript-eslint/naming-convention

./source/helpers/show-whitespace-on-line.test.ts
  11:10  error  Function name `serializeDOM` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

./source/options-storage.ts
   5:13  error  Type Alias name `RGHOptions` must match one of the following formats: StrictPascalCase             @typescript-eslint/naming-convention
   9:2   error  Object Literal Property name `customCSS` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention
  12:2   error  Object Literal Property name `logHTTP` must match one of the following formats: strictCamelCase    @typescript-eslint/naming-convention

./source/resolve-conflicts.ts
  58:5  error  Object Literal Property name `noHScroll` must match one of the following formats: strictCamelCase  @typescript-eslint/naming-convention

@fregante fregante marked this pull request as ready for review November 16, 2025 08:57
@fregante fregante merged commit 12bbd37 into main Nov 18, 2025
11 checks passed
@FloEdelmann FloEdelmann deleted the copilot/replace-eslint-config-with-xo branch November 19, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

Replace antfu's eslint config with xo's

2 participants